Hi,
I am using decal to apply a texture to floor mesh to avoid flicker also added zoffset (0.2) to each decal creation. Here, The problem is floor mesh losing its position at the bottom of the room every time I apply. The below image is a reference.
After digging and tried different cases with respect to the above (first image of the post) image, My findings are when the decal size is greater than the floor mesh size. you can see in the below image how i m using it. But I m using greater size as I dont know where the user will click, so I took larger decals size looks normal from any click.
Is there any solution where I can restrict/limit the applied decal not to exceed floor mesh
That’s strange because the decal mesh is clipped if it is bigger than the mesh on which it is applied.
For eg:
I have outlined the border of the decal mesh in red: as you can see, it does not go over the grey plane on which it is applied, whereas the projected decal itself is bigger than the plane, the full image being:
HI,
The Zoffset was higher incrment. now
the offset value is set 0.2 increments, problem looks ok but got new issue, in below every layer zoffset values are -1, -1.2, -1.4, but decal keed hiding on room rotation, i used
decal.sideOrientation = BABYLON.Mesh.DOUBLESIDE;
decal.material.backFaceCulling = true; but no use
the above one hangs my browser, dont know the reason
I don’t whether it will help you or not. below is my work link. i feel that it might wrong identification of the problem. when u open the below page, right side you will find tiles, take 24x24 size and click on floor, and take another tile, and in the bottom set tile count 1 and 3, and now click. Now you move the room you file to find the problem.
decal is creating every time when new image will select with Zoffset value.
For completeness, to reset the depth function use engine.setDepthFunction(BABYLON.Constants.LEQUAL); but you don’t need to do that if you use the depthFunction property.
Using several decals on top of each other work with the stencil technic too: