MadeByJawns Posted April 27, 2018 Share Posted April 27, 2018 Hey, is there any way to change the shadow colour when using the shadow-only material, apart from using shadowGenerator.setDarkness() ? If not, I'm guessing maybe I'd need to try extend the shader to include emissive? is that right? or is there a different / easier way I can have a transparent mesh that displays colored shadows? This is so I can have a model with a blueish shadow displayed on page and be able to change the background page colour without also having to then match up the colour of a plane in the scene. Any pointers on how to begin would be great! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 27, 2018 Share Posted April 27, 2018 Shadows are generating by masking the lights. They are not producing a color per se. They just block the light to add energy to the local mesh color. So to produce colored shadow you will need to create your own shader that will compute the shadow level and will write the color you want accordingly The idea would be to replace this line : https://github.com/BabylonJS/Babylon.js/blob/master/materialsLibrary/src/shadowOnly/shadowOnly.fragment.fx#L49 by: vec4 color = myColor * clamp(shadow, 0., 1.); Quote Link to comment Share on other sites More sharing options...
MadeByJawns Posted April 30, 2018 Author Share Posted April 30, 2018 Thanks for the insights Deltakosh! Very interesting stuff, I've never done any shaders apart from using the material editor in Unreal so it's gunna be a bit of a learning curve I suspect, gunna do some reading on materials/shaders and give it a go when I have time :) GameMonetize 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.