BlackMojito Posted December 18, 2017 Share Posted December 18, 2017 Hi Folks, I have a question about the shaders used in Babylon. I saw some special stuff like the line below. I have searched __decl__lihghtFragment but I could not find it. And also this lines seems not to be standard grammar of GLSL. Could someone explain how it works? #include<__decl__lightFragment>[0..maxSimultaneousLights] The background is that I am using the CustomMaterial made by NasamiAsl and I would like to add some custom uniforms like the lights. So the stuff above interests me. Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 18, 2017 Share Posted December 18, 2017 Hello this is used by Babylon.js to compile shaders for webgl1 or 2 According to webGL version it will either pick one of these two files: * https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/lightFragmentDeclaration.fx (webgl1) or * https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/lightUboDeclaration.fx (webgl2) Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted December 19, 2017 Author Share Posted December 19, 2017 4 hours ago, Deltakosh said: Hello this is used by Babylon.js to compile shaders for webgl1 or 2 According to webGL version it will either pick one of these two files: * https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/lightFragmentDeclaration.fx (webgl1) or * https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/lightUboDeclaration.fx (webgl2) OK. So basically "__decl__lightFragment" is just a placeholder here? Hum...what is [0...maxSimultaneousLights] translated to in native glsl shader? Just declare another uniform variable called maxSimultaneousLights? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 19, 2017 Share Posted December 19, 2017 It will generate x uniforms (one per light from 0 to maxSimultaneousLIghts value) 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.