On one of the DirectX forums, I have got this message:

Quote:

Which version of Direct3D are you using? Prior to D3D 10.0 you can't modify the number of vertices/primitives via HLSL - the Geometry Shader is required to add or remove actual geometry.

That said, if you're using D3D9 you can output the threshold value to a TEXCOORD (so its interpolated correctly) and then use clip() in the pixel shader. It's not necessarily the most efficient operation but it should do what you want.

Alternatively, if you're using D3D 10.0, 10.1 or 11.0 you can move your computation to the GS unit and simply control the emit() statements. You can bypass the VS if you're using this to eliminate extra processing, but be careful as this may not speed things up.

Quote:
And how to determine, which are on the right side of X (or Y, Z) axis? Or something like that?

At a syntax level you'll often go off the sign of the input so a simple inequality will do the trick. If you want to deal with planes (D3DPLANE in your app) you can pack all the coefficients into a single HLSL register and do a dot() (with w=1) to evaluate which side a point is...


Maybe this will help a bit...


What kills me not, that makes me stronger.

***Working on RPG/RTS***