I've been thinking about it too...What I've come up with (In theory, havn't had time to code it yet) is..
Think of any pixel in the scene, what is the one
that each pixel has in common with a light? Vector.
360x360x360 that defines any light/pixel combination.
A lot, over 16Million...but do we really need such accuracy?
Why not compress space...
Reduce it all to the aspect of say... 32x32x32
Now the obvious next step is to determine this at each lumel position..but when you think about it, each unique angle can only cast a shadow or not..there cannot be two shadow casters along the same vector...so, instead..we keep local to the light..
now wiht a simple 32x32x32 array, we can very very quickly determine if any lumel is shadowed, even if it's from a single pixel within the same model or differant.
As in that 32x32x32 little array, we encode the distance from light to lumel..now as the look up is a vector, the distance in effect becomes the z value.
Some come runtime, all we have to do to determine if a lumel is shadowed is,
Entity_PointAt LumelPivot,LightX,LightY,LightZ ;Point towards the light.
Pitch=Entity_Pitch LumelPivot
Yaw=Entity_Yaw LumelPivot
Roll=Entity_Yaw lumelPivot,
The vector is made up from the angles got from pointing the lumel at the light. a quick easy way that doesn't degrade over distances.
Now compress to within 32x32x32 (Or higher for a higher res shadow detail.)
we do this by doing this,
CompressedPitch = 32*(Pitch/360.)
CompressedYaw== 32*(Yaw/360)
CompressedRoll 32*(Roll/360)
In our light, create a fake multi-dimension array in objects,
Pdist=Light\Lut[ CompressedRoll]\Lut[CompressedPitch]\Lut[CompressedYaw]
get the current set shade distance.
if Entity_Distance( lightPiv,Lumel) < pDist ;This is a closer lumel, so is the one that casts the shadow along this vector.
now run time, to determine if anything being rendered is in a shadow, we just quickly get the vector in the same manner, and check if the distance is greater than the encoded one in the light..if so, it has to be shadowed.
The downside is moving lights...they'ed need to be recalced on the fly..but i'm sure that could be optimized to be just as quick.
Think of any pixel in the scene, what is the one
that each pixel has in common with a light? Vector.
360x360x360 that defines any light/pixel combination.
A lot, over 16Million...but do we really need such accuracy?
Why not compress space...
Reduce it all to the aspect of say... 32x32x32
Now the obvious next step is to determine this at each lumel position..but when you think about it, each unique angle can only cast a shadow or not..there cannot be two shadow casters along the same vector...so, instead..we keep local to the light..
now wiht a simple 32x32x32 array, we can very very quickly determine if any lumel is shadowed, even if it's from a single pixel within the same model or differant.
As in that 32x32x32 little array, we encode the distance from light to lumel..now as the look up is a vector, the distance in effect becomes the z value.
Some come runtime, all we have to do to determine if a lumel is shadowed is,
Entity_PointAt LumelPivot,LightX,LightY,LightZ ;Point towards the light.
Pitch=Entity_Pitch LumelPivot
Yaw=Entity_Yaw LumelPivot
Roll=Entity_Yaw lumelPivot,
The vector is made up from the angles got from pointing the lumel at the light. a quick easy way that doesn't degrade over distances.
Now compress to within 32x32x32 (Or higher for a higher res shadow detail.)
we do this by doing this,
CompressedPitch = 32*(Pitch/360.)
CompressedYaw== 32*(Yaw/360)
CompressedRoll 32*(Roll/360)
In our light, create a fake multi-dimension array in objects,
Pdist=Light\Lut[ CompressedRoll]\Lut[CompressedPitch]\Lut[CompressedYaw]
get the current set shade distance.
if Entity_Distance( lightPiv,Lumel) < pDist ;This is a closer lumel, so is the one that casts the shadow along this vector.
now run time, to determine if anything being rendered is in a shadow, we just quickly get the vector in the same manner, and check if the distance is greater than the encoded one in the light..if so, it has to be shadowed.
The downside is moving lights...they'ed need to be recalced on the fly..but i'm sure that could be optimized to be just as quick.