Ingo Chou Posted November 5, 2015 Share Posted November 5, 2015 Hi, I try to set alpha in fragment.fx with code : gl_FragColor = vec4(finalColor, 0.4); but it displays almost white, not transparency. BTW, the shader works well. How can I set transparency in fragment.fx? Thanks for your help. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 5, 2015 Share Posted November 5, 2015 Hello you are doing the right thing, but you also need to mark the shaderMaterial to enable alpha blending =:var cloudMaterial = new BABYLON.ShaderMaterial("cloud", scene, { vertexElement: "vertexShaderCode", fragmentElement: "fragmentShaderCode" }, { needAlphaBlending: true, attributes: ["position", "uv"], uniforms: ["worldViewProjection"], samplers: ["textureSampler"] }); Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted November 6, 2015 Author Share Posted November 6, 2015 Ok, thank you. 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.