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.

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 19th Mar 2012 18:06
How much memory does one dbp cube take, i would like to have detailed models in my game, but i want them to fit in 512 MB RAM?
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 19th Mar 2012 23:36 Edited at: 19th Mar 2012 23:38
cube?
err.. lol

never actually counted.. but just for you, here it is:

cube got 6 sides, wich is 6 polygons, every polygon have 4 vectorys,
every vector got X,Y,Z position and X,Y,Z rotation i guess.
about 8 bytes for every position

cube = (8*6)
cube = cube * 4
cube = cube * 6

1.1 Kilo byte of data stored inside 1 cube

means you can put up to 480k cubes without getting laggy.
after that i guess your video card will work harder to free and write new memory all the time..


now this logic is not 100% absolute, but this is the way how it works

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Mar 2012 23:41
DBP uses FVF 274:



That's 32 bytes per vertex. A cube has 6 vertices per side (two triangles to make one side) and six sides. So 6*6*32 = 1152 Bytes = 1.125 kiB

TheComet

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 19th Mar 2012 23:47
Quote: "That's 32 bytes per vertex. A cube has 6 vertices per side (two triangles to make one side) and six sides. So 6*6*32 = 1152 Bytes = 1.125 kiB
"


exactly how much i calculated...
lol
1.1 Kilobyte

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 19th Mar 2012 23:59
Hmmm. My maths is a bit different. I am guessing DBP cubes are stored as vertex and index data, and not just triplets of vertex data. If that's true it's 8 verts per cube, then 12 sets of index data, which I guess are 16 bit numbers.

8x32 = 256bytes (vertex data)
12x3x2 = 72bytes (index data)
Total: 328 bytes

But who knows?!?!

Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Mar 2012 01:39 Edited at: 20th Mar 2012 01:39
Quote: " I am guessing DBP cubes are stored as vertex and index data"

yes

And also vertexdata is stored twice and then object has position/rotation/scale/fog/depth/depth bias/wireframe/show state and bunch of other stuff. And also object has limbs, box has one limb. Limb have name/position/rotation/scale/transparency/texture/blend modes etc. so it's a little bit more then 1.1 kb

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th Mar 2012 02:07
I may be completely wrong, but I don't know how DBP handles objects in memory. But wouldn't the cube have 36 vertices per cube?
3 per triangle,
2 triangles per face,
6 faces.

3*2*6 = 36 vertices?

Then the XYZ positions, normals, and don't forget about the UV data.

Plus it stores a count of how many vertices it has for the positions, normals, and UV.

Here is a 100,100,100 cube aligned at 0,0,0:



WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Mar 2012 03:25
And then DBP stores all that info in an sObject class internally. (Which has pointers to this that and the other and is a big class in itself. It can be found in the include file "dbodata.h" for Dark GDK.)

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Mar 2012 04:18
Quote: "I may be completely wrong, but I don't know how DBP handles objects in memory. But wouldn't the cube have 36 vertices per cube?
3 per triangle,
2 triangles per face,
6 faces.

3*2*6 = 36 vertices?"

24 vertices and 36 indices. Some vertices are shared between trinagles

Quote: "And then DBP stores all that info in an sObject class internally. (Which has pointers to this that and the other and is a big class in itself. It can be found in the include file "dbodata.h" for Dark GDK.)"

exactly

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th Mar 2012 05:01 Edited at: 20th Mar 2012 05:03
Quote: "24 vertices and 36 indices. Some vertices are shared between trinagles"

Wouldn't this mean there would only be 8 vertices and 36 indices since each corner of the cube is shared by 3 triangles?

Also, if I were to load a cube.x file into DBP, would it automatically index the vertices and drop the total number from 36 to 24/8? I'm assuming, yes, and that maybe this is possibly where some of the speed increase from loading a direct native dbpro object comes from? E.G. DBP loads the .x finds shared vertices, indexes them, etc, etc.

Edit: I'm thinking WLGfx may have answered my question before I asked. Loading and converting a .x into an sObject class. Still not sure though.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Mar 2012 05:12
Normally you would think sharing vertices is a good idea but for some objects it doesn't work like that because of the vertex normals of a cube would cause a odd (quite cool on some objects in my opinion) lighting artifact. Edges over X degrees for the most part are better using a different vertex with new normals. That's why the DBP primitive cube doesn't share the corner verts.

I've not really looked into the actual size of the internal sObject structure because there's quite a few sub-classes too but you can bet your bottom dollar it's going to add a fair few extra bytes to all the vertex and index data.

I'd best not mention limbs and textures yet...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Mar 2012 05:12
Quote: "Wouldn't this mean there would only be 8 vertices and 36 indices since each corner of the cube is shared by 3 triangles?"

no, corners aren't shared between 3 triangles. All cube faces are separate don't share vertices. Every face is made of 2 triangles which share 2 vertices. So, those 2 triangles have 4 vertices. Cube has 6 faces, that's 6x4=24

Quote: "Also, if I were to load a cube.x file into DBP, would it automatically index the vertices and drop the total number from 36 to 24/8?"

No, the object is loaded in the form in which is saved inside the file. If the saved cube has 36 vertices it will also have the same number of vertices after loading

Quote: "I'm assuming, yes, and that maybe this is possibly where some of the speed increase from loading a direct native dbpro object comes from?"

No, the speed increase of loading the native format is in the fact that all the data is stored inside the file in the same format that is stored in memora. After loading the non-native format object has to be converted to native format and that is the reason of the slower loading in that case

Quote: "E.G. DBP loads the .x finds shared vertices, indexes them, etc, etc."

no, that doesn't happen.

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 20th Mar 2012 05:20
Thanks, fellas! Much appreciated.

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 20th Mar 2012 21:16
Thanks everyone for you help. Much appreciated.

Login to post a reply

Server time is: 2026-07-09 23:11:50
Your offset time is: 2026-07-09 23:11:50