Quoting PHeMoX.
Quote:

Do you happen to have a project in which the code is running and working successfully?



That question is asked of which party?
current stance: In some contexts, I prefer to try and avoid terms such as 'working successfully'.
The code sample three posts back should be a copy of the entire shadowMapAmbient.wdl file from an archive here.

/*
?additional specs?
?
*compiles / runs: yes 6.40.5
*terrain (hmp) not mdl
*terrain has black n white checker test texture
*linked with old template6 (Loopix goal related)
--function ScanFloor() was inserted at end of BipedPhy01_Move_Ground
*player ent moves with input (template6) across terrain
--ambiance seems to change accordingly
?
*/

particle functions:
*Sample implementation is not tied to particle functions.
*As is, the sample implementation is probably not particle function friendly.

?manual ref: Particle functions should be fast.?

"return(ScanDist)" is not mandatory