Lighting a Mesh...

Blitz3D Forums/Blitz3D Programming/Lighting a Mesh...

Shambler(Posted 2003) [#1]
or more specifically, lighting a mesh Exported from Quill3D.

OK, I'm hitting a brick wall with this one >.<

I've exported a mesh as .b3d file from Quill3D into blitz but for the life of me I can't get it to react to

1) Hardware lights
2) fake LightMesh command lighting

I've loaded other meshes and they are getting lit by the 1 hardware light I have parented to the camera.

I load the Quill mesh with...

m.LevelMesh=New LevelMesh
m\mesh=LoadMesh("./Media/dungy.b3d")
UpdateNormals m\mesh
EntityFX m\mesh,2
LightMesh m\mesh,255,0,0,10000,0,10,0


The mesh has 2 texture stages which are a rock texture and a lightmap texture.

After having no joy with the hardware light I tried the LightMesh command and even that doesn't have any effect.

I've even tried loading the mesh and then using a CopyEntity or CopyMesh to see if it would make a difference but it doesn't.

Anyone with an idea of what's wrong?


Ross C(Posted 2003) [#2]
The entityfx 2 flag sets the entity to fullbright, meaning that it is NOT effected by lights :D


Shambler(Posted 2003) [#3]
I put the EntityFX in to see if LightMesh would have any effect -.-

Previous to that of course these commands were not in use since I want to hardware light the mesh.


Shambler(Posted 2003) [#4]
Exporting as an .x file from Quill, hardware lighting works..albeit the normals of some faces aren't correct.

Time to file another bug report -.-


Ross C(Posted 2003) [#5]
yeah, i posted a bug report over in the quill forums about the .x exporter. Haven't got anyback yet tho :)


Shambler(Posted 2003) [#6]
Quill forums have been very quiet for a while...has Birdie flown the nest? O.o

Can't understand why UpdateNormals doesn't work...this is really bugging me now -.-


Ross C(Posted 2003) [#7]
I think there is something more serious wrong then the normals facing th wrong way. There's been times where i've exported an object as an .x file and opened it and it didn't save anything. Just a blank file. I use .b3d now :D


Shambler(Posted 2003) [#8]
I worked out what it is.

The .b3d files Quill3D is saving create a brush with BrushFX 1, which means they are never going to react to hardware lighting.

I've started writing a converter and the meshes I have converted are now getting lit correctly. =)


Ross C(Posted 2003) [#9]
Cool, i never noticed that! So all .b3d files that are exported have the fullbright flag on them? seems odd. Have you upgraded quill3d since you bought it?


Shambler(Posted 2003) [#10]
That's basically the problem yes, its version 1.20 I'm using.

Need a lie down in a dark room after that -.-


Ross C(Posted 2003) [#11]
This convertor you coded, will it be freely available ^_^ ?


Shambler(Posted 2003) [#12]
If I ever bother to finish it =)

I think to get the effect Im after I either have to write a function/converter that increases the tesselation of a mesh so that vertex lighting looks ok, or use dynamic lightmapping.


Shambler(Posted 2003) [#13]
Here's a short but sweet way ( thanks to the rather timely BLitz3D update =) ) to remove the EntityFX 1

For s=1 To CountSurfaces(mymesh)
br=GetSurfaceBrush(GetSurface(mymesh,s))
BrushFX br,0
PaintSurface GetSurface(mymesh,s),br
FreeBrush br
Next



Ross C(Posted 2003) [#14]
Cool, thanks alot for that :D