jwagonr Posted February 2, 2016 Share Posted February 2, 2016 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? Thanks. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted February 2, 2016 Share Posted February 2, 2016 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 Quote Link to comment Share on other sites More sharing options...
Blax Posted February 2, 2016 Share Posted February 2, 2016 yes, you can set lights coord through uniform instruction. If have we many lights perhaps help declare array in uniforms (i can't normal send arrays in supported GLSL version Quote Link to comment Share on other sites More sharing options...
jwagonr Posted February 2, 2016 Author Share Posted February 2, 2016 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 2, 2016 Share Posted February 2, 2016 Shadermaterial populates matrices and bones for you. But you are right lights are not populated 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.