• RuntimesUnity
  • Fading out Spine Objects using URP shader with Normal and Light Masks in Unity

Hello,

I've been using the Render Texture Script to shift color and fade characters out in Unity, but now that I'm in the process of adding lighting using the URP/2D/Spine/Sprite shader, I'm running into an issue where the render texture ignores the normal map and light maps.

Is there a solution for cleanly fading characters out that are using URP shaders?

Thanks for your time!

  • Harald님이 이에 답장했습니다.
    Related Discussions
    ...

    Hufflepie but now that I'm in the process of adding lighting using the URP/2D/Spine/Sprite shader, I'm running into an issue where the render texture ignores the normal map and light maps.

    I'm not sure I understand your setup described in this sentence correctly. Do you want to apply lighting to the baked render texture (at the RenderQuad object where the skeleton was rendered to) instead of applying lighting to the skeleton before it is rendered to the render texture, then this is not an intended workflow of these example components. The render texture filled via these example components only contains the final baked color information. See this forum thread where this question was handled before. Or is there anything preventing you from applying the normal workflow of lighting the skeleton before it is rendered to the render texture?

      Harald
      Thank you for the quick response!

      I’ve applied my the lighting to the skeleton before it is rendered to the render texture, however the render texture ignores the lighting at runtime and only displays the albedo texture.

      In other words, in edit mode, I see a rim light and normal map, but in play mode, when the render texture quad is displayed, only the albedo texture is being projected on the quad.

      @Hufflepie Thanks for the clarification. Upon checking the issue, I just discovered that when using the URP pipeline it indeed does not apply any lighting when executing the render to texture command buffer.

      Unfortunately we don't know of a proper solution yet, as this seems to not be supported (or well obfuscated) by the Universal RP according to the following sources:
      https://forum.unity.com/threads/camera-command-buffers-in-urp.1114219/
      https://docs.unity3d.com/2022.1/Documentation/Manual/render-pipelines-feature-comparison.html
      https://www.gamedev.net/forums/topic/708654-unity-commandbufferdrawmeshinstanced-does-not-work-with-urp/
      https://forum.unity.com/threads/unity-commandbuffer-drawmeshinstanced-does-not-work-with-urp.1015129/

      If anyone knows a solution on how to render to a RenderTexture using lit URP or URP 2D shaders, please share your insights here on the forum. Otherwise I'm afraid there is little we can do.

      Thanks for your time looking into this, I wanted to make sure I wasn't missing anything. If I find a solution, I'll report back!

      Thanks for your understanding. Happy to integrate a fix for this issue any time.