alelievr / HDRP-Custom-Passes

A bunch of custom passes made for HDRP
MIT License
1.25k stars 136 forks source link

Could you manage a Screen Space Snow / Wet effect? #30

Closed djzombie84 closed 7 months ago

djzombie84 commented 3 years ago

Hey, I am looking for a Screen Space Snow effect like a wet effect. And wonder if you could do it? It should also be feasible to use a mask. So a box that could get out of the effect. Like, for example, there is snow or wet and inside it should be dry. Since it is a construction game, everything should be able to work without baking, as the players can build anywhere and to build a roof every time.

Translated with Google

alelievr commented 3 years ago

Hello,

Yes, that should be possible by modifying the roughness parameter in the normal buffer to give a "wet" look. You can look at the EncodeIntoNormalBuffer function to write into the normal buffer: https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl#L20

For the snow, you also need to modify at least the color of the object, this is harder because you don't have access to the GBuffer in HDRP. An alternative to modifying the GBuffer color is to use a Fullscreen pass with depth displacement (depth offset in ShaderGraph) to move the pixels where the geometry is and overwrite their color with a transparent/opaque shader. There is an example of this in the Liquid pass of this repo: https://github.com/alelievr/HDRP-Custom-Passes#liquid but it's a bit complicated though.

Otherwise, you can maybe use a generic big shader graph that can apply both wet and snow look on all your objects? that would be much simpler I think :) But it also adds more constraints artistically.

djzombie84 commented 3 years ago

I also thought about Shader. I would have to look like the performance then when the whole world changes to snow + the things that a roof did not change. I had a shader with snow and rain, which you can do it by Bool and out. I just realized that the ground of a roof has made the rake in the shader and thus all over the same material is. Thus, I had to clone the materials that led to more calls. Thank you for your answer :)