Download

Help adapting a very short HLSL code to "instruction set cs_5"

Greetings,

I have been trying to adapt a very little HLSL old code to the “new” instructions set, however I have no idea about HLSL and I have probably tried without a lot of sense, but reading on the internet.

The code is as simple as this one:

clip( InFinalCoords );
clip( 1.0f - InFinalCoords );

return ( InFinalCoords );

It can be added after the UVs of POM and before entering in the UVs of the Texture Sample.

(It was useful for calculating silhouettes in an old version of Parallax Oclussion Mapping materials), and it still works on the preview mesh! As it perfectly clip the silhouettes of the material at borders. However, if you apply and sabe the material, it will show the next error:
[SM5] error X4532: Cannot map expression to cs_5_0 instruction set

So I have tried some modifications but always without success, showing even different error codes. Please, could you help me with this?

Thank you in advance!

You cannot call that from material editor for reasons. Same effect can be achieved by using masked material and outputting zero opacity, instead of discarding.

Thank you Deathrey!

So I have tried using a masked maerial bu I don’t understand quite well what outputting zero opacity means, so I have tried masking the R and the G channels of the POM UVs output and have achieved this result. Near it, but with problems at the corners. Please, could you help me a little with your explanation or with my problem, which maybe was achieved through a little different way than you explained?

Thank you again and best regards.