I want to make a material that renders its emissive component only at parts of meshes which are not receiving light or maybe receiving light less than a certain amount!
For example a material that makes object look normal in the light but glows when the same object moves to dark environment
This would have been easy in a forward rendering path. As UE4 uses a deferred rendering path, we don’t have access to light vectors. If you had the light vector, you would only need to use the dot product to filter out the lit and dark area of the mesh.
Maybe there is a trick that can be used in deferred rendering. Is there anyone who knows how?
Having this same question myself, seeing lots of others asking it… Its such a simple thing and it’s just “base color” but made emissive and reversed… I’m having trouble understanding why that’s impossible to pull off. I don’t understand this stuff technically so I admit ignorance but it seems like there should be some function to just flip some of the options that are already there… I don’t see why this needs to be so complex
If it can’t be done at all that’s seriously frustrating… making planets is basically impossible
I managed to piece together (more like improvise) a decent solution (which is by no means complete) and I thought to share it with other people having the same problem. Anybody who knows more please help to improve this
So as workaround what I did was to manually put a vector parameter in the shader that indicates actual (or approximate) position of the light source to be used for calculating approximate light vector and then use the dot product and other common mathematics to determine if the light is falling on the current vertex and then feed the result to the emmissive channel
With blueprints and c++ logic a set up can be used in the game where the parameter regarding the position of light can be set during runtime
So far the shader technique have given decent result. There is a area between the lit and unlit area which the shader logic does not reach because of strict limit of if dot product =0 (needs to be fixed)
Apprantly That would create a whole lot of messy material. And yes this is perfect for one or two lights but is difficult to implement when there are too many lights. but again you can indeed extend this to many lights (painful work)
Ah yes, this is a perfect solution if you only need one light source. Question though, don’t you need to normalize the vectors? Dot product can be quite unreliable if you do not normalize the vectors.
Sheeeeeeiiitttt! Yes you are right! you see I’m a beginner so I didn’t knew normalisation node existed instead I was thinking of doing all multiplication and square rooting divide and what not . Thanks for telling me about that node