Few questions regarding mesh gen/animating normals

Hi there, I have a several question regarding public made examples, first of is the mesh generation:
https://playcanvas.com/project/819096/overview/mesh-generation-touchcontrol

  • Which part of the code is responsible for a base ‘bump’ or in other words: extrusion on y axis/height?

The second question is regarding texture animation
https://developer.playcanvas.com/en/tutorials/animated-textures/

  • The example makes it look like it is moving to some direction, how can I achieve spot-moving effect so it looks like it is moving, but you can’t tell its going to any direction at all, similar effect using shader:

https://launch.playcanvas.com/334050?debug=true

Thanks in advice

Hi @Newbie_Coder,

Check the update method in the mesh-generation.js script, specifically how the elevation variable is being calculated.

Not sure I fully follow you on this but most likely what you need is to animate the normal map together with the diffuse.

Such kind of water effects add an animated offset for each pixel when calculating the final normal. Here is a Unity tutorial that explains that in detail, potentially you could transfer that to GLSL and PlayCanvas:

1 Like

Hi @Leonidas

I’ve tried replacing every possible number in that script and haven’t found a solution to higher up the initial bump more than 0.5 (unless two bumps are created on the same position) editing elevation moves the plane, I’m not getting it, deform size adjusts it a little, but not much,

Regarding 2nd question, any other solution not including any shaders as I’m working with standard material on this one

Hi @Newbie_Coder,

To make the elevation bigger just scale the elevation variable, for example:

// Store elevation in .y element
positions[index + 1] = elevation * 3.0;

1 Like