HLSL pixel shader: possible to not set output color?

Is it possible to somehow not set the output color in a HLSL pixel shader without getting an error message It is possible with a CG shader. The effect is a transparent surface at pixels where the output color is not set/computed.

Nico Tongue Tied


Answer this question

HLSL pixel shader: possible to not set output color?

  • Wentzel

    No, you must generate a colour. If you want to kill the pixel, use texkill.

  • ckm

    The HLSL equivalent of texkill is "clip".

  • Vikram Bade

    Thanks for your suggestion. Smile Maybe I will try that some time. At the moment I just render one object, so I simply set the output color to the background color.

  • phatrice

    Hm, does something like texkill exist in HLSL Otherwise it is not that useful to me. Also at a first glance on the texkill dx documentation it seems to only kill the pixel if its tex coords are less than zero. But I like to use an arbitrary if statement to mask the pixel.

  • Cory.Isakson

    My suggestion is, if you can carefully arrange the rendering order and enable blending, then set the alpha value to zero should achieve what you want.
  • HLSL pixel shader: possible to not set output color?