Jump to content

Scene lights in ShaderMaterial


Recommended Posts

Is there a way to setup a ShaderMaterial such that it will be passed the uniforms for all the lights within the scene? I'm looking for something similar to the ShaderMaterial.lights property from three.js (http://threejs.org/docs/#Reference/Materials/ShaderMaterial). If the babylon ShaderMaterial does not support this is there any recommendations on the best way to share the scene lights with a ShaderMaterial?


Link to comment
Share on other sites

you can make any customized uniform you want in ShaderMaterial and you can send any type info(like lights , directions , point , ...)

just look shadermaterial in Babylonjs document (here) and if you have any problem make a playground (here) and ask again :)


you need build your light  , try with http://www.babylonjs.com/cyos/ this tools use the phong template



Link to comment
Share on other sites

I understand that you can manually setup and send whatever uniforms you would like, but what I'm looking for is a way to have babylon setup all the lighting uniforms automatically with the values of the lights within the scene where the ShaderMaterial is being used. It sounds like this functionality does not exist in babylon. With the three.js ShaderMaterial.lights property you just set it to true and the lighting uniforms are setup automatically so that it's very easy to use the same lights within your custom shaders that is being used by all the other meshes within the scene that are using "built in" materials.

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.

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.


  • Recently Browsing   0 members

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