Temechon Posted December 16, 2013 Share Posted December 16, 2013 Hello all, I'm looking to create a glass shader that I can use in my Babylon projects, but I cannot achieve the effect I would like to have. Here is my code : https://dl.dropboxusercontent.com/u/17799537/08_GLASS.zip And an example of what I have so far is attached to this post. I don't know how to have the transparency required on my sphere... Thank you for your help ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 16, 2013 Share Posted December 16, 2013 Could you explain what you want your shader to do? Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 16, 2013 Author Share Posted December 16, 2013 Hi Delta, thank you for your answer. I would like to create a glass sphere, like in this example : http://stemkoski.github.io/Three.js/Refraction.html Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 16, 2013 Share Posted December 16, 2013 You should do the same as this demo:http://blogs.msdn.com/b/eternalcoding/archive/2013/08/06/babylon-js-creating-a-convincing-world-for-your-game-with-custom-shaders-height-maps-and-skyboxes.aspx the material I used for the water has a refraction part. This is exactly what you need here:) Hagop 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 17, 2013 Author Share Posted December 17, 2013 I tried to used the water material on my sphere, here is what i have so far.How can i set some transparency on my sphere ? I should be able to see through my sphere. I tried to use "hasAlpha", but I certainly don't know what I'm doing... Thank you for your help ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 17, 2013 Share Posted December 17, 2013 You have to define that your material need alpha blending:WaterMaterial.prototype.needAlphaBlending = function () {return true;}; And in this case, you should specify the alpha value of every pixel produce by your material Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 19, 2013 Author Share Posted December 19, 2013 It works with the alpha blending. I had to update the shader but I have now some transparency.I removed the bump texture and the reflection texture as I don't need it. Next problem : I would like more refraction that I have right now. I tried to update the refraction level, and tweak some values in the shader, without any results... The effect I would like to reproduce is the second image : I want to be as much realistic as possible. Ariel Yust 1 Quote Link to comment Share on other sites More sharing options...
Ariel Yust Posted December 19, 2013 Share Posted December 19, 2013 Last picture looks neat =] I wonder how to make it also... Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 19, 2013 Author Share Posted December 19, 2013 Made with 3DS, sadly... I want to do the same with babylon. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 19, 2013 Share Posted December 19, 2013 You need a big specular effect, refraction like in the water material (but you need to take in account normals) Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 20, 2013 Author Share Posted December 20, 2013 Sadly, I was taking into account normal, maybe not in the good way... I think I will put aside this experiment for the moment, I cannot find/create/reuse a correct refraction shader. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2013 Share Posted December 20, 2013 did you have a look to the refraction postprocess demo I used on babylon.js ? 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.