uRaymarching
uRaymarching copied to clipboard
Fix "cutout" effect on full screen
Setting to full screen makes it only render on the inner half of the screen, you can fix this by changing
#ifdef FULL_SCREEN
o.pos = v.vertex;
#else
To
#ifdef FULL_SCREEN
o.pos = UnityObjectToClipPos(v.vertex);
#else
In whatever shader your generated code imports, for example at the bottom mine had
...
ZWrite [_ZWrite]
CGPROGRAM
#include "Assets\uRaymarching\Shaders\Include\Legacy/ForwardBaseStandard.cginc"
#pragma target 3.0
#pragma vertex Vert
#pragma fragment Frag
#pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma multi_compile_fwdbase
ENDCG
...
So I needed to modify that line in
#include "Assets\uRaymarching\Shaders\Include\Legacy/ForwardBaseStandard.cginc"
Are you using the generated material with the RaymarchingRenderer
component? The line o.pos = v.vertex
means that the rectangle generated by that component at runtime will be rendered to (-1, -1)
~(+1, +1)
in screen space without any MVP matrix multiplication. So we don't expect to use UnityObjectToClipPos()
here. What settings (Unity version, rendering pipeline, scene settings) are you using?
Yes, the generated material. This "cutout" effect is happening in the unity editor for me (editor camera and game camera), using legacy pipeline DX11, tweaking distance function of hexagon example and only changing it so Full Screen is On and Camera Inside Object True, made scale of Cube transform larger (30x30x30), Unity 2020.3.7f1.
If you just change the checkbox, the result will look like this:
If you want to see it in full screen, please use the RaymarchingRenderer
component as instructed in the documentation.
- https://github.com/hecomi/uRaymarching/blob/master/Documents/Legacy.md#fullscreen (However, the hexagonal floor example is not suitable for full screen, since it needs to check the scale to clamp the floor)
If you are already using it, please give me a screenshot of your settings and results so that I can better identify the problem.
Ah, nice I had missed that, thank you :) Your screenshot is showing the issue I was having, I will switch to using using the quad