I've created a bottomless box with vertices, but it doesn't receive vertex lighting. The following is an example with 2 lights, my vertex box, and a Blitz cube. I want the box to be shaded like the cube. Using UpdateNormals() creates...splodgy shading.
Graphics3D 1024,768,32,0
pivot=CreatePivot()
camera=CreateCamera(pivot)
PositionEntity camera,0,5,-10
PointEntity camera,pivot
AmbientLight 120,120,120
light1=CreateLight()
LightColor light1,40,100,255
TurnEntity light1,45,-205,0
light2=CreateLight()
LightColor light2,255,230,180
TurnEntity light2,45,35,0
mdl_block=CreateMesh()
block_surface=CreateSurface(mdl_block)
vA=AddVertex(block_surface,-1,-1,-1)
vB=AddVertex(block_surface,-1,-1,1)
vC=AddVertex(block_surface,-1,1,-1)
vD=AddVertex(block_surface,-1,1,1)
vE=AddVertex(block_surface,1,-1,-1)
vF=AddVertex(block_surface,1,-1,1)
vG=AddVertex(block_surface,1,1,-1)
vH=AddVertex(block_surface,1,1,1)
AddTriangle (block_surface,vA, vC, vD)
AddTriangle (block_surface,vA, vD, vB)
AddTriangle (block_surface,vB, vD, vH)
AddTriangle (block_surface,vB, vH, vF)
AddTriangle (block_surface,vF, vH, vG)
AddTriangle (block_surface,vF, vG, vE)
AddTriangle (block_surface,vE, vG, vC)
AddTriangle (block_surface,vE, vC, vA)
AddTriangle (block_surface,vC, vG, vH)
AddTriangle (block_surface,vC, vH, vD)
brush=CreateBrush()
BrushColor brush,255,255,255
BrushFX brush,0
PaintEntity mdl_block,brush
FlipMesh mdl_block
PositionEntity mdl_block,-2,0,0
cube=CreateCube()
PositionEntity cube,2,0,0
While Not KeyHit(1)
If KeyDown(205)
TurnEntity pivot,0,1.0,0
ElseIf KeyDown(203)
TurnEntity pivot,0,-1.0,0
EndIf
If KeyDown(200)
TurnEntity pivot,1.0,0,0
ElseIf KeyDown(208)
TurnEntity pivot,-1.0,0,0
EndIf
RenderWorld
Flip
Wend Use cursor keys to pan around.
|