Download

Exclude geometry based on vertex color during at the vertex shader

Hey there! I’ve been using vertex colors to hide certain sections of a combined asset within a material by nulling out their vertex positions. It works as expected, but appears I’m still paying for GPU at the vertex shader phase for the full asset (using forward rendering). Is setting the world position offset done at the vertex shader level? I seem to only gain about 1/4th off my GPU costs by using this approach (bypassing the render). If I set all of the vertices to nan position, I still end up spending about 3/4’s of the the total GPU if I left all the vertices visible all visible to the render. Any tricks to get my GPU consumption lower for non used vertices?

The GPU needs to run the vertex shader to set the vertex to a nan position (anything you plug into the “world offset” pin is executed in the vertex shader), so obviously it won’t reduce vertex shader processing at all. All it does is skip triangle assembly and pixel shading.

First question is: how much frame time is being spent in vertex shading? Is it high enough to be worth reducing? If so, you’ll need to give up combining your asset and split them so you never even send those vertices to the GPU.