instancing vs geometry shader , cant figure out whats best

Started by
1 comment, last by Matias Goldberg 12 years, 6 months ago
been looking at code from dx 9 and dx10

cant quiet get my head around some thing and i think im getting confused here and mixed up

in dx9 there is instancing were you pass multiple data via D3D10_INPUT_PER_INSTANCE_DATA.


geometry shadering is the new and improved way of doing intsancing , so you need to declare D3D10_INPUT_PER_VERTEX_DATA and send it via the geometry shader

i know you can do point light s on the geometry shader , but i would like to send a matrix via the geometry shader , or a point which will expand it into a mesh .



can some one apart from "dan" help me and clear up my mistakes
Advertisement

been looking at code from dx 9 and dx10

cant quiet get my head around some thing and i think im getting confused here and mixed up

in dx9 there is instancing were you pass multiple data via D3D10_INPUT_PER_INSTANCE_DATA.


geometry shadering is the new and improved way of doing intsancing , so you need to declare D3D10_INPUT_PER_VERTEX_DATA and send it via the geometry shader

i know you can do point light s on the geometry shader , but i would like to send a matrix via the geometry shader , or a point which will expand it into a mesh .



can some one apart from "dan" help me and clear up my mistakes


Hi,

You don't need geometry shader to do instancing. Yes, you may duplicate geometry with it, but it isn't as efficient as using the built-in instancing.

The D3D10/11 way of doing instancing is pretty similar to D3D9 way. That is, declaring multiple streams and setting a correct input stream declaration. Of course you may use also constant buffers for the per-instance-data. The key here is "DrawInstanced" command.

Expanding points to quads on geometry shader is slightly a different matter and not directly related to instancing.

Cheers!


geometry shadering is the new and improved way of doing intsancing , so you need to declare D3D10_INPUT_PER_VERTEX_DATA and send it via the geometry shader

Nope. You got your facts wrong.

The Geometry shader is a way to generate more vertices/triangles from a given triangle. The geometry shader, unlike the vertex shader, can look at all three vertices, not to just a single one. Although geometry shaders can be used to emulate instancing, it's highly innefficient; since Geometry shader's performance drops quickly as the ratio output/input increases.

Geometry shaders is cool for point particles, other billboards (i.e. trees in the distance), and some cool effects . It has been a big dissappointment imho. The most intuitive thing to do was to use it for tesselation, but performance was horrible. That's why DX11 came with a tesselation stage. The medusa demo from NVIDIA shows a way to use geometry shaders for cool effects (the green energy in the part where the guy gets turned into stone).

If you play it nice, mixing hardware instancing with geometry shaders, it is possible to render an environment map in much less than 6 passes, therefore making it faster. If you play it wrong, it will be slower. There's been a lot of papers about different methods to draw to an env. map in less than 6 passes using geometry shaders. In fact IIRC there was paper published here in GD.Net

But a replacement for HW Instancing? No, that's not really it.

Cheers
Dark Sylinc

This topic is closed to new replies.

Advertisement