3D object loads as white cube
Blitz3D Forums/Blitz3D Beginners Area/3D object loads as white cube
| ||
In Blitz3d I have tried to import a 3d model of a head and texture it, but when i run the program it loads as a white cube. Here is the coding: head = LoadMesh("Jacob.3ds") PositionEntity head,0,0,5 texture = LoadTexture("Jacob.jpg") EntityTexture head,texture It would be great if anyone could help. |
| ||
You should post the whole code. Unless that IS the whole code, then there are a bazillion reasons why it probably isn't working. |
| ||
From what i see here, it could be that you have exported the wrong mesh, or that the exporter of your modeling software does not work properly, or that somewhere in the code you reuse the variable "head" to store the reference of a white cube... |
| ||
You can only also post the 3d model you are testing out. |
| ||
So here is the whole code: Graphics3D 1024,768,32,2 SetBuffer BackBuffer() type_bottle = 1 type_cube = 2 camera = CreateCamera() PositionEntity camera,0,0,0 light = CreateLight() head = LoadMesh("Jacob.3ds") PositionEntity head,0,0,5 tex = LoadTexture("Jacob.jpg") EntityTexture head,tex While Not KeyDown(1) If KeyDown(203) Then TranslateEntity camera,0,0,-0.1 If KeyDown(205) Then TranslateEntity camera,0,0,0.1 If KeyDown(200) Then TranslateEntity camera,0,0.1,0 If KeyDown(208) Then TranslateEntity camera,0,-0.1,0 RenderWorld UpdateWorld Flip Wend End |
| ||
Also, here's a link to download the 3d model and texture http://www.mediafire.com/download/xr6fev9wn6kq4t6/Head.rar |
| ||
Hey Trigger1000, Your model/texture looks good. But try this code.. Graphics3D 1024,768,32,2 SetBuffer BackBuffer() mesh=LoadMesh( "jacob.3ds" ) PositionEntity mesh,0,-25,-30 pivot=CreatePivot() cam=CreateCamera( pivot ) PositionEntity cam,0,0,-300 RotateEntity mesh,0,180,0 lit=CreateLight() RotateEntity lit,45,45,0 While Not KeyHit(1) If KeyDown(30) MoveEntity cam,0,0,1 If KeyDown(44) MoveEntity cam,0,0,-1 If KeyDown(203) TurnEntity pivot,0,3,0 If KeyDown(205) TurnEntity pivot,0,-3,0 UpdateWorld RenderWorld Flip Wend End Hope that helps :-) |
| ||
Thanks! It did. |
| ||
@Trigger1000 ... Actually your code was ok, too You just had to press the left cursor a bit longer to see the full model .3ds Models are often displayed very big in Blitz3D (in case you work in units like meter) ... scale them down to fit them to the measurements of your world. |
| ||
scale them down to fit them to the measurements of your world To do that you can either use a 1x1x1 units cube to have an idea of how big your original mesh is and how much you need to scale it up or down Cube1x1x1 = createcube() scalemesh(Cube1x1x1,1.0/2,1.0/2,1.0/2) or you can use FitMesh() http://www.blitzbasic.com/b3ddocs/command.php?name=FitMesh |