What I want - is to be able to create some kind of “light” component, which will not generate light, but only shadows. It should be able to “shadow” already existing lights and shadows (basically after all calculation of shadow and lights, some kind of postprocessing them), shadowing all that is not “lit” by this “invisible light”.
It seems that I need to go inside rendering, but I just don’t get how and where. Can someone give me an advice what should be known to do such a thing, which classes I should investigate, and maybe there is even a some kind of API for that?
Unfortunately this is not what I need (I saw that already). This is “substractive light” while I need “substractive shadows” which doesn’t affect non shadowed lights. I hope I explain it clearly enough
At least can someone explain rendering of lights? At least - which methods are being called for their rendering each frame in which direction. Because I see associated functions (like AddLight, ModifyLight, their rendering counterparts, etc), but I am lost about their call order.
Regular shadows are not actually drawn, they are absence of light from a particular light casting object. I think you are thinking of lights as drawing both light and shadow as two different components, and you wish to simply not draw light one. This will not work.
I think you should move away from lights in regular sense and look for information on how to project an image onto world. Lights using light functions and decals use this in one way or another.
What you want to do is capture an image of what this invisible light hits, color all that black/grey and project this black image to pixels that are behind ones in projected image.
Actually shadow seems to be present in attenuation buffer, which is then applied wher rendering light. But well I don’t get how it gets transformed into ColorBuffer of light, and how to override to go straight into ColorBuffer of scene itself… Seems like it is doing that by some means of shaders…
I wish I could help you more but all I can say is that traditionally lights that cast shadows draw a depth map from their point of view to map surfaces that are closest to them. These are surfaces that will be lit. Later on when lighting is applied to scene that is rendered from players point of view, pixels in this view will be compared to values in lights depth map. If depth greater then value in map, that means pixel is behind a surface in lights view. That means it should not recieve light and will be shadowed.
Now this is generally speaking and there are other ways to create shadow effects, I don’t know for sure what implementation UE4 uses and being a state of art engine it’s quite possible it’s using more advanced techniques that I am not aware of. So feel free to take my advice with a grain of salt
A dirty way of doing it would be to add shadows to texture. You could render to texture in 3ds Max. That would require a complete scene to be done in 3ds Max, then exported.
Nope, definitely not a solution. I need to recalculate it dynamically at each frame - this “light” will be bound to character. Actually I need all of that to hide from player things his character can’t see (i am using a top down camera). Some kind of “fog of war”.