0
$\begingroup$

Say I have a parametric shape, WLOG a Coon's patch.

I would like to generate the level of resolution of this parametric shape based on the rendering parameters. E.g. I send the AABB of the patch + the camera position.

This will tell me how far away the patch is from the screen and thus I can estimate the level of resolution needed to sample the shape.

I would like, if possible, to use no more resources than strictly necessary per frame.

One option is to first precompute the number needed on the CPU, then do a vertex-less render where we generate the vertex positions on the vertex shader based on the integer id.

However, this requires pre-computing the topology (index) buffer and passing it. Given the topology is trivially known (i.e. given the index of a triangle I can immediately tell you the three vertices that it touches), is it possible to avoid using an index buffer at all? Can mesh shaders be used for this?

$\endgroup$
3
  • $\begingroup$ If you haven't considered it already, instanced based rendering might be a good fit here. e.g. There is only a single quad or triangle that is drawn per instance. The vertex shader uses the instance id to know which quad it is drawing and the vertex id to know the vertex. That information is used to compute the info for the patch to draw that quad. The cpu computes LOD which it uses to compute the number of instances to draw and then does the draw instances call. It can be a nice fit for this type of algorithm without having to go to mesh shaders. (which are also a good fit here) $\endgroup$ Commented Nov 9 at 12:50
  • $\begingroup$ @pmw1234 I have not profiled it, but I suspect it would not be performant, engaging the instancing pipeline with very low poly counts is usually not advised. $\endgroup$ Commented Nov 9 at 19:38
  • $\begingroup$ That perspective is outdated. When vertex shaders are performing meaningful work, as in this case, modern GPUs with current drivers and APIs can easily process millions of patches per frame. $\endgroup$ Commented Nov 9 at 23:47

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.