Re: Lighting and Shadow System
Posted: Sun Feb 02, 2014 6:55 pm
You're welcome
Me too, I'll probably start porting this Java version as the process is explained really well and the code is easy to run. I've never seen a version of this implementation with the objects lit though. How far are you with your port?Ranguna259 wrote:That's a similar aproach to this one. I'm actually trying to reproduce that effect...
I use a very crude method at the moment, just multiply each point by a large enough scalar. I have been thinking of taking the lights height into equation to change the length, but it makes things more complicated. What do you do?Ranguna259 wrote:Since you draw the shadows how do you set their limit ? Do they stop once they reach a certain distance from the light source or when they hit the screen borders ?
Hey I modified the code and created a new gist with just lights https://gist.github.com/seanpackham/8779962 take a look at the code and comments for an explanation of the method. EnjoyJeeper wrote:Looks really awesome! I have a few questions though, I am going to start working on a game where I would like to have multiple light sources just for aesthetics. But only the light, not that it casts shadows on objects etc. How do you think the best way of accomplishing this would be?
Not far, I've been trying to find a rectangle to polar and a polar to rectangle shader but I think I'll start porting the code you linked too, let's compare results once we are doneargh wrote:Me too, I'll probably start porting this Java version as the process is explained really well and the code is easy to run. I've never seen a version of this implementation with the objects lit though. How far are you with your port?
In my previous CPU processed lightning system I used an algorithem to detect the intersection point between two lines and then I'd calculate the intersection point of a raycast with all the sides of the rectangles on the screen, the result would be the the point of where the raycast would end. Have your tried drawing the scene (the rectangles) after applying the shader ?argh wrote:I use a very crude method at the moment, just multiply each point by a large enough scalar. I have been thinking of taking the lights height into equation to change the length, but it makes things more complicated. What do you do?
Hey yesterday was slow going, was busy with freelance work. This is how far I am, shaders are ported but the rest needs some tinkering. I think I won't go further with this method as it is purely for shadows. Adding lit objects would mean I would first have to detect shadow casting edges like my subtractive algorithm and then run it through the shaders.Ranguna259 wrote:I'll start porting the code you linked too, let's compare results once we are done
I like this this article does that too http://www.gamedev.net/page/resources/_ ... dows-r2032Ranguna259 wrote: 1st - Draw scene
2nd - Apply shaders
3rd - Stop the shaders
4th - Draw the scene once again