Forum

The geometry mix shader

I really would like to make the geometry mix shader work, I’m reading microsoft’s documentations and other stuff I found but I did not find nothing related, mine problem is to create the two buffers filled with the two meshes.
I understood that is a Compute Shader task but I’m not a C programmer and mine approach to programming is crappy.

Can you give me some directions?

Attached there is my stupid patch with my crappy shader.
I understood that I have to fill the buffer with the values from the geometry but I don’t know how to access the geometry from the CShader and I’m not sure wich is the right method to store the data in the ByteAddressBuffer.

Can you address me?

mixMesh_try.zip (4.9 kB)

Tried this, but nothing…https://vvvv.org/sites/default/files/imagecache/large/images/Cattura2.JPG

triangle based geometry fading only works with the same vertex-count and with the same topology. if you want to fade between generic bodies you have to use a distance field or something different representation. if you want to receive a triangle based geometry in the end you should construct your geometry with marching cubes but that won’t keep the sharp edges. if you’re happy with the end result and don’t want to do any triangle based stuff afterwards you can use ray-marching. there are examples of both techniques here: https://github.com/microdee/mups but it might not work because i haven’t touched it for a while now.
also if you choose distance field based techniques you have to construct your body from distance equation based primitives, currently there’s no realtime way in vvvv of converting triangle mesh into distance field only vice-versa (DF into triangles via marching cubes).

Thank you very much, your marching techniques are very interesting, it’s another thing to study :)

I know that to mix two meshes they need to be the same vertexcount to avoid glitchy stuff. Wich maybe I wish to use.

I would like to understand how to use that mix shader, I’ve also tried to input two spheres with the same resolution (and a differet cycles value to recognize them) but I get no output…

I’ve just noticed that you don’t have any layouts connected. for gsfx output you have to define the order and the size of the semantics by InputElement (DX11.Geometry Join). If you’re using the mix.gsfx from my repo (https://github.com/microdee/Emeshe/blob/master/nodes/geom11/Mix.gsfx) then you have to use the layout setup in the attached patch.

Auto Layout unfortunately only reads the layout setup of the input geometry if it has any attached and not the output geometry (which can be different).

Ah yeah also RawIndexBuffer only outputs the index buffer not the complete geometry. For complete geometry you’d need to use Renderer (StreamOut) or a proxy gsfx which doesn’t do anything, like this: https://github.com/microdee/VVVV.Packs.mcro/blob/master/nodes/geom11/Thru.gsfx

UsualInpuElements (DX11).v4p (2.8 kB)

Many thanks!
but… I can’t make it works, I don’t know where is the error, I’ve tried with different patching, using the layout you provided in the thru shader, or not, using the Renderer (StreamOut) wich I can’t make it works also with a normal constant shader, tring different paramenters in As Auto and Auto Layout parameters… nothing.
Could be a driver question?

I also see that your thru shader support COLOR0 wich will my choice, but for now I wish to see this patch work also with minimal meshes…

A screenshot and the patch attached

mixMesh_tentativo.zip (3.8 kB)

alright the problem was that it was developed for my stuffs and usually i store the previous frame positions in the color semantic for calculating velocity for motion-blur and the mix gsfx was expecting the color0 semantic which wasn’t present in the geometry. (in dx11 if geometry doesn’t have a semantic the shader will not execute) so i’ve patched in a technique which can work with regular geometry as well. also strides here are the size of one vertex in bytes of the input geometries (not the output).
fixed gsfx and patch attached. i’m not uploading to github yet because emeshe is about to be rewritten until node15 and a lot of restructuring is going on there.

mixgeom-fixed.7z (3.9 kB)

Thank you very much microdee, you made my day.