Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "cutout" effect on full screen #24

Open
Phylliida opened this issue Aug 21, 2021 · 4 comments
Open

Fix "cutout" effect on full screen #24

Phylliida opened this issue Aug 21, 2021 · 4 comments

Comments

@Phylliida
Copy link

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"
@hecomi
Copy link
Owner

hecomi commented Aug 22, 2021

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?

@Phylliida
Copy link
Author

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.

@hecomi
Copy link
Owner

hecomi commented Aug 29, 2021

If you just change the checkbox, the result will look like this:

image

If you want to see it in full screen, please use the RaymarchingRenderer component as instructed in the documentation.

If you are already using it, please give me a screenshot of your settings and results so that I can better identify the problem.

@Phylliida
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants