ColinLeung-NiloCat/UnityURPUnlitScreenSpaceDecalShader

Decals moving up/down at runtime.

kamgam opened this issue · 5 comments

First, thank you for making this open source.

I have a little trouble getting this to work at runtime / game view. It works in the Editor Scene View. I am using Unity 2019.4.1f1 and URP 7.3.1., Target "Android", the "Depth Texture" settings is enabled.

I have created an animated gif to show what is happening:
https://kamgam.com/unity/decal-shader-test.gif

I have also purchased the "Lux Shader" package you have recommended to another user (issue #9) but there seems to be the same issue. Any ideas on what might cause this?

Update: got it to work with adding a "Renderer Feature" with the default settings. Not sure what this does though. It seems to work now. Is this required for the shader to work?

adding "Renderer Feature" is not required, but doing this will force you to render your scene into an RT first, maybe this solved a problem, but I am not sure what the problem is.

What is your material's queue? maybe it is rendering too early (smaller than 2501)?

Thanks for your reply. I just realized that the queue was not visible in my gif, sorry for that. It is set to 2501 (from shader). Increasing it does not change the outcome. Reducing it makes it vanish at some point (1000ish range, far from 2501).
If I inspect the scenes rendering on the Frame Debugger I see the decal shader right after the depth texture write. Not sure if it's relevant, I am using "linear" color space.

I have composed an image of all my settings, maybe you can spot my error.

decal-shader-test2

Thank you for your effort.

If that's still relevant.

Make sure "Post Processing" is turned on, on your game camera.
At least this helped me with simillar (or maybe even the same) problem.

image

Thank you @SanyaBane for your comment and sorry for my late reply. Indeed that solved it for me. In my project there was some code which turned off Post Processing at runtime based on performance, so whenever I checked in Edit mode it showed as being turned on sigh. Thanks for the reminder and also thanks again to @ColinLeung-NiloCat . Sometimes you just can't see the forest for the trees.