3D object won't show on screen

Previous topic - Next topic

bjimenez

Hi,

I created my first 3d graphic. I followed the directions on texture size as best as I understood them. When I load the object it does not show on the screen. I'll post it here so that maybe someone can try it out and tell me what my issue is. I created this object using AC3D, then exporting to 3ds and converting to ddd. I have put the texture files into my media directory with the ddd file.

http://www.megaupload.com/?d=26UVN7SM

matchy

#1
Hi. How you are?

The zip file contains penny.ddd, front.png, back.png and side.png and, if it's not a test model, can be created with just code as a penny/coin is just a cylinder.
3D objects can only have one texture map assigned, such as a UV map. Besides the texture issue, I was not able to draw the penny.ddd object anyway even if I scale it. Post the 3ds file!



mentalthink

HI Bjimenez, the good it´s put your code, if you make well the export, you have to see the model, whit or whitout texture...

Be carefully, depend of the 3D units, you have to modify the FOV in the X_camera command in Glbasic, this it´s when you make
the command x_make 3D 1,1000,45... the 45, perhaps have to touch, and well the pos of the X_camera...

I sure don´t have too much problem, only can be a little problem whit this or perhaps, be sure the name and paths of the objects...

3D in Glbasic works, perfect!!!

bjimenez

Hi,

Ok thanks for replying. Here is the 3ds file I am using. I zipped it up with the graphics.

http://www.megaupload.com/?d=X11SWLDY

Maybe I'm not using the 3D tool in GLBASIC correctly?

I am using this example code from a GLBASIC sample to load my 3D penny.

Code (glbasic) Select
SETCURRENTDIR("Media") // go to media files

X_LOADOBJ "penny.ddd", 5

WHILE TRUE
MOUSESTATE mx, my, b1 ,b2
phi=mx*360 / 640
X_MAKE3D 1,1000,20 // Viewport 3D
X_CAMERA 0, 150, -300,      0 ,0 ,0
X_AMBIENT_LT 0, RGB(255,255,0)

X_MOVEMENT mx-230, 0, 0
X_SCALING 3, 3, 3
X_ROTATION phi*3, 0, 1, 0
X_DRAWOBJ 5, 0

SHOWSCREEN
WEND

bjimenez

I just watched the 3D tutorial and I did not create a UV map, and I did not turn my image to the correct direction. I'll try again.

Wild_Duck

I can make 3D objects show up on the computer screen but not on the Pandora or Android tablet, you just get the background text and sprites. The objects are in the appropriate .app folder.

Kitty Hello

Is it in the Media subdirectory? Only this is packed into the Apps.

bjimenez

Quote from: Kitty Hello on 2012-Jan-12
Is it in the Media subdirectory? Only this is packed into the Apps.

Yes, it is in the Media directory. I finally got it to load, but it is very very small, not sure how to increase it's size so I can see it as big as a silver dollar. My problem is that I need to learn to use the 3D graphic program correctly. I'll keep working on it until I get it right.

erico

if your camera is pointing to the object center(as I think it is), try approaching it.

X_CAMERA 0, 150, -300,      0 ,0 ,0

See if decreasing the -300 helps, something like -50? or less?.
the first 3 numbers (0, 150, -300) state your camera position X Y Z , the others are where it´s targeting.

You could also substitute it for a variable, and increase and decrease it with the keyboard or mouse too.

mentalthink

Hi bJimenez, I found the error, I can see the 3D object... but it´s very tedious goes to put the camera on the 3d object it´s placed...

I comment, becuase I found an error un your 3D mesh, well the trouble it this, if you make this you can´t have any trouble in any 3D suite...

Make this, in the 3D modeler, I think you use the recomended for Glbasic (sorry alwys forget his name), put always the objetc in the 3D world coordinates in 0,0,0, this it´s X=0.0 and so on...

Another very important point for this... the 3D objects, all you will make, have a pivot point, this it´s the point, when you move or rotate or scale, appears normally a 3 axis, for every direction in the 3D word... this it´s the real important!!!, you have to make something like this:

In your software I don´t know the procedure:
Select your mesh... and put into the pivot point...
Search some coomand or button, that place it the pivot point in the middle of the 3D mesh
Go out of the mode pivot point... and put the object in 0.0.0

Now export, and how I told you, ve carefully whit the units of your 3d suites...

Now in Glbasic make your code, like you show us...
but those 2 lines put this...

X_make3d 1,10000,45
X_Camera 0,0,-300,0,0,0

Whit this you always have centered the object in the 0,0,0 in the world of glbasic, and it´s very very easy found where is the mesh...

If you can see very little or perhaps too much bigger, you can modify the Z value of the camera (-300), of modifiy de FOV(Field of View 45 (this it´s the cone of the camera))...

A little trick, never uses a front clip <1 this it´s the first parameter of X_make3d, you can have very strange troubles, and the far Clip, the second value, try to use to adjust to your scene... to much bigger will draw more objects, and your game will runs more slowly...

In some cases, if you put
X_camera 0,600,0,0,0,0 , perhaps you don´t see nothing and all it´s ok, if you put this:
X_camera 0.01,600,0,0,0,0  you have got hte mesh drawing in the viewport... if you look this it´s when you put the camera in the Y axis... I don´t stay sure if in newer version this not occurs, but for me in 2 version past don´t works fine...

Well... how I told you, your code works, but have a little trouble the mesh... If you want Use a more "sofisticated" 3D soft, you can use 3d MAx, have a direct exporter to .ddd and you don´t have to use the Glbasic converter, it´s direct form 3D max to Glbasic, and works whit animated meshes, like humans and a lot of things , like particles and cloth...

PS: If you don´t understand somthing... I think for your 2on name perhaps speak spanish, please comment me, I will glad to help you...


bjimenez

Quote from: mentalthink on 2012-Jan-12
Hi bJimenez, I found the error, I can see the 3D object... but it´s very tedious goes to put the camera on the 3d object it´s placed...

I comment, becuase I found an error un your 3D mesh, well the trouble it this, if you make this you can´t have any trouble in any 3D suite...

Make this, in the 3D modeler, I think you use the recomended for Glbasic (sorry alwys forget his name), put always the objetc in the 3D world coordinates in 0,0,0, this it´s X=0.0 and so on...

Another very important point for this... the 3D objects, all you will make, have a pivot point, this it´s the point, when you move or rotate or scale, appears normally a 3 axis, for every direction in the 3D word... this it´s the real important!!!, you have to make something like this:

In your software I don´t know the procedure:
Select your mesh... and put into the pivot point...
Search some coomand or button, that place it the pivot point in the middle of the 3D mesh
Go out of the mode pivot point... and put the object in 0.0.0

Now export, and how I told you, ve carefully whit the units of your 3d suites...

Now in Glbasic make your code, like you show us...
but those 2 lines put this...

X_make3d 1,10000,45
X_Camera 0,0,-300,0,0,0

Whit this you always have centered the object in the 0,0,0 in the world of glbasic, and it´s very very easy found where is the mesh...

If you can see very little or perhaps too much bigger, you can modify the Z value of the camera (-300), of modifiy de FOV(Field of View 45 (this it´s the cone of the camera))...

A little trick, never uses a front clip <1 this it´s the first parameter of X_make3d, you can have very strange troubles, and the far Clip, the second value, try to use to adjust to your scene... to much bigger will draw more objects, and your game will runs more slowly...

In some cases, if you put
X_camera 0,600,0,0,0,0 , perhaps you don´t see nothing and all it´s ok, if you put this:
X_camera 0.01,600,0,0,0,0  you have got hte mesh drawing in the viewport... if you look this it´s when you put the camera in the Y axis... I don´t stay sure if in newer version this not occurs, but for me in 2 version past don´t works fine...

Well... how I told you, your code works, but have a little trouble the mesh... If you want Use a more "sofisticated" 3D soft, you can use 3d MAx, have a direct exporter to .ddd and you don´t have to use the Glbasic converter, it´s direct form 3D max to Glbasic, and works whit animated meshes, like humans and a lot of things , like particles and cloth...

PS: If you don´t understand somthing... I think for your 2on name perhaps speak spanish, please comment me, I will glad to help you...

Thank you for your thoughts,  I understand most of your words. I'm still new and must learn more on how to create 3D correctly for GLBASIC. I will see about getting 3D Max and making 3D objects. Thanks.

Ben

mentalthink

Don´t care Ben...

About 3D max, I think I put some time ago, a little tutorial for use 3ds max and Glbasic... in 3D sections...

kanonet

Quote from: mentalthink on 2012-Jan-12
A little trick, never uses a front clip <1 this it´s the first parameter of X_make3d, you can have very strange troubles, and the far Clip, the second value, try to use to adjust to your scene... to much bigger will draw more objects, and your game will runs more slowly...
As far as i know, its not recommended to use bigger values for the far clip, we should not use >1000. I always read, that its better to use values <1 for front clip, than using >1000 for far clip. I dont know which is true, can someone help?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

mentalthink

HI Kanonet, about to put more the 1000 in the far clip, I suppose it´s because you can show more of the 3D scene, and you have to render more objects in one time, about the near clip, I try values <1 and works, but 0.0 make very starnge things... I always put this values in 1 and far to 1000, except in some cases I need or I think, I don´t have to render more forwards...

Another trick, this it´s only advice I know all people knows the difference betwenn jpg and png.bmp, because before some version glbasic don´t accetp .jpg, use always when you can ... if the 3D have any part transparent ok use .png, but I think this it´s in an strange model...

And well if you have to use light, in mobiles devices more than 2 can slow a great amount... 1 for Ambient and other for spot or focus... but better it´s use  complete maps...