How to repeat image texture on the mesh material based on the texture's actual size

@Parisa_Shahbazi please refer this post : Texture repetition & Drawing lines issue with GLSL shaders

this issue was resolved with the help of @PavelBoytchev @manthrax and @Chaser_Code.

calculated the scale factor for that as following and passed in the fragment shader

script.js

const scaleFactor = surfaceData.face === "wall" ? 0.025 : 0.012;

 scaleFactor: { value: scaleFactor / zoomFactor },

fshaders.js


uniform float tileWidth;
uniform float tileHeight;
uniform float planeWidth;
uniform float planeHeight;
uniform float scaleFactor;

 float repeatX = (planeWidth / tileWidth) * scaleFactor;
 float repeatY = (planeHeight / tileHeight) * scaleFactor;

live code link : Glitch :・゚✧

1 Like