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.

Newcomers DBPro Corner / direct x object question

Author
Message
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 22nd Dec 2013 22:34 Edited at: 22nd Dec 2013 22:56
I loaded a direct x object into a dark basic pro program without any problems however when I scaled the object to a size I wanted it made the position of the object different? The larger I scale a direct x object the more it offsets it's position???
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 22nd Dec 2013 23:03 Edited at: 22nd Dec 2013 23:09
This code places this code places the direct x object 60 near object 6 because it scales it at 60,60,60 which is too small



This codes places the direct x object away from object 6 because it scales it at 6000,6000,6000?

The Tall Man
10
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 22nd Dec 2013 23:32 Edited at: 22nd Dec 2013 23:40
I'm not gonna look through all the code, but not everything stays in sync when you use scaling - there are some oversights. Just compensate by applying the scale yourself to the positioning. Read the position first, then scale the object, then reset the position, manually applying the scale or its inverse, if necessary.

As an alternative, to be sure that everything stays in sync - assuming DarkBasic has memblocks as DarkGDK does, you can load the .x file into a mesh, and access its data through a memblock, and multiply all the vertex points by your scale, to literally resize your object (scale doesn't actually change the object's size internally, it's just a scale that the object is "always" accessed through). If you want, you can save your resized to another file so you won't have to resize it each time.

Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!

A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 23rd Dec 2013 00:25
Quote: "I'm not gonna look through all the code, but not everything stays in sync when you use scaling - there are some oversights. Just compensate by applying the scale yourself to the positioning. Read the position first, then scale the object, then reset the position, manually applying the scale or its inverse, if necessary.

As an alternative, to be sure that everything stays in sync - assuming DarkBasic has memblocks as DarkGDK does, you can load the .x file into a mesh, and access its data through a memblock, and multiply all the vertex points by your scale, to literally resize your object (scale doesn't actually change the object's size internally, it's just a scale that the object is "always" accessed through). If you want, you can save your resized to another file so you won't have to resize it each time.
"


I didn't really understand that but why would scale effect the positioning of an x object?
The Tall Man
10
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 23rd Dec 2013 01:06
It shouldn't - as I said it's an oversight of the engine. You could also try scaling, and then setting the position.

Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!

A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 23rd Dec 2013 01:19
Quote: "it's an oversight of the engine."

Really? I would've thought the scale was just multiplied by 0.01 and put into the world matrix of the object, why make it more complicated than that?

Perhaps what you're getting at is that the model is offset so that its centre / pivot point isn't where it should "logically" be? If so you can manually offset the root limb (0) of the object after loading it.


"Why do programmers get Halloween and Christmas mixed up?"
The Tall Man
10
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 23rd Dec 2013 02:19
You know, I think Rudolpho has a good point!! I bet that's it. Not every model is centered.

Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!

A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 23rd Dec 2013 17:01
when I load a 3ds model I don't have a problem with scaling effecting the positioning?
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 23rd Dec 2013 20:21
Then load the 3ds file, save the loaded object as a .dbo file and try loading that one. Then do the same with the .x file. If the issue persists only with the x version then the problem simply lies in how that one was exported / created.


"Why do programmers get Halloween and Christmas mixed up?"
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 24th Dec 2013 19:11
Quote: "Then load the 3ds file, save the loaded object as a .dbo file and try loading that one. Then do the same with the .x file. If the issue persists only with the x version then the problem simply lies in how that one was exported / created.
"


I have a problem with 3ds files before 3d crafter exports it, it displays an error message and the models when loaded into dark basic are just black and can't be textured?

It could be my version of 3d crafter plus that's at fault?
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 25th Dec 2013 12:00
DBPro doesn't really support 3DS anymore, its just a legacy thing from DBC.


"Why do programmers get Halloween and Christmas mixed up?"
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 25th Dec 2013 23:00
In order for an x object to have limbs does it need a skeleton?
Alvind
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 26th Dec 2013 22:39
AFAIK in DBP a limb needs to have a parent. A skeleton is more for animation software. I could be wrong about DBP bit tho.

Deus Ex: Return of Denton
http://www.moddb.com/mods/deus-ex-return-of-denton
captain caveman
10
Years of Service
User Offline
Joined: 9th Dec 2013
Location:
Posted: 27th Dec 2013 14:16
Quote: "AFAIK in DBP a limb needs to have a parent."


how do you establish an x model having a parent and limbs?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Dec 2013 16:41
Quote: "In order for an x object to have limbs does it need a skeleton?"


Generally speaking, I would say yes. If you do not create a skeleton in your 3D modeling program and just load in the .x mesh, DBP will error when you attempt to access/manipulate limbs. It is possible to add limbs in DBP, so technically, I suppose you could load in the .x meshes and add them as limbs to an object. Bear in mind that if you do that, you will be responsible for managing the limb rotations and positions; a difficult task for say, a character mesh.

It is typical to create a skeleton for your mesh in a 3D modeling program so you can create animations with it. The resulting .x file is exported to DBP and you play the animations using DBP's commands.

I never liked 3D Canvas, as it was strange to work with but I have never tried 3D Crafter. I would think they have some tutorials on Amabilis' site to show you how to create a skeleton.

Quote: "how do you establish an x model having a parent and limbs? "

I prefer to simply create limbs in a modeling program. If you want to do it within DBP look at the LIMB commands.

So many games to code.....so little time.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Dec 2013 18:49 Edited at: 28th Dec 2013 18:55
Hi there

In most 3D programs, when we create an object, let say a ball, when we export to whatever format we need let say .x ...the center of rotation, is not the center of the ball, the center pivot, is the center of the 3D program where we create the ball.

Example: If we make a simple sphere "ball" and instead off position correctly in the center of grid before exporting to .x then if we scale the object of if we rotate it, it will do it from the local center of creation .

Let see this piece of code:



It has the center pivot slightly out of real center. Execute code to see and then rem file 11 and unrem file 12 to see what hapens.

In the same way, we can instead of scaling our object, SIMPLY SCALING the limb cero of our object.

And here concerning to limbs...a mess of tuto...



Merry Christmas to everyone .

I'm not a grumpy grandpa
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 31st Dec 2013 11:55
Simple test:

1. Create a primitive sphere with a size of about 5% of your model.
2. Position sphere at same position as model
3. Check where the sphere is, this is your model pivot point, and the point from which it will scale outwards.

Login to post a reply

Server time is: 2024-04-23 10:40:02
Your offset time is: 2024-04-23 10:40:02