Deform geometry with texture

hello,

I am quite new to TouchDesigner.
I have a geometry (a grid) which i am able to deform using a noise SOP

but i would prefer to deform the geometry using a texture (bump map ?) as i can have more control over the deformation. How would i achieve that ?

Also, i am applying a texture (MAT) to the grid but i can’t see the deform as the light doesn’t cast shadows…

thanks a lot

Hi Gallo,

I don’t think there is a straightforward technique to achieve a vertex displacement from a TOP without passing through GLSL. So the basic approach is to have a GLSL component mapped with a texture for height map and a texture for normals and so on, in the sampler section.
derivative.ca/Forum/viewtopi … map#p37196

Another way is to transform a TOP into CHOP and then map to the z plane
derivative.ca/Forum/viewtopi … lace#p7807

You can find lot of stuff here on the forum by searching for “vertex displacement” or “height map” for example. Anyway, this thread could be a good place to archive everything about that topic once for all.

Hi Gallo,

Are you looking for solution that runs in real time, or one that can just be used to set up a mesh for rendering?

Vertex and normal displacement is an excellent solution for realtime situations, but you can also get very nice results for non-updating meshes with a small set of ops.

Here’s an example to get you started:

Non-realtime
base_mesh_displacement_non_realtime.tox (3.21 KB)

Realtime
base_sampler_approach_with_normals.tox (5.19 KB)

All of this aside, if you’re just looking to add a bump map to your rendering, there’s a parameter in the phong material that will allow you to use a bump map without doing any of this kind of deformation.

Hello,

thanks a lot for all the suggestions.

Yes i need a realtime rendering. I am trying to displace a grid with a texture.
It is pretty straight forward with a 3D modeling software like Blender, but i can’t reproduce the workflow (3D model + texture + black and white displacement texture)

Those tips you provided are way more complex than i thought.
At least for a new Touchdesigner user like i am !

And this makes me realize how far i am from understanding the logic of this tool :slight_smile: (very great tool anyway). I am more of a pure code user like openFrameworks

Anyway, i will have a deep look at your suggestions and see what i can get from it.

hi all,

i am close to achieve what i am looking for. Not sure this is the right approach but visually this is pretty close.

thanks Matthew for the great tutorial which put me on the right path
matthewragan.com/2014/04/27/ins … hdesigner/

I keep playing with that great developpement tool

Gallo

Ahh. In that case you might give Elburz shader a look:
github.com/nVoid/rutt-etra-TouchDesigner

This is similar to the GLSL material example above, but with a few custom parameters to make adjustments easier.

yes ! thanks for the link. I will have a look.
Shader side is still a bit rough to me though.

One more question : constant material is just a texture right ? If i need to play with lights and shadows, i need to use phong instead ?

thanks again

Yep, you will want to use a phong if you’re after any kind of lighting calculations.

Just few question about same topic about using the base_sampler_approach_with_normals approach:

  1. is there any method to add a PBR or other materials after the geo connected to the phong?
    so we can keep the displacement process separated from the texturing stuff?

  2. can we use the geometry viewer to see the plane displaced with the normals?

Thanks so much!

  1. You can certainly write a glsl material that allows for displacement and uses pbr - you do have to change the code around a bit. The easiest place to start is to drop down a pbr MAT and hit the “output shader” button. This gives you the starting point of default PBR Material as GL, and then you just need to modify the code to allow for vertex displacement and normal re-calculation. We covered a good chunk of this at the Make Some Noise workshop at Obscura:

matthewragan.com/make-some-nois … hdesigner/

  1. Yes and no… if I’m understanding your question correctly. You will see the results of the vertex displacement in the viewport of the geo, but I don’t think you can see normals like with other SOPs once you’re using a vertex shader. Similarly, toggling wireframe on the viewport will only show you the original mesh, and not the newly displaced mesh.

Thanks raganmd!

Some other questions come to my mind;
I’m now studying with your wnderful “make some noise” assets,
expecially the base_top_to_geo_displace_along_normal_dense_consant_color
example.

I’m trying to add lights, env lights and ambient lights externally from the phongGLSL shader
but can’t figure out how to achieve that.

Is the only way to do this to operate inside the GLSL code?

Not at all.

The fragment shader code here is changed to make it easier to work without lighting calculations, though you can easily add those back in.

In the pixel shader (phong1GLSLPixel1) change line 78 from this:

// skip lighting, and just output the color map as emissive // - - - - - - - - - - - - - - - - - - - outcol = colorMapColor; // - - - - - - - - - - - - - - - - - - -

To this:

// skip lighting, and just output the color map as emissive // - - - - - - - - - - - - - - - - - - - outcol *= colorMapColor; // - - - - - - - - - - - - - - - - - - -

You’ll now need to add a light to your scene in order to see your mesh.

oops.
It was just in front of my eyes, sorry

Trying this technique out for realtime.

I’m sending just a b/w movie and the displacement is working well, however Is there any way to input a separate image (texture) to the GLSL?

i.e: Geo has texture but is displaced by the GLSL input?

Sorry if my terminology is in-correct. Still getting used to TD.

hello,

using a phong MAT or PBR MAT as a base to output shaders, you can then add textures input in the Samplers tab of the Glsl MAT

You can also input textures into a GLSL TOP operator

Hey,

in case it helps someone I just converted the Phong to PBR in the “GLSL_Displacement” on a grid from @ben,
Here it is attached, but I also have a question: where are the “Emit” and “Constant” uniforms in the GLSL PBR output? Cheers! P

GLSL_Displacement_PBR.zip (33.9 KB)

BTW, guess what,

I did that GLSL converison for nuuutthhhinnn’', I am happy it took 1h only of my time ahaha, the PBR mat has NATIVE height map, aka switch it on under the normal map et voilà. Learning as we go ho ho ho :slight_smile:
Just to precise this: it allows to bypass CHOPS completely if we want to displace points on a grid geometry with LOTS of points for example. Very useful basic TD toolset stuff…hehe.
re-posted file with corrections.
Take it easy and happy new year! P
GLSL_Displacement_PBR_NOT_GLSL.zip (34.2 KB)