About triplanarmaterial

It is hoped that the size of X, y, Z can be specified separately later;

Is there any other way to tile the map without setting the UV and only setting the size?

I want to find a way to tile without setting up UV. Triplanar material seems to be a choice, but it only has tilesize, which results in my tile width / height = 1; the correct one is width / height = 2:1

hi i have a way :slight_smile:
cube 3 side
https://playground.babylonjs.com/#J5NA28#3
alpha & beta from nrm
https://playground.babylonjs.com/#J5NA28#4

1 Like

I don’t know if there is a problem with the translation. But it didn’t seem to be what I wanted. Do you know the UVW box in 3DMAX? At present, triplanarmaterial can only be tilesize, which is always a square. I hope to set tilewidth and tileheight separately to make it a rectangle.

Now I have multiple mesh in my scene, and I set UV to make them tile the same size. In order to improve the performance, I merged them, but there is a problem of UV dislocation, how can I solve it?

hi @zhang
sorry for my short solution i full understand what you want and i show the 2 way for calculate
new uv without using correct uv attribute but we cant have general solution for this so you most use math and localPosition in Case or (if you use scale ) use worldPosition

after you explain your plan i make it for you this maybe help
https://playground.babylonjs.com/#J5NA28#7

if you can show a PG here with your last object i can make your exact solution

@nasimiasl
Thank you very much for your patience; your answer is useful. I changed it in your way and found a problem. The setting transparency does not work. Hope you can continue to help improve, need to support transparent mapping;
https://playground.babylonjs.com/#J5NA28#9

https://playground.babylonjs.com/#J5NA28#10

@nasimiasl :思维:
How to apply the transparency of texture image itself?

mat2.alpha = 0.1;
mat2.Fragment_Custom_Diffuse(`

vec2 scale = vec2( 1 , 1 );
vec3 newUV = vec3(localPos.x*scale.x,0.,localPos.z*scale.y );

// VUW
newUV = r_y(newUV,50., vec3(0.)); 
 newUV = r_x(newUV,20., vec3(0.)); 
 newUV = r_z(newUV,10., vec3(0.)); 
    
 vec4 res = texture2D(test1,newUV.xz );
 diffuseColor =   res.rgb; 
 alpha = res.a;

`);