three.js - ShaderMaterial not repeating after updating uniform texture -


After updating my texture, there is a problem with my tiled image. The text I'm updating is the same What is this when I try to update, that is 256x256:

I am currently using the latest version of three .js i.e. the irir. Version 68 with JS

Update function:

  function testing () {mesh = scene.getObjectByName ("plain", true); Texturex = three. Image Utility. Load ("images / mosaic_tiles_lief_poton_201005060.jpg"); Trap material. Uniform DefUsConverter.value = Texturex; Shader code:  
  mirror_shader = {Uniform: {"mirrorColor": {type: "c", value: new three. Color "," DiffuseSampler ": {type:" M4 ", value:" T ", value: zero}," mirrorcompler ": {type:" t ", value: zero}," texture matrix " The new three matrix 4 ()}, "Rickettex": {type: "i", value: 1}, "repeat": {type: "i", value: 1}}, vertex sha ader: ["uniform matte texture" Matrix; "," mirrorCoord vec4 different; "," texCoord vec2 different; "," vnormal vec3 different; "," eyeVec vec3 different; "," zero main () {"," vec4 mvPosition = modelViewMatrix * vec4 (status, 1.0), "vec4 worldPosition = modelMatrix * vec4 (position, 1.0),", "texCoord = UV," "mirrorCoord = textureMatrix * worldPosition;", "eyeVec = -mvPosition.xyz;", "vnormal = General (normalMatrix * General); "," gl_Position = projectionMatrix * mvPosition; ","} "] .join (" \ n "), fragmentShader: [" uniform vec3 mirrorColor; "," Uniform sampler2D diffuseSampler; "," Uniform sampler2D mirrorSampler; "" uniform int double ATX, "," uniform integer repeatY; "," mirrorCoord vec4 different; "," TexCoord Vec2 different; "," vNormal vec3 different; "," eyeVec vec3 different; "," blendOverlay ( Boat base, boat mix) boat {"," return (base & lt; 0.5? (2.0 * base * mix): (1.0 - 2.0 * (1.0 - base) * (1.0 - mix)); ","} "," Zero main () {"," vec4 color = texture2D (diffuseSampler, texCoord * vec2 (repeatX, repeatY)); "," Vec4 mColor = texture2DProj (mirrorSampler, mirrorCoord); M, "," m " MColor, color, clamp (dot (vNormal, normal (eyeVec) / 2.0.0.0.0), 0.4, 0.9)); "," Gl_FragColor = color; ","} "] .join (" \ n ")}; on net = scene.getObjectByName (" plane ", true); if (trap) {repeat_x = mesh.material.map. repeat. x; repeat_y = mesh.material.map.repeat.y; customMaterial = new THREE.ShaderMaterial ({fragmentShader: mirror_shader.fragmentShader, vertexShader: mirror_shader.vertexShader, uniform: mirror_shader.uniforms}); customMaterial.uniforms.diffuseSampler. value = Mesh.material.map; // roadtexture; my_mirror = new three. Mirror (renderer, camera, {Klipbiajh: 0.005, texture width: SCREEN_WIDTH, texture height: SCREEN_HEIGHT}); custom Matirkaniform. Mirrsnplrkvlu = My_mirror.texture; custom matrix. Eneramic.txtmatic.value = my_mirror TextureMatrix; CustomMaterial.uniforms.repeatX.value = repeat_x; Custom content. Infinity Repeat Y.value = Repeat_A; Trap.Content = Custom Content; mesh.add (my_mirror);}    

No problem, I thought it. I wrapped the new texture and set it to repeatWrapping

All I had to do was add the following:. Texturex.wrapS = texturex.wrapT = THREE.RepeatWrapping;

:)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -