Lighting double sided surface

Blitz3D Forums/Blitz3D Beginners Area/Lighting double sided surface

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.

Hi Puki, Just made a slight update to the code which seems to work fine, here it is:

Graphics3D 640,480,16,2
SetBuffer BackBuffer()

cam = CreateCamera()
MoveEntity cam, 0,0,-12

light=CreateLight(2)
LightColor light,0,0,255
MoveEntity light,1000,1000,-1000

light2=CreateLight(2)
LightColor light2,255,0,0
MoveEntity light2,-1000,1000,-1000

mesh = CreateMesh()

surface=CreateSurface(mesh)

triangle1 = CreateSurface(mesh)
sv1 = AddVertex (surface,-2,-2,-2)
sv2 = AddVertex (surface, 0, 2, -2)
sv3 = AddVertex (surface, 2,-2,-2)
tv1 = AddVertex (triangle1,-2,-2,-2)
tv2 = AddVertex (triangle1, 0, 2, -2)
tv3 = AddVertex (triangle1, 2,-2,-2)
tri = AddTriangle (triangle1,tv1,tv2,tv3)
tri = AddTriangle (surface,sv3,sv2,sv1)

UpdateNormals mesh

While Not KeyHit(1)
TurnEntity mesh,0,1,0
RenderWorld
Flip
Wend
End

Has abit more coding but the results come out to be better.