Search Unity

multi_compile a shader with and without GrabPass

Discussion in 'Shaders' started by szali, Jul 21, 2016.

  1. szali

    szali

    Joined:
    Jan 12, 2016
    Posts:
    17
    Hi!

    I am writing a custom shader for our water surfaces, which uses a texture from a GrabPass call to create distorted refractions. Right now I'm trying to implement differend detail levels for the shader. In one of the low detail versions I intend to disable the distorted refractions using simple alpha blending instead of sampling the grab texture. When disabling other expensive features, using multi_compile and #if directives did just fine, but it cannot be used to exclude pragmas, or anything outside the cgprogram.

    Is there a way to disable the GrabPass call in certain versions of the shader without writing a different shader or subshader?

    Thanks in advance!

    Szali
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Not that I know of. I believe the common technique is, which you don't seem to like, to provide different shaders and use the LOD tag and Fallback system instead.