Search Unity

Rendertexture with replacement shader giving confusing results

Discussion in 'Shaders' started by tifff, Jan 8, 2019.

  1. tifff

    tifff

    Joined:
    Nov 28, 2018
    Posts:
    1
    Hello everyone,
    i'm working on a project to simulate a thermal camera. Therefore every material in my scene is using my custom unlit shader to apply temperatures etc. I also have a second camera using a replacement shader to simulate a normal camera. To implement somewhat accurate reflections for each camera, i'm using a script which renders two cameras (one with replacement shader, one without) to cubemaps which get passed to the renderer for further calculation of the texture.
    (Mostly following this tutorial https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity and this https://docs.unity3d.com/ScriptReference/Camera.RenderToCubemap.html for realtime cubemap creation)

    Everything is working fine except for particles, i am guessing because of something with the alpha channel. I created a standard Material using the "Transparent" rendering mode to handle it respectively in my replacement shader.
    Now here is the problem: The rendertexture using the replacement shader does not contain the particles, eventhough you can see them in the camera preview. The rendertexture without replacement shader only shows the particles if i select a specific shader for the particle material, for example particles/additive. I do not know how to use this shader for the material though, because it does not have a "Rendering Mode" property which i use to distinguish between transparent and opaque materials in my subshaders of the replacement shader. Therefore this material is not displayed in the camera using the replacement shader at all.
    1. Is it not possible to view materials without "Rendering Mode" using a replacement shader?
    2. Could somebody provide an example of particles being rendered using a replacement shader?
    I am quite new to shaders in general and it would be great if anybody could explain this to me.
    Thanks in advance!
     
  2. ChristinaPCatalyst

    ChristinaPCatalyst

    Joined:
    Nov 23, 2020
    Posts:
    8
    Have you ever found out about this issue? I have the same problem currently.