Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Retro Shaders Pro for Unity URP

A collection of PSX, N64, CRT, and VHS style shaders for Unity URP · By Daniel Ilett

Rendering Layer Mask - Decal Projection

A topic by Jack_Development created 43 days ago Views: 58 Replies: 2
Viewing posts 1 to 3

Hi Daniel,
First of all, LOVE the shader! It's so great to use, and the new vertex lighting is amazing! Using it all throughout my projects!
One issue I have come across is that when I enable Rendering Layers on the Decal in URP, I am unable to project the decals onto the Retro Lit material, even using the Decal material you provide and correctly setting the Rendering Layers for the objects
Switching the object back to a Standard Material seems to allow it to be projected, so I am inclined to think it's an issue with the shader code.
Feel free to file this under a Bug Report and keep on chugging along
Either way, looking forward to what you make next!

Hi Daniel,

Saw the new update to 1.5 with the overhaul, so I was hopeful that it would fix this issue, but I'm still having some trouble getting the decals to appear on the texture. So I was wondering if you had any ideas on what could be causing it and if you have any plans to fix it?

Thank you!

After messing around with it a bit more, I've been able to resolve it by doing the following:

RetroLit.shader:
Line 132 ++ #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
Line 548 ++ #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"

RetroDepthNormalsPass.hlsl:
Line 4 ++ #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
Line 5 ++ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GlobalSamplers.hlsl"
Line 6 ++ #include "RetroSurfaceInput.hlsl"
Line 41-45 ++ 
void depthNormalsFrag(v2f i, out float4 outNormalWS : SV_TARGET0
#ifdef _WRITE_RENDERING_LAYERS
    , out uint outRenderingLayers : SV_TARGET1
#endif
)
Line 62 --  return float4(NormalizeNormalPerPixel(i.normalWS), 0.0f)
Line 62 ++ outNormalWS = float4(NormalizeNormalPerPixel(i.normalWS), 0.0f);
Line 63-65 ++
#ifdef _WRITE_RENDERING_LAYERS
    outRenderingLayers = EncodeMeshRenderingLayer();
#endif

Apologies for the horrendous formatting, didn't wanna just drop full files, so did my best to write out all of the changes and where they are
Not sure if this would be helpful at all, or even if it causes any issues anywhere else, but it's got it working for me now!