Orientation of textures with Triplanar node material

Hello,

I have a triplanar pbr material that I use to apply textures to a mesh without UVs. It works pretty well but I have an issue with the orientation of the texture, it seems to be rotated according to the plane it’s in :

As you can see, the texture is fine on the side, but in the front it is rotated by 90 degrees. Is there any way to fix this issue without manually changing the code of the triplanar texture block ?

Here is the set up of the material :

Thank you

There are ways to change the way the triplanar texturing applies by changing the input position.

For example, this material changes the way the texture is applied when the normal is close to (1,0,0), so that if you use the Cube model in the NME, you will see two faces that are different from the others:

Thank you, this indeed works for a cube or the model I originally sent. But would it be possible to make it work for something like a cylinder as well ? I tried lerping between the 2 values according to the dot product but couldn’t get it to work. I would like to keep the same rotation and avoid something like this :
image

Thanks again :slight_smile:

Triplanar mapping is more suitable for cubic shapes than for rounded shapes…

That said, it can be improved in the case of a cubic projection to better align the faces of the cube, which is also useful for rounded shapes. This PR will add a switch to use this mode:

Without the switch With the switch
image image
image image

Node material: https://nme.babylonjs.com/#WMKF08#6

1 Like

Hey, thank you this looks very promising !

I tested it on the preview NME and it works perfectly with only the base color in the output node, but there seems to be a conflict with the PBRMetallicRougness node :

I don’t know if this is an easy fix, but again thank you for your reactivity, the switch appears to do exactly what I need otherwise (if I can get it to work with PBR and normal/aorm).

Have a good day :slight_smile:

My bad! This PR will fix the problem:

1 Like

Thank you it works great !

Any idea when this will be released in the main build (roughly) ?

I think it should be available on next friday from the CDN. It takes a little longer for NPM - @RaananW will know for sure!

1 Like

Thursday morning US time :slight_smile:

(EDIT: of course, only if it is merged)

1 Like