b3d not loading

BlitzMax Forums/MiniB3D Module/b3d not loading

ziggy(Posted 2007) [#1]
I have a b3d file taht loads and shows fine on blitz3D but doesn't shows on miniB3d (I get only a black screen).

Can anybody test this file?

download it here:
http://www.blide.org/castle2.zip


simonh(Posted 2007) [#2]
It loads OK here. You're not scaling it are you? It's already big to begin with, so any scaling would probably take it beyond the camera range.


ziggy(Posted 2007) [#3]
I'm using this code, any idea?
SuperStrict
Import "..\minib3d.bmx"
Graphics3D(800,600)
Local Fondo:TMesh = LoadMesh ("data\castle2.b3d")
If  fondo = Null Then 
	Notify("Unable to load")
	End
EndIf
Local cam:TCamera = CreateCamera()
cam.CameraRange(0.001,10000)
EntityType(cam,1)
EntityRadius(cam,1)
EntityType(fondo,2)
Collisions(1,2,4,2)

While Not KeyHit(key_escape)
	UpdateWorld()
	RenderWorld()
	If KeyDown(key_up) Then cam.TurnEntity(2,0,0)
	If KeyDown(key_down) Then cam.TurnEntity(-2,0,0)
	If KeyDown(key_left) Then cam.TurnEntity(0,2,0)
	If KeyDown(key_right) Then cam.TurnEntity(0,-2,0)
	If KeyDown(key_a) Then cam.MoveEntity(0,0,.1)
	If KeyDown(key_z) Then cam.MoveEntity(0,0,-.1)
	Text 0,0,cam.EntityX() + ", " + cam.EntityY() + ", " + cam.EntityZ()
	If KeyDown(key_SPACE) Then
		cam.PointEntity(fondo)
	End If
	Flip()
Wend



simonh(Posted 2007) [#4]
Ah, yes, with LoadAnimMesh it works, with LoadMesh it doesn't. Must be a problem with collapsing the anim mesh, I'll take a look.


ziggy(Posted 2007) [#5]
I'm also not able to detect collisions, even when loading the b3d using loadanimmesh. Any idea?


simonh(Posted 2007) [#6]
Well that's certainly an interesting test mesh you've created! What program did you export it from?

If I load it into Unwrap3D and export it again, everything is fine.


klepto2(Posted 2007) [#7]
*forget it* ups


ziggy(Posted 2007) [#8]
Is unwrap3D a free program?


bradford6(Posted 2007) [#9]
unwrap3d is very low price but for creating simple levels try maplet by our very own Mark sibly (get from the blitz product page)

it will export a textured level with a lightmap.


ziggy(Posted 2007) [#10]
I have another b3d file that loads ok with Blitz3D and crashes application on miniB3D.
Get it here for debuging: http://www.blide.org/castle3.zip


Mikele(Posted 2007) [#11]
Strange.In your models every mesh node have "classname=brush" name.
Is it exported from 3dmax?


ziggy(Posted 2007) [#12]
No, they have been exported from 3D world studio from Leadwerks (great program, by the way)


bradford6(Posted 2007) [#13]
if you load it up in Unwrap3d and export it (with multiple meshes checked) it will load and collisions will work.

the 3d world studio? exporter seems to be creating an animated mesh. (maybe for doors in the level or something?) sphere to poly collisions don't work with animated meshes.

here is a code snippet:




ziggy(Posted 2007) [#14]
Yes, but using unwrap3D erases one layer of lighting, some object become full bright (or something like that). I think the best solution is to make what you say and make the lighting with another app, I've heard the gile[s] is a good one, but I don't know if it can load and save b3d files, can you lend a hand?

The strange thing is that it is not an animated mesh and loads ok on Blitz3D... I'm not sure if it is really a animated mesh or a b3d loading bug. And the other b3d model that just 'crashes' any miniB3D attempt to display it. It's strange...


bradford6(Posted 2007) [#15]
from what it sounds like there certainly must be a difference in the loading or display schemes between miniB3D and Blitz3D.

finding an art path that you are comfortable with takes some time. I have heard excellent things about gile[s] as well.


Mikele(Posted 2007) [#16]
All materials (brushes) in your b3ds have 2 texture layers but main texture in all meshes use second layer - first is empty (and a few of they have lightmap texture on first layer). I don't know but maybe this generate a problem for minib3d's loader/parser or renderer.

[EDIT] if you add
CameraClsColor cam, 255,0,0
Wireframe True
then you can see that you are inside your level but all materials are black.

[EDIT2]
After a few tests it looks like problems with blendings. Materials are black when texture in diffuse (color) layer have a multiply (or multiply x2) blending flag.


Barbapapa(Posted 2007) [#17]
Just to let you know, brad the developer of Unwrap3D has a new b3d export plugin on his way. I tested it with some different multi hierarchy models with complex joints and they all work great now.

But to your problem, it works perfectly for me, I changed some lines and did a simple import/export in Unwrap3D. I did a weld model and that changed the number of 6014 to 2040!
I didn't change anything when exporting (textures and so on, all default)

Here is the code:

ps: i have all data in one directory for testing, the filename changed.
I added an octree line for the collisions
I changed the camera range, so that I am able to see the stuff inside the room. (You have a BIG room ;) )

castle2a.b3d

SuperStrict
Import "../../MiniB3D.bmx"
Graphics3D(800,600)
Local Fondo:TMesh = LoadMesh ("castle2a.b3d")
If  fondo = Null Then 
	Notify("Unable to load")
	End
EndIf
' create mesh octree - makes collision detection faster (MiniB3D only)
CreateOctree(fondo,512,0)
Local cam:TCamera = CreateCamera()
cam.CameraRange(1,100000)
EntityType(cam,1)
EntityRadius(cam,1)
EntityType(fondo,2)
Collisions(1,2,4,2)

While Not KeyHit(key_escape)
	UpdateWorld()
	RenderWorld()
	If KeyDown(key_up) Then cam.TurnEntity(2,0,0)
	If KeyDown(key_down) Then cam.TurnEntity(-2,0,0)
	If KeyDown(key_left) Then cam.TurnEntity(0,2,0)
	If KeyDown(key_right) Then cam.TurnEntity(0,-2,0)
	If KeyDown(key_w) Then cam.MoveEntity(0,0,1)
	If KeyDown(key_s) Then cam.MoveEntity(0,0,-1)
	Text 0,0,cam.EntityX() + ", " + cam.EntityY() + ", " + cam.EntityZ()
	If KeyDown(key_SPACE) Then
		cam.PointEntity(fondo)
	End If
	Flip()
Wend


Edit: Thanks Mik


Mikele(Posted 2007) [#18]
Unwrap3d is the option but you can see still this error in Minib3d.

>BTW any one knows the code for links? tried url, http, link, all nada, what is the correct syntax for linking files???

FAQ


simonh(Posted 2007) [#19]
ziggy - what line causes the crash? It doesn't crash here, weirdly.

Regarding the black mesh - as Mikele said, this is a blending issue.

As for the collision issue, if you use LoadAnimMesh, you need to set the EntityType for all child meshes. In Blitz3D you can do this easily by using the EntityType recursive flag, but this hasn't been added to MiniB3D yet.


Barbapapa(Posted 2007) [#20]
I tried ziggy's original example and that gave me an error, so the model itself seems to be quirked. Converted with U3D I cannot see any problems.

@Mikele: What problem are you talking about?? I can't see anything because I only have the comparison between my MiniB3D and the Unwrap3D version.

Could someone post a Blitz 3D screenshot of the problematic object(s)?

Edit: forget it, only nonsense ;) Doesn't matter on what uv set the lightmap is...


ziggy(Posted 2007) [#21]
I've seen the crash happens when there's a referenced texturein the b3d file, and the texture file is missing. On Blitz3D, the texture is just not applied, in miniB3D it crashes the app.


simonh(Posted 2007) [#22]
No, missing texture files should not cause a crash. Are you sure that's what the problem is?

I tried ziggy's original example and that gave me an error

What error? ziggy's models are loading without crashes for me, there must be something which is affecting only certain computers.


Barbapapa(Posted 2007) [#23]

Building castle_ziggy
Compiling:MiniB3D.bmx
flat assembler version 1.66
4 passes, 0.5 seconds, 269468 bytes.
Compiling:castle_ziggy.bmx
flat assembler version 1.66
3 passes, 2140 bytes.
Linking:castle_ziggy.exe
Executing:castle_ziggy.exe
Unhandled Memory Exception Error
Process complete



The window is opened black and then closes with above error.

I'm sure it's his b3d file. Once converted in U3D it all works.

I did a quick test, I opened his b3d into U3D and DIRECTLY resaved it as b3d, without any optimizing, and it all works perfectly.


simonh(Posted 2007) [#24]
Are you using klepto's mod? If you use the original version of MiniB3D it should highlight the line with the error.


Barbapapa(Posted 2007) [#25]
No, I'm using your 0.40. I'm running it from the MaxIDE.
Mom please...ok, test in Blide... it gives me more help.


line 4589:
glDrawElements(GL_TRIANGLES,surf.no_tris*3,GL_UNSIGNED_SHORT,surf.tris)




DebugLog:TEXS
──►BlitzMax Debug Report:
Unhandled Exception:Unhandled Memory Exception Error

◄── End of Debug Report.
DebugLog:BRUS
DebugLog:NODE
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-MESH
DebugLog:-VRTS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-TRIS
DebugLog:-NODE (parent= Root)
DebugLog:-NODE (parent= Root)




siread(Posted 2007) [#26]
When I load my 3D World Studio objects (after import/export in Unwrap3D) the lighting has gone and they are extremely dark. Can someone tell me what I'm doing wrong?


ziggy(Posted 2007) [#27]
I would like to know this too. Some meshes are also 'missing' or moved. I think there are several problems with the 3D World Studio exporter. Exporting to X file, and loading the file on Gile[s], then saving as B3D seems to work, as long as you make all the lighting on Gile[s].


Barbapapa(Posted 2007) [#28]
Could you please provide a simple object, a cube or even only a plane created with 3D World Studio and lightmaps and post the files and a screenshot.


Barbapapa(Posted 2007) [#29]
I had deleted this one in my message above, because it worked within U3D, didn't check in b3d though, so....


2. In Unwrap3D, a composite texture must be used, and your lightmap texture
must be loaded in the 2nd slot (Light/Detail). 'UVset 2' must be selected.




ziggy(Posted 2007) [#30]
Is there any easy way to conver a multiple mesh b3d file to a single mesh one? Dong so, meshes load ok, and hilites ok on gile[s]. I haven't inspected the X file format or the b3d file format, just wondering if there is any easy way to do it. (parsing the file or something)


simonh(Posted 2007) [#31]
Fixed in 0.42