Normalmap generated bumptexture effects

I have this model with a specific mesh that received an bumptexture from it’s material.
This bumptexture is generate from a normal map and the material in question is the BABYLON.PBRMaterial.
Now am I wondering if it’s possible to rotate / scale / move the bumptexture from this mesh on the model.

Welcome aboard!

You can use the properties of the texture object for this: uOffset, vOffset, uScale, vScale, uAng, vAng, wAng

https://playground.babylonjs.com/#8XTR14

1 Like

In your example the texture is repeated. Is it also possible to use those properties without the repeation of the single texture. I’ve read something about the textureWrapMode and Clamp_to_edge but I don’t see a way on how to call it.

It’s the scaling property that repeats the pattern: don’t change the property if you don’t want repeats.

Is there another way to scale without repeating?

Use values of scaling less than 1:

https://playground.babylonjs.com/#8XTR14#1

Well that kinda misses the point in what I’m trying to do with it. Since I need to be able to “zoom in” and “zoom out” within the specific texture. Besides, if I start rotating the “repeated parts” are also becoming visible.

I don’t quite understand…

If you want to zoom in/out the texture, just scale the mesh itself (mesh.scaling). If you want to keep the same mesh size, zooming in and out is done with the texture.uScale/vScale properties, and you will get a repeating pattern when the texture is zoomed out - or some clamping if you use the clamping mode:

https://playground.babylonjs.com/#8XTR14#2

Many thanks, the clamp was indeed where I was looking for.

1 Like