Directional light not affecting a CreateMesh mesh

Blitz3D Forums/Blitz3D Beginners Area/Directional light not affecting a CreateMesh mesh

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.

Hmm... well it's different, but not quite what I meant. It should be just like the one on the left:

Graphics3D 640,480,32,1
SetBuffer BackBuffer()
ArialBold=LoadFont("arial",14,1,0,0)
SetFont ArialBold
Color 127,127,127

camera=CreateCamera()
MoveEntity camera,0,5,-10
RotateEntity camera,25,0,0

light=CreateLight()
lightposition%=0
brightness%=127

ground=CreateSphere()
ScaleMesh ground,100,100,100
PositionMesh ground,0,-100,0
EntityColor ground,35,75,0

;prefab cube
cube=CreateCube()
PositionMesh cube,-3,-.5,-2
EntityColor cube,64,64,64

;custom cube
mesh=CreateMesh()
EntityColor mesh,64,64,64
surface=CreateSurface(mesh)
vertex1=AddVertex(surface,-1, 1,-1, 0,0)
vertex2=AddVertex(surface,-1, 1, 1, 0,1)
vertex3=AddVertex(surface, 1, 1, 1, 1,1)
vertex4=AddVertex(surface, 1, 1,-1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
vertex1=AddVertex(surface,-1,-1,-1, 0,0)
vertex2=AddVertex(surface,-1, 1,-1, 0,1)
vertex3=AddVertex(surface, 1, 1,-1, 1,1)
vertex4=AddVertex(surface, 1,-1,-1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
vertex1=AddVertex(surface,-1,-1, 1, 0,0)
vertex2=AddVertex(surface,-1, 1, 1, 0,1)
vertex3=AddVertex(surface, 1, 1, 1, 1,1)
vertex4=AddVertex(surface, 1,-1, 1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
vertex1=AddVertex(surface,-1,-1,-1, 0,0)
vertex2=AddVertex(surface,-1,-1, 1, 0,1)
vertex3=AddVertex(surface,-1, 1, 1, 1,1)
vertex4=AddVertex(surface,-1, 1,-1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
vertex1=AddVertex(surface, 1,-1,-1, 0,0)
vertex2=AddVertex(surface, 1,-1, 1, 0,1)
vertex3=AddVertex(surface, 1, 1, 1, 1,1)
vertex4=AddVertex(surface, 1, 1,-1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
vertex1=AddVertex(surface,-1,-1,-1, 0,0)
vertex2=AddVertex(surface,-1,-1, 1, 0,1)
vertex3=AddVertex(surface, 1,-1, 1, 1,1)
vertex4=AddVertex(surface, 1,-1,-1, 1,0)
AddTriangle surface,vertex1,vertex2,vertex3
AddTriangle surface,vertex3,vertex4,vertex1
PositionMesh mesh,3,-.5,-2

UpdateNormals mesh

While Not KeyHit(1)

If KeyDown(44) lightposition=lightposition-1
If KeyDown(45) lightposition=lightposition+1
RotateEntity light,lightposition,lightposition,0
If KeyDown(52) brightness=brightness-5
If KeyDown(53) brightness=brightness+5
If brightness<0 brightness=0
If brightness>255 brightness=255
AmbientLight brightness,brightness,brightness

UpdateWorld
RenderWorld

Text 0,0,"Controls: hold z or x for the directional light, . or / for ambient."

Flip
Wend
End


Kind of reminds me of me trying to fit in! :D Or those impersonators on the elevator near the end of Chrono Trigger. Not even close to convincing, but you can tell they're trying, and that's what...scares people. Okay, probably not a reference everyone knows about! But if you get the chance, I recommend playing it to find out. And don't just look it up on youtube, that ruins it.

Anyway, so it's not lit now, but it's...close? Semi close? Weirdly similar to close? ..."Almost but not quite entirely unlike tea?"

Hope someone can help again :)

Big, I just saw your suggestion today, so I'll try that tonight. Thanks.