Fake Lighting Techniques For Blitz3d

Blitz3D Forums/Blitz3D Programming/Fake Lighting Techniques For Blitz3d

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.

3DS files cant support 2UV sets, so cant be lightmapped on the way like B3D file..but as I'm mention above, you can make them lightmapped on the way I mention early...you can apply lightmap on to 3DS file, or X file on this way..

Graphics3D 800,600,32,2



camera=CreateCamera()

Textured_Mesh=LoadAnimMesh("level.3ds")
litemap_mesh=LoadAnimMesh("lightmap.3ds")
t=LoadTexture("lightmap.bmp")

MapVertices(Textured_Mesh,litemap_mesh,t)
FreeEntity litemap_mesh
FreeTexture t

MoveEntity camera,0,200,-500
PointEntity camera,Textured_Mesh

While Not KeyHit(1)
TurnEntity Textured_Mesh,0,0.1,0
UpdateWorld
RenderWorld
Flip
Wend
End

;=====================
Function MapVertices(model,copy,texture)


For n=1 To CountSurfaces(model)
surf=GetSurface(model,n)

Next

For n=1 To CountSurfaces(model)

surf=GetSurface(model,n)
lsurf=GetSurface(copy,n)
For v=0 To CountVertices(surf)-1

tu#=VertexU#(lsurf,v)
tv#=VertexV#(lsurf,v)
tw#=VertexW#(lsurf,v)
VertexTexCoords surf,v,tu,tv,tw,1
Next
Next



TextureCoords texture,1
EntityTexture model,texture,0,1

For e=1 To CountChildren(Model)
limb=GetChild(model,e)
limb2=GetChild(copy,e)
MapVertices(limb,limb2,texture)
Next

End Function


where is Textured_Mesh your 3DS level textured with difuse textures on to it, LITEMAP_MESH is same mesh as Textured_Mesh, except lightmap texture is applied on to it without any other texture...and T is lightmap texture...what is important here is that lightmapped level (LITEMAP_MESH) MUST BE same geometry as Textured_Mesh...thats all..this things working properly if you exporet geometry on proper way..enjoy