Rajkumar Posted June 6, 2016 Share Posted June 6, 2016 Hi All, I would like to have a gradient background in my application. For example: https://github.com/mattdesl/gl-vignette-background What is the best way to achieve this in babylon js? Regards Rajkumar Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 6, 2016 Share Posted June 6, 2016 Hi again @Rajkumar, how ya been? I hope well. After a quick forum search for 'gradient', I found that our local hero @Temechon introduced us to a gradient shader, and used it in a few demos... http://www.html5gamedevs.com/topic/8160-gradient-shader In some of the demos in that thread, the URL to the cloud picture ( http://www.babylonjs.com/Scenes/Clouds/cloud.png )... is failing to load-in. You might see checkerboard clouds instead. Not sure why that is happening, and it's not pertinent to the issue. Another way to background-up, is the use of a background "layer", and texture it with a gradient image. http://www.babylonjs-playground.com/#27QHMX#1 Lines 206-208 do the dirty deed... on this exquisite Spherical Harmonics demo by @jerome. We may see yet another layering system soon, in the arrival of @Nockawa's new Canvas2D system. Likely, it has the power to use JS to generate dynamic gradients without shaders, as well as having the power to do TONS more. But I think it is a GPU-based system, which makes it... umm... shader-related? I dunno. I haven't had the enjoyment of experimenting with it, much, yet. Hope this helps. Be well! GameMonetize and jerome 2 Quote Link to comment Share on other sites More sharing options...
Rajkumar Posted June 6, 2016 Author Share Posted June 6, 2016 Hi @Wingnut, I am fine and thank you for the quick reply. Use of layer worked well for me. Regards Rajkumar Wingnut 1 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.