eboo Posted March 18, 2016 Author Share Posted March 18, 2016 i love it! Quote Link to comment Share on other sites More sharing options...
ozRocker Posted July 4, 2016 Share Posted July 4, 2016 This should be the default for cubes. With seamless textures you would get 4 faces that look nicely connected. With the default configuration you get 0 faces that look connected. What @eboo is asking is also the default cube configuration in frameworks like Second Life. eboo 1 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted July 4, 2016 Share Posted July 4, 2016 I've been playing with this and I'm trying to find a way to tint the colour. I've learnt that I can change colour doing this: BABYLON.Effect.ShadersStore["boxTexturePixelShader"] = "precision highp float;\n\ varying vec3 nrm;\n\ varying vec2 vUV;\n\ \n\ uniform sampler2D tex1;\n\ uniform sampler2D tex2;\n\ vec4 tint = vec4(1,0,0,1);\n\ \n\ void main(void) {\n\ vec4 col = texture2D(tex1, vec2( 1.-vUV.y,1.-vUV.x) );\n\ vec4 col2 = texture2D(tex1, vec2(vUV.x,1.-vUV.y) );\n\ vec4 col3 = texture2D(tex1, vec2(1.-vUV.x, vUV.y ) );\n\ if(nrm.x != 0. && col.w > 0.7 )\n\ gl_FragColor = vec4(col.rgb,1.)+tint;\n\ else if(nrm.z > 0. && col2.w > 0.7 )\n\ gl_FragColor = vec4(col2.rgb,1.)+tint;\n\ else if(nrm.z < 0. && col3.w > 0.7 )\n\ gl_FragColor = vec4(col3.rgb,1.)+tint;\n\ else gl_FragColor = vec4(texture2D(tex2, vUV ).rgb,1.)+tint;\n\ }"; but I don't know how to access that tint colour using setColor4. When I try mesh.material.setColor4("tint",new BABYLON.Color4.FromInts(255, 0, 0, 1)) nothing happens. Mind you, I'm very noob at shaders. My attempt here: http://www.babylonjs-playground.com/#TRNYD#15 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.