Light decals...need help... +Halo's explanation

Blitz3D Forums/Blitz3D Programming/Light decals...need help... +Halo's explanation

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok.... I still don't 100% understand light decals...
I still can't get them working... or subtract from
the shadows... I Emailed Halo...
This is the advice he gave:
;-----------------------------------------------------------
-First, you need to store a list of flat faces in the map. This will only work on BSP-type Geometry, so maplet should be fine, as lone as each face is stored as a separate object. I store one merged copy of the map for rendering, and separate faces which I hide and use for collision. You need to calculate a plane equation for each face and store that, too.

-Second, you take your 3D light position and check the distance between that and each face/plane using the point-plane distance equation. If the distance is negative, the point is behind the face, so it won't be lit. If the distance is greater than the light range, the face won't be lit. If the distance is positive, but less than the light range, the face will be lit.

-Align a pivot to the plane equation using AlignToVector(nx#,ny#,nz#,3) and then MoveEntity 0,0,d#. Transform the light position to the pivot space and UV map the plane vertices according to this position.

-To avoid z-fighting, change the Blitz surface surfacedata pointer to a temporary bank. Add the above face surface to the internal Blitz surface list, and render. Then restore the original surface list.

Post this reply on the forums and ask for help. The last step especially is highly advanced, but this is all I will explain.

-Josh
;---------------------------------------------------------

I sorta understand... but not 100%... infact I'm a bit
confused... (+ I have to catch up on some home work... so it's hard to figure out lighting code and then debug it... then rewrite... ect... ect)
So if NEone could figure it out and post a little demo
or something... U'd be being very very helpful ;)