light up my mesh

Blitz3D Forums/Blitz3D Programming/light up my mesh

Abomination(Posted 2004) [#1]
I have a mesh, parented to a pivot, parented to another pivot, parented to the camera.
More or less like this:
----------------------------------------
Graphics3D DWidth,DHeight,DDepth
ScapeCam=CreateCamera()
AmbientLight 0,0,0
CameraRange scapecam,1,1000
CameraProjMode ScapeCam,1
ScapePivot=CreatePivot(ScapeCam)
aspect#=Float(viewheight)/viewwidth
PositionEntity ScapePivot,-1,aspect,1
scale#=2.0/scapeviewwidth
ScaleEntity ScapePivot,scale,-scale,-scale
ScapePivot=CreatePivot(ScapePivot)
PositionEntity ScapePivot,-.5,-.5,0
Scapelight=CreateLight(1,scapepivot)
PositionEntity scapelight,0,0,0 ??????(other values have no effect?)

(I create a mesh named QMesh representing a landscape here...)


EntityParent Qmesh,ScapePivot
---------------------------------------------
Now the lighting comes from the direction of the camera and I want it to come from the left, but I can't get it to work.
Anybody any ideas?
Much appreciated!


big10p(Posted 2004) [#2]
Directional lights - as the name suggests - just shine in the direction they're facing. Therefore, positioning them in the world has no effect - because they'll still be shining in the same direction - so is meaningless. Instead, rotate the light to point in the direction you want. e.g. RotateEntity scapelight,0,45,0.


Abomination(Posted 2004) [#3]
Thanks... This did the trick.
I should have known this...But I didn't...Or did I?
This 3D-stuff still has me thinking around corners sometimes. ;)


Bremer(Posted 2004) [#4]
You can also use PointEntity to have one entity point at another if you don't know the angle.