Sign in to follow this  
lomateron

stop rendering

Recommended Posts

I have a technique that uses vertex, geometry and pixel shaders

 

I want to render nothing to a texture when i read in the vertex shader a texel and i see that it has a determined value.

 

The best way I know in performance to make it render nothing is to replace the vertice position "w" (the fourth value) with 0.0f. Is there a fastest way? is there something similar to clip() but for the vertex shader? to stop going into the geometry shader.

Edited by lomateron

Share this post


Link to post
Share on other sites

You must output something from the vertex shader, but you can discard entire primitives in the geometry shader. So, you could set an integer in your VS out structure, and in GS see if any incoming vertices of the current primitive have that integer set.

Share this post


Link to post
Share on other sites

You didn't mention what types of primitives you are using, but in general, if you put your vertex outside of the clip space then you are effectively clipping the vertex.  The trouble is that you are using the Geometry Shader, which operates before clip/cull operations in the rasterizer.

 

So in that case, you would probably have to use the GS as Niko mentioned.  Depending on the amount of times that you expect to get one of these 'dead' vertices, it may or may not be worth doing from a performance standpoint...  Probably you could just use the w value in the GS, and if it is zero then just directly jump out of the shader (of course this will vary based on your primitives...).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this