Is there a way to for example in vertex shader cull current vertex? I have my own grass system and I would like to cull straws that are further away than some distance but I can't use camera culling because grass is drawn in chunks and it hides a whole chunk.

  • \$\begingroup\$ You could use a Stencil shader, although I'm not sure if it'll improve performance. \$\endgroup\$ – John Hamilton Mar 10 '17 at 13:07

You cannot discard a vertex. You can discard a fragment but at that point in the pipeline you would get little to no performance benefit for discarding pixels.

You will likely need to use some sort of level of detail system for your grass. Far away grass is drawn in larger and less detailed patches with near grass being drawn in smaller more detailed patches.

  • 1
    \$\begingroup\$ Technically he didn't say he wants to discard them for a performance improvement, although that's probably a good assumption. \$\endgroup\$ – jhocking Mar 8 '17 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.