BruceLane Posted October 22, 2014 Share Posted October 22, 2014 hi,is it possible to have a fragment shader instead of a skybox for the background?thank you Quote Link to comment Share on other sites More sharing options...
Carlos R Posted October 22, 2014 Share Posted October 22, 2014 Yes its possible: http://pixelcodr.com/tutos/trees/trees.html Check this shadershttp://pixelcodr.com/tutos/shooter/game/shaders/ // Skydome var skybox = BABYLON.Mesh.CreateSphere("skyBox", 50, 500, scene); // The sky creation BABYLON.Engine.ShadersRepository = "shaders/"; var shader = new BABYLON.ShaderMaterial("gradient", scene, "gradient", {}); shader.setFloat("offset", 200); shader.setColor3("topColor", BABYLON.Color3.FromInts(0, 119, 255)); shader.setColor3("bottomColor", BABYLON.Color3.FromInts(240, 240, 255)); shader.backFaceCulling = false; skybox.material = shader;Those aren't mine, credits from Julian: http://pixelcodr.com/aboutme.html Temechon 1 Quote Link to comment Share on other sites More sharing options...
BruceLane Posted October 22, 2014 Author Share Posted October 22, 2014 perfect, thank you ! Quote Link to comment Share on other sites More sharing options...
Xeonzinc Posted October 22, 2014 Share Posted October 22, 2014 I was actually looking into building a full day/night/weather sky shader a few weeks ago. There seem to be enough resources on the web, with a lot of it being fairly straight forward and definitely do-able in Babylon. Essentially a basic version just needs to scroll through a few textures based on your time of day and sun position. So if you want something fancy this is always possible. It's not at the top of my list to work on at the moment, but maybe one day if someone doesn't get there first. Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 22, 2014 Share Posted October 22, 2014 For a really good skybox, I feel like you'd need several things:A spherical skybox spheresun/moon spriteslots of cloud sprites floatin aroundand such. Carlos R 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 23, 2014 Share Posted October 23, 2014 Look at this : http://www.babylonjs.com/playground/#9VC8L Available in this thread : http://www.html5gamedevs.com/topic/8160-gradient-shader/?hl=gradient Cheers, Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 23, 2014 Share Posted October 23, 2014 BTW it's strange but the sprite stops working, nothing appears and it worked well before. There is a bug in babylon ? http://playground.babylonjs.com/#1G2LLJ#4 It seems that this is because the alpha of the image that is not taken into account despite the fact that the image exists. Strange, it worked before. Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 25, 2014 Share Posted October 25, 2014 It worked once for me, then broke as well! I looked at the console, and it was whining about security, so I put the image on imgur and... I think it works now: http://playground.babylonjs.com/#9VC8L#3 I slowed down color changing, as well as made the skybox always follow the camera. This makes it so you can't leave the beautiful blue sky. I wonder... Would it be possible to have several layers of skybox? One with gradient, and then several others that fade in and out depending on time of day.... One example would be beautiful stars... such as http://static-3.nexusmods.com/15/images/110/939721-1350318578.jpg My mind would blow if we could make a sky like this... Dad72 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 27, 2014 Share Posted October 27, 2014 We can you can have multiple skyboxes with transparency (material.alpha) Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 27, 2014 Share Posted October 27, 2014 Cool! How would I turn a image such as stars image to a sphere? 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.