PickedNX question

Blitz3D Forums/Blitz3D Programming/PickedNX question

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.

If I have a shaded terrain with shady areas and bright areas, I wanted to use EntityColor to darken the grass quads on the shady places. I was using PickedNX etc. to determine if a grass quad should be shaded. I suspect I'm doing something wrong here, maybe somebody can help me? What I do right now is:

pnx#=pickednx()
pnz#=pickednz()

pn_shade#=(pnx-pnz)-.2

if pn_shade<0 then
 shade=255.0-(pn_shade*128.0)
 limit shade to 0 to 255
 use shade for rgb of entitycolor
else
 shade=255
endif


I have that vague guess I rather should use Atan2 with pnx and pnz or so, then add the light yaw as an offset and see if the angle is within a certain range, any ideas?