3D with GLBasic - movie

Previous topic - Next topic

erico

#15
As for the general learning of 3d, and hope this helps many...

check image EDITS.jpg

1- a bunch of quad poligons, base object.
2- when I run subpatch(metaform) into it, it becomes a curved object. Curved objects are not tolerated inside games yet. So if you save and use this, you get the same object as in picture 1.
3- if you subdivide with metaform the object in picture 1, you get this object.
4- another subdivision
5- another subdivision

Picture 5 renders exactly the same as picture 2 inside a render program.
In my case, metaform subdivides by 3 all objects internally.

For GLBasic, you have to make sure the subdivision is applied to the object before saving.
Most 3d programs use different names for these process, I use lightwave, but I hear in MAYA the metaform is called smooth and so on...

6- this is the object from picture 3, I tripled the polygons because some programs won´t accept quad polygons.
I modeled the nose, eyes, mouth and buttons. All triple polygons too.
Then generated the UVmap as an ATLAS projection, you see the results on the left panel. Quite good to read, but could be a lot better.
I then exported this left panel UV as an image of 1024x1024 to work as a guide/layout to paint my texture.
On LAYOUT UV.jpg you have them both, the layout and the texture I painted to fill it.

I´m attaching the whole thing on this post so you and others interested on 3d inside GLBasic can have a go.
I took ages for me to figure out how to convert an object from lightwave to at least OBJ with working UVmaps... :(
There is some info here too:
http://www.glbasic.com/forum/index.php?topic=6861.msg56582#msg56582

inside the zip you see an object folder, it contains the lightwave one, OBJ +MTL and a collada one plus the texture to use on them.


[attachment deleted by admin]

Kitty Hello

If you want the subdivision in the .ddd model, just apply it to the model before exporting:
Menü: Object/Commit Subdivision

aroldo

erico,

Thank you for the detailed answer.
I am reviewing you answers and trying to understand how you did it?
I it not clear to me how to do the LAYOUT UV.jpg?

I also want to make sure that AC3D is the right tool for making the 3D models!

Can you generate the .ddd file and attahce to the post?
I will be using the code below so I can see the end result in GLBasic.

// --------------------------------- //
// Project: SnowMan3D
// Start: Tuesday, October 04, 2011
// IDE Version: 10.118


// SETCURRENTDIR("Media") // go to media files
   X_MIPMAPPING TRUE
   GLOBAL phi=0, mx, my, b1, b2
   LOADSPRITE "images/snowman256_90dpi.PNG", 0
   X_LOADOBJ "images/snowman.ddd", 0
   
   WHILE TRUE
      //INC phi, MOUSEAXIS (0)
      //INC pha, MOUSEAXIS (1)
      //MOUSESTATE mx, my, b1, b2
      INC phi, MOUSEAXIS (0)
      X_MAKE3D 1, 50, 45
      X_CAMERA 10,5,0, 0,0,0
      X_SETTEXTURE 0, -1
      
      X_ROTATION phi, 0,1,0
      X_DRAWOBJ 0,0
      SHOWSCREEN
   WEND


Code (glbasic) Select


Thank you, :nw:
Hi Aroldo,

1- textures inside mspaint? it is as good as any other package.
When you create the texture, make sure you create the image on your requires final resolution.
1024x1024 is what is standard today and should go on any mobile platform.
Be aware multiple objects with various textures each 1024x1024 com quickly overload your final machine target, and most of the time you don´t really need it this high.

2-Yep it´s UVmap.

3-Inkspace is a vector program, resolution independent if you use vectors only. So dpi won´t make a difference unless you are printing. Anyway vectors won´t become textures(bitmaps). You have to rasterize them, or export them on a raster format, PNG is good. Don´t bother dpi while exporting, see that the resolution 1024x1024 is there and everything would go fine.

4- don´t know much about the formats...

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

erico

#18
ops :S I forgot to mention I use lightwave 3d.

But in fact, almost any 3d modeler out there will do.
It´s important that your 3d program export/save to a format that can be converted to 3d GLBasic format(DDD).
I think GlBasic comes with a tool to convert .OBJ to .DDD object.
I see in one thread that someone did a MAX to DDD tool too.

AC3D seems to be the choice of most of the people around here, and it seems quite a competent tool.
I think what you were doing in the first place is correct, but you have to apply the subdivisions like KittlyHello said:

Quote from: Kitty Hello on 2011-Oct-06
If you want the subdivision in the .ddd model, just apply it to the model before exporting:
Menü: Object/Commit Subdivision

The LAYOUT UV.jpg was done like this (in lightwave):
-export eps of the UVmap window
-open in photoshop and rasterize it on your final size, in this case 1024x1024.
-create another layer to draw under the uvmap, that is going to be the final texture.

You save only the final texture, but for the layout there, I saved both together so it serves as an example.

About the .ddd, I will give a try later, but I think you have a convert tool there inside GLBasic to do it too.
It converts from OBJ, which is inside the folder.

mentalthink

Another 3D suite, very affordable and very good it´s Blender, Free and a lot fo info, and now whit the last version the IDE comes too much familiar to the common 3D suites, before, was a little confusing, too much different to the standard.

Blender have a plugin exportere especific for Glbasic. Make time I don´t use, the last time, make somthing wrong when you have a object whit sub-objects or when you scaling the 3d mesh, but export in the most cases very well, and wel  you have a "paint Editor", like a simple PS but panit over   the surface of 3D mesh, well for me it´s better BodyPaint.

>If you starting in 3D, blender and well almost  common software it´s very cool, lightwave it´s simply awesome, I like a lot of, but I dont´have time to learn it. It´s called the most faster modeller in the 3D world.

erico

#20
Yep, blender is great, if I was to learn 3d from zero today, I would go for blender for sure.
AC3D seems to me a lot easier though...blender is as hard as any pro 3d package around.

It all ends up on how much time can you afford to acquire this knowledge.

There is a CONVERT3D.exe on the glbasic tools folder.

Strangely, I could not make it work(ie display the object in 3d inside glbasic).
Watching the video again, it is probably something related to the size of the object or something else.
Maybe someone can say what´s wrong with it?

I enjoy the part of the video when first compiling the test program..."there it iiiiiiis" hehe :P

PS: here goes the snowman in .DDD and in .blend use the texture.png from my last post.

[attachment deleted by admin]

aroldo

erico,

I loaded the .ddd file and texture file you gave me.
The snowman, did not load upside down, and for some reason the texture did not get loaded, not a problem
Here is the result of loading the .ddd, the same as AC3D, rough edges!

[attachment deleted by admin]
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

erico

Sorry I never really got myself into 3d production inside glbasic. I´m attempting to help on an area I known only half of it and am also trying to learn the other half.

Load upside down? It seems every 3d conversion has a lot of changes as each package outputs differently.
My object came from Lightwave 3d v10, exported as .OBJ into Blender and there I had to fix the UVmap image, then save as .OBJ again and also .blend. The collada file came from lightwave too.

I reloaded it inside lightwave , texture has a missing path. Reloading the texture gets it ok, so I know, at least, that the uvmap thing is working now.

As for your results, would you mind pasting the code? I tried yours and them kitty´s video one but only got black screen :(.

It is great to see that the object worked ok for you, now it would be nice to see if it preserved the UVmap thing.
About the rough edges, sorry, I forgot that was your first concern...

As you see on your results, it has the same number of polygons you see on the layout uv file I sent before, so the result you get is expected.

I guess the best course is to do as kitty said,
get your object from the first post inside AC3d and choose your subdivision level (3).
then:
Menü: Object/Commit Subdivision

give a go.
it should go fine.

I get a little carried away when 3d comes up as a subject... (that´s the only subject I can try and help :()
It´s important to have only the amount of polygons on an object that fits your final project, so that also concerns resolution and final platform.

I guess I see you only want to give the video´s code a try and expect to have smooth edges (is it?)
Again, commit your desired subdivisions on your AC3D model like kitty said and post results


mentalthink

 Hi Erico, you are Italian?¿, if not sorry, but in your lneguaje you have this youtube channel, in italian... it´s very complete training of Blender, and the guy explains very well, of course I don´t have too much idea of Italian bit it´s very easy undertanding.

About 3D in blender, the trouble because you can´t look your object, I supposse it´s for the position and far clip of the camera, when I try blender and 3d Max, I always put this values in the camera, differs a lot of A3CD

X_Make3d 1,1000,45
x_Camera 0,-500 or more,0 , 0,0,0

And always have in mind to make the 3d mesh in the 0,0,0 world coordinates.

About the exporter in blender, I rebember some little bugs, in example if you take more than an object, don´t runs well, and if you scale the object goes bad too.

You tube channel (Blender, I think for english speakers can be more complex than spaninsh.)

http://www.youtube.com/user/redbaron85ct

Kinds regards,
Iván J.

erico

#24
Hi mental, I´m not italian hehe, brazilian or terrestrian is more like it!
No, those tutorials are not mine.

Thanks for the helps.

I ended up making it work (there it iiiiiis :D), but only to arrise more questions...
here is the code I am using:
Code (glbasic) Select
GLOBAL dir$
GLOBAL phi
GLOBAL thi
GLOBAL x,y,z

LOADSPRITE "TEXTURE.png",0
X_LOADOBJ "SNOWMAN2.ddd",0

WHILE TRUE
INC phi, MOUSEAXIS(0)
INC thi, MOUSEAXIS(1)

IF KEY(203)=1 THEN x=x-1
IF KEY(205)=1 THEN x=x+1

IF KEY(200)=1 THEN y=y+1
IF KEY(208)=1 THEN y=y-1

IF KEY(44)=1 THEN z=z+1
IF KEY(30)=1 THEN z=z-1

PRINT x,0,0
PRINT y,0,10
PRINT z,0,20

X_MAKE3D 1,50,45
X_CAMERA 0,0,10, 0,2,0
X_SETTEXTURE 0,-1

X_SPOT_LT 0,RGB(255,255,255), x,y,z, 0,2,0,360

X_ROTATION phi,0,1,0
X_ROTATION thi,1,0,0

X_DRAWOBJ 0,0

SHOWSCREEN

WEND


So, rotate the object with the mouse, move the light with key arrows for the X and Y. Move light on the Z with keys A and Z.
Some doubts:

1- rotation is affecting the light source too, how can I separate them? It seems ok if I use the cartoon light though...
2- There seems to be an ambient light there, even if the light is not over the object, it renders gray instead of black.

Hey Aroldo, I ended up subdividing my first object twice, so now, there is no hard egdes.
I´m attaching it here too so anyone can givago!


[attachment deleted by admin]

mentalthink

Quote1- rotation is affecting the light source too, how can I separate them? It seems ok if I use the cartoon light though...
2- There seems to be an ambient light there, even if the light is not over the object, it renders gray instead of black.

HI Erico , about the rotation of the light I look your code, but I think the trouble not it´s the X_Rotate affect the light, it´s this part.

X_SPOT_LT 0,RGB(255,255,255), x,y,z, 0,2,0,360

When you move the ligth, whit x,y,z the fixed Point, it´s in 0,2,0, and always the ligth it´s lokking to this point. I think but I´m not sure the litgh can´t rotate, only 3d meshes

2_ About the light I always use whit 360 Degrees, in this mode I have a Spot light like a Sun.

Be carefull using light, they consume a lot of CPU processing, for me the better way it´s make a render texture in your preferred Soft, in this you apply the lighting how you want, and after in GlBasic, you have the model like in the 3D Suite.

In deviced mobiles the FPS go very down if you use more than 1 ligth, and I prefer, if not it´s essetial don´t use lights.

erico

Quote from: mentalthink on 2011-Oct-10

X_SPOT_LT 0,RGB(255,255,255), x,y,z, 0,2,0,360
1_When you move the ligth, whit x,y,z the fixed Point, it´s in 0,2,0, and always the ligth it´s lokking to this point. I think but I´m not sure the litgh can´t rotate, only 3d meshes

2_ About the light I always use whit 360 Degrees, in this mode I have a Spot light like a Sun.


Do you think the problem is the x_spot command?
I intend the light to target a little above the object 0,2,0, but would like to move the light around with x,y,z.
I was wondering if it has anything to do with the X_make3d and my field of vision is too small and affecting the light source.
I will give a try later to see if I can find a solution.

As for the light as a 360 degree, I guess it works as a point light this way right? does the target 0,2,0 still counts?

I´m not worried about poly/light counts or mobile yet, I just would like to see the 3d inside glbasic behaviour on my desktop.
I expect it to be similar to the open gl view you get inside 3d softwares.

Thanks for the help and hints!

aroldo

Oi Erico, tudo bem?

Sorry for the delay in replying, I am traveling on business and only today I had a chance to check my messages.
I wish we could start a Portuguese forum for the Brazilian community! :good:

Your final result looks nice, much better.

I said it right, I am learning 3D and how to use the tools like AC3D and I will try Blender before I make a decision.

Obrigado pela força!
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

erico

tudo joia,

I´m not sure a portuguese forum would do good, there would probably be the only 2 of us in there :P
Besides, I believe we do best in english, that way the whole forum can read it and help out.

If there is something specific you think writing in portuguese would help clarify, then also go ahead.
Most of the interested-on-the-topic people will google translate it, I do it a lot on the german side of the forum.

Blender is great and there is a lot of help+tutorial all around...mental posted a few italian excellent ones.
If portuguese is more confortable, you can get some here too:
http://www.blender.com.br/

I´d personally recommend you follow the official site though.
But that maybe is just me, I´m unable to use computers or software in any other language then english.
3d will have a lot of specific jargons and it´s best you learn them on the original form.
Translations tend to make this even more confusing...

Things I like best in blender(other then free and powerfull):
-great fluid simulation
-bullet phisics (maybe bullet could be wrapped inside glbasic??)

falou!

aroldo

Erico,

Tudo joia sim.

I have no problem with english at all, I was just kiding you.
Fortunately I speak Italian and Spanish.

I need to compare the features of AC3D and Blender.
Particle systems for explosion, smoke and fire are what I am looking for 2D and 3D games.

Thank you for your help and we will be in touch.

PS: Tonight there is Brasil x Mexico, I am in Mexico city and I wan to go to a place to what the game!!!

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2