Search In
• More options...
Find results that contain...
Find results in...

# (new)? lighting theory

## Recommended Posts

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.

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

Afcourse its slow, but should be fixed soon enough when new hardware ships.

Heh :)
Relying on raw power. I wish that was possible already.