Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(new)? lighting theory

Recommended Posts

Hey, I know instead of calculating the lighting mostly,its done a differant way. The shadow has been calculated. But what about this technique for the lighting:

Create a sphere around the lightsource. ( Afcourse this doesnt have to be rendered ). Increase the radius of the sphere, till every part of the sphere has been clipped at a surface or that r (radius) so big that it doesnt have any effect for the eye. ( Note that useing multiple light sources, it can be seen indeed ).

r = sphere radius = distance from light source to the object.
distance = Xdistance + Ydistance + Zdistance.

The dissapeard area grows with the sphere, so there wont be any clipping "behind" objects. So the clipping area will be x * r + y * r.

//loop through all light sources
for (int l = 0; l < all_light_sources; l++)

/*loop through all grid cubes of the sphere (the more detail the sphere has, the more lighting precision)*/

for (int i = 0; i < all_polygons; i++)

if (!sphere.Clipped() && 1/(totalR * totalR)> 0.0001f)
// 0.0001f stands for the "viewable" amount of light

/* render per pixel , triangle or whatever u want
The sphere has to be a grid. When a "cube" clips with its surface, it does 1/r^2. Colors have to be the same though glLight1[] = {1/r^2,1^r2 etc};*/


Clipped() when the x,y,z coordinates of the world is equal to the sphere coordinates which increases.
So the detail of the lighting in the z depth equals to the growing speed of the sphere. The detail of the lighting in the x,and y axis equals to the polygon amount/detail of the sphere.

For less detail for lighting in the distance, just lower the detail of its sphere. ( can do with 1/r^2 as well ). Wow 1/r^2 can be used for almost anything. Remove the 1 and u got a lightened up a room with black as light source. Same as 1/r^2 -= 2 * (1/r^2); though.
errr lighting = (1/(r^2*r^2)) decreases its lighting effect on a object alot faster. Going to far out of the original subject now.

Share this post

Link to post

Works for lightmap calculations IMO, but the bubble method is quite slow for real-time applications.

Share this post

Link to post

That's an interesting idea...the only thing I see that would improve it speed wise would be to just use three circles. Figuring the outer edge of a circle is much faster than attempting to generate sphere coordinates (something that took me for-freaking-ever to polish), and, provided they were positioned correctly in regards to the eyeplane, would provide almost the same effect. I've always hated lights that shine through walls...


Share this post

Link to post
This topic is now closed to further replies.