Yeah, don’t expect this kind of visual using live rendering… Still a cone light should be possible, its not much different from the current lighting really, you could already move a point light with a small radius across walls to achieve a similar result I guess. Looking at how it works out just tweak the lighting shader so that it works the way you want it.
Everytime I hear people talking about cone lighting I think about this, but then I realize they probably want the first person version of it which is easier to fake :p
As you can see here, the light will be close to the first ray hit in rootNode.
Problem is that if you go around a corner with the light, or an edge, then the light will go inside the house and suddenly all light has disappeard from the outside of the house. It also doesnt look too good on the pavement, doesnt seem to really hit it..
Even if I were to use more than one pointlight and divde them equally over the distance, I would have to have
unresonably many lights to reduce the light around corner problem.
How about dividing multiple lights over the screen instead? shoot a few rays around and put lights there instead along a single line, may just help you faking the cone of light effect
Actually i guess this would be possible with a postprocessor.
get the depthbuffer, so you knwo the distance, then use the formular to define the cone and test that way wich fragments are in the cone and brighten them.
What you could do to resolve the issue with the corners, is to put a limit on the distance that the pointlight will be placed at. Also, I couldn’t tell really from the video whether you were varying the size (radius) of the pointlight based on distance from the player or not, but that might also make a difference when trying to go for realism.
I have been trying to work on a spotlight/conelight implementation for the engine, but recently had to take on a new project for my business and haven’t had much time. Also, delving into the lighting shader is no simple task. It’s not coded in an apparent way imho.
Were you involved in the lighting shader, or do you at least have a good handle of how it works? It’s not making much sense to me at the moment and I could use a little guidance.
SpotLights should be a core feature, and achieved through the lighting shader. It’s planned, there is already a SpotLight entry in the light type enum.
@Addez 50 lights will kill your frame rate, remember the scene is rendered once per light.
EmpirePhoenix said:
Actually i guess this would be possible with a postprocessor.
get the depthbuffer, so you knwo the distance, then use the formular to define the cone and test that way wich fragments are in the cone and brighten them.
I was thinking about the same thing before I got to sleep yesterday hehe. For a little more advanced user, it might be an idea to even use techniques alike the lightscatter filter perhaps? I wonder what one can obtain by turning the thing around, casting lightscatter rays from the camera's point into the scene :P
Well I though more like a inverse shadow, that casts light instead of shadows. However this is fa over my level of shader understanding at the moment so i’m not sure if thats possible.
Not quite, what you mean was the “post processor” approach outlined some posts before. Since you also have the depth information of every pixel, you can make it even more exact. You don’t need to change the lighting material for this, just let the post processor light up the areas in question (or darken the others).
The fog post processor is simple and uses depth information. I’d go with that and add a texture that acts the way the light looks (as you know most flash lights don’t have a perfect circular brightness pattern) and its intensity is calculated using the depth bufffer. Simple enough