How to transform geometry in DX11?

I’d like to scale and translate geometry before sending it to e.g. VertexNoise (DX11.GeomFX).

How can I do that? Do I have to write a custom geometry shader?

Thanks a lot!

pretty sure instance noodles has a geometryFX for this.

But in case you want to try it yourself, all you need to do is to apply your transform in the shader to the positions. = mul(PosO, transform_matrix).xyz;

PosO is are your input vertex positions and should be float4 so it can be multiplied with a 4x4 matrix.


Thanks a lot @tekcor.

Yes, found it: TransformBuffered (DX11.GeomFX)

I’ve tried similar things before but couldn’t make it work.

I’ve now tried your line. PosO seems to be float3 though. I changed it to = mul(float4(,1),transform_matrix).xyz;
which seems to compile but doesn’t transform the geometry.

transform (4.1 KB)

I’m going to stick with the buffered version, for now, but it would be nice to know why it doesn’t work.

Unfortunately, I ran into another problem with this.

TransformBuffered (DX11.GeomFX) is not spreadable. I know about IID. And that works well if I want to use the same object multiple times. But I have different objects and need each of them only once.

What can I do about that? Is there a way of using TransformBuffered (DX11.GeomFX) with multiple different geometries?


I’ve read about a similar topic here: Instancing Spread of different geometries - #6 by seltzdesign

I’ve managed to do what I want using Merge (DX11.GeomFX).

transform (4.8 KB)

What I actually need should be much simpler though. I want to avoid instancing (as it involves a lot of patching and performance overhead as mentioned in the thread above). Instead, I would like to output a spread of multiple geometries that I can use with regular shaders like Constant (DX11.Effect).

This is how far I’ve got, but only the first geometry is being rendered:

transform geometry - without (8.7 KB) (4.6 KB)

Thanks a lot for your help, @antokhio . Unfortunately it’s slightly broken though.

VertexCount node was red initially but I found it here: Geometry shaders spreadable?

In addition the technique “PassMesh” doesn’t seem to exist anymore in Template.fx. When I change it to the only available other one “Constant” the output of the renderer stays black.

Make sure there is a same template as in the folder, just try rename that template in to something, I think there is vvvv bug with help patch, it changes shader on it’s own

edit just use that instead: (9.1 KB)

Thanks a lot. The patch does the transformation but it also merges the geometries into a single one. If you use spreads on the Constant shader both geometries will be treated as a single one and e.g. show up twice or with both of the same color.

Is it possible to get a spread of geometries as a result?

Thanks again!

As far as I know Geometry Shaders are not spreadable, I ran into the same issue already!

Then you basically need to write your own shader without geometry shaders.

Geometry Shaders are anyway not neccessary for your purpose.

You can just edit your forward shader which you use for rendering with the code from vertex noise in the vertex shader?

@teckor it possible, at list on node17_dx11_shading there is an example finally ;]

however you need to hardcode amount of subsets…
Capture (7.1 KB)

oh thats interesting @antokhio
just not a realy good option most of the time if it needs to be hardcoded. only if you procedurally generate the code but then I’d rather do some batching

Thanks for all of your help. I learnt a lot!

That’s what I ended up going with. As hard-coding the would have been too restricting and tedious in my case.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.