Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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.