Jump to content

Question about default.fragment.fx


BlackMojito
 Share

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...