Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / (DBPRO) DirectX Format

Author
Message
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Mar 2018 13:36
Imagine creating a 3D object with our notepad ? . We could create .x objects with any text editor .
This tutorial, is dedicated to all those who like the challenge of creating things with our effort and knowledge.It is not about reinventing the wheel, but about understanding how objects are created in DirectX.
The triangle is the minimum representation of any 3D mesh. The mesh needs at least three vertex to be able to be seen in 3D space, therefore we need three vertex to define a triangle.

This is the minimum code of a .x file (a simple triangle)


Let's add a texture to this triangle



Adding just a simple colour



Making a whole grid triangle by triangle, could be tedious. Now that we know how to create an .x file, we will automate the process with the help of the Darkbasic or any programming language.

Let's do a cirlce with the help of Darkbasic Pro Editor



Let us add a texture to the circle.


Adjusting the texture to the object .


Let's do something more complicated ...a Sphere


I'm sure you will be able to add a texture to the sphere. Next Post

Cheers.
I'm not a grumpy grandpa
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 29th Mar 2018 17:22
Lovely tutorial
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 29th Mar 2018 19:54 Edited at: 29th Mar 2018 19:59
This is interesting, thanks! But if I were to use that I would also need to know about bones, weighted verts, and animations. No doubt that's a mountain of info.

Is there a directX spec sheet somewhere?
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Mar 2018 21:47 Edited at: 29th Mar 2018 22:01
@Chris Tate Thanks . I'm glad you like it

Quote: "if I were to use that I would also need to know about bones, weighted verts, and animations. No doubt that's a mountain of info."

Yes of course you can add weighted verts . I suppose that of the bones is what the 3D programs use in order to be able to animate the vertex . I have found some information to get started, the rest was try and error. After making some format converters , I decided to fiddle with the DirectX again .

What I have done with DirectX, is animate the object with some limbs but not bones. I've found out how blender animates the bones and vertex, and I made a simple example...something like a finger no more but the possibility of getting that , exist.

Take a look to the good tutorial of Paul Bourke "DirectX File Format Architecture" .

Ok some other example of Direct X.

This is just the same example of the sphere, but if we play with some variable values, we can get a nice Torus.

I'm not a grumpy grandpa
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Mar 2018 22:53 Edited at: 29th Mar 2018 22:53
Here's a little example I made long ago (It was one of my paranoises trying to make a mechanical shovel .
For those who do not know how to see this example. Simply copy and paste into a text file and rename the extension to .x Ex. Object.x



Here is an example that export animacion to an .x file
The code is a mess upside down with with explanations in Spanish, but now I'm too lazy to translate it into English .

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2024-04-19 12:06:00
Your offset time is: 2024-04-19 12:06:00