Run this code:
The cube represents the light. Isn't it strange, that the sphere is lighted from the other side?
If you use CreateLight(2) that works. But, if you scale the sphere to 40,40,40 and flip it and use now the CreateLight(2) inside the Sphere, you won't see anything. Why?!
In Blitz3D that works fine:
Please help!
SuperStrict Import klepto.minib3d Graphics3D 800,600,32,2 Local lCam:TEntity = CreateCamera() Local lSky:TMesh = CreateSphere(70) EntityColor lsky,9,175,255 'ScaleEntity lSky,40,40,40 ScaleEntity lSky,10,10,10 'FlipMesh lSky Local lSunPivot:TEntity = CreatePivot() Local lSunLight:TLight = CreateLight(1,lSunPivot) CreateCube(lsunlight) 'LightRange(lSunLight,50) 'LightColor(lSunLight,255,255,255) Local lSun:TEntity = CreateSphere(10,lSunPivot) MoveEntity lSunLight,0,0,38 MoveEntity lSun,0,0,50 'MoveEntity lSunLight,0,0,-50 'This works...but why?! MoveEntity lCam,0,0,-80 Local wf:Byte Repeat If KeyHit(KEY_W) Then wf = not wf Wireframe wf EndIf TurnEntity lSunPivot,1,0,0 'PositionEntity lSunLight,EntityX(lSun,1),EntityY(lSun,1),EntityZ(lSun,1),1 'PointEntity lSunLight,lSunPivot 'TurnEntity lSunLight,0,-180,0 'PointEntity lSunLight,lSun UpdateWorld RenderWorld Flip Until KeyDown(KEY_ESCAPE)
The cube represents the light. Isn't it strange, that the sphere is lighted from the other side?
If you use CreateLight(2) that works. But, if you scale the sphere to 40,40,40 and flip it and use now the CreateLight(2) inside the Sphere, you won't see anything. Why?!
SuperStrict Import klepto.minib3d Graphics3D 800,600,32,2 Local lCam:TEntity = CreateCamera() Local lSky:TMesh = CreateSphere(70) EntityColor lsky,9,175,255 ScaleEntity lSky,40,40,40 'ScaleEntity lSky,10,10,10 FlipMesh lSky Local lSunPivot:TEntity = CreatePivot() Local lSunLight:TLight = CreateLight(2,lSunPivot) CreateCube(lsunlight) 'LightRange(lSunLight,50) 'LightColor(lSunLight,255,255,255) Local lSun:TEntity = CreateSphere(10,lSunPivot) MoveEntity lSunLight,0,0,38 MoveEntity lSun,0,0,38 'MoveEntity lSunLight,0,0,-50 'This works...but why?! MoveEntity lCam,0,0,-80 Local wf:Byte Repeat If KeyHit(KEY_W) Then wf = not wf Wireframe wf EndIf TurnEntity lSunPivot,1,0,0 'PositionEntity lSunLight,EntityX(lSun,1),EntityY(lSun,1),EntityZ(lSun,1),1 'PointEntity lSunLight,lSunPivot 'TurnEntity lSunLight,0,-180,0 'PointEntity lSunLight,lSun UpdateWorld RenderWorld Flip Until KeyDown(KEY_ESCAPE)
In Blitz3D that works fine:
Graphics3D 800,600,32,2 SetBuffer(BackBuffer()) cam = CreateCamera() sky = CreateSphere(60) ScaleEntity sky,40,40,40 FlipMesh sky EntityColor sky,9,175,255 MoveEntity cam,0,0,-60 sunpiv=createpivot() sun=createlight(2,sunpiv) MoveEntity sun,0,0,38 CreateCube(sun) Repeat TurnEntity sunpiv,1,0,0 UpdateWorld RenderWorld Flip Until KeyDown(1)
Please help!