Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Occluded vertex colours

Discussion in 'Shaders' started by unity_Qei8CQ3D-zymZg, Jul 16, 2019.

  1. unity_Qei8CQ3D-zymZg


    Jun 20, 2019

    I am (still) working on a research application and I could use some pointers on a particular issue I am facing and hoping to solve using shaders.

    The scene is a simple unlit scene with occluded game-objects (each with their materials and textures).
    I would like to know at what stage in the render pipeline do I have access to the vertex distance from the camera AND the colour information of each vertex (even if occluded) as I need to combine colour information of occluded vertices under certain circumstances.

    I tried post-processing shader script on the camera (one of the Ronja tutorials), but that doesn't work in the current context. The depth buffer has already rejected all occluded vertices and the colour fragment is also missing occluded vertex colour info.

  2. bgolus


    Dec 7, 2012
    During the vertex shader on that mesh. That's the only time you're guaranteed access to that data. If it's occluded, and the sorting order is doing its job, the fragment shader on that mesh will get skipped.

    If you absolutely need that information, you'll probably want to render your objects using a shader with ZTest Always.