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 / Returning Object polygon count

Author
Message
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 29th Jan 2012 14:15 Edited at: 29th Jan 2012 14:19
Hi, I'm currently working on a model viewer for my portfolio. I need to print the polygon count at the bottom of the screen.

I don't think the Statistic(1) command will work for me due to the fact the object is viewed in a virtual studio setting which doesn't change when switching between models, so I don't want the stats to include this model. I want the stats of individual models and their total polygons (not what is on screen).

I hope that makes sense! If this is possible it saves me including the stats within the models cfg file.

Thanks

IlluminatedFX.com
For web design and graphic design services
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 29th Jan 2012 14:43
I would just cheat... like make a memblock mesh from a combined copy of the object - like make a mesh from it, then a memblock, then work out the memblock size, -12, then divide by 36.

Or, lock the vertex data and check the polygon count in that.

If you do this, perhaps your just as well adding more checks, like the mass of the object, maybe the coverage of it's texture, as performance would be affected by texture resolution as well as poly count. For example, if you have 2 cube objects, one of then unwrapped so each side uses a different part of the texture, and one that uses the same texture on each side - you could say that only half the sides are visible most of the time, so work out the total spread of the texture. A texture on each side means a texture size factor of 3 (texture width x 3), and the unwrapped cube would be a texture size factor of 0.5. In the long run it might help with optimizations.

Health, Ammo, and bacon and eggs!
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 29th Jan 2012 15:54
Thanks Van,

Unfortunately I've never actually touched memblocks in DB, so wouldn't know where to start. I think I might go back to plan A and just include the stats in the cfg file. Each model will need one anyway, so my viewer knows how to build the object. This isn't the kind of viewer you'd load an object to view it. It's essentially a 3Dviewer slideshow. Just a way of showing off my modelling skills in my portfolio.

IlluminatedFX.com
For web design and graphic design services
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Jan 2012 16:25


That should do the trick.

TheComet

Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 29th Jan 2012 16:47 Edited at: 29th Jan 2012 16:48
Quote: "That should do the trick."

it should't. What if object has indexdata?

This should



the above code will work perfectly if object has 1 limb, if it has more you'll have to modify it a bit

Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 29th Jan 2012 17:06
Or you could just get the weight of a cat: get your weight alone, pick up the cat and get the combined weigh and subtract your weight.

So: get the on screen poly count stat with no model viewed, store it to a variable, load a model get the new count and subtract the saved count of the environment.


WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 29th Jan 2012 17:20 Edited at: 29th Jan 2012 17:23
This function will return the polygon count on any object. Works for objects: with multiple limbs and animated objects.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Jan 2012 21:57
Good spot Brendy Boy, I hadn't thought of that.

@ WickedX

How fast is the conversion from object->mesh?

TheComet

WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 29th Jan 2012 22:15 Edited at: 29th Jan 2012 22:24
The whole function takes,

Box - less than 1 milliseconds
Sphere - 1 milliseconds
FPSC's: sci-fi AI character - 2 milliseconds

Login to post a reply

Server time is: 2026-07-10 00:43:23
Your offset time is: 2026-07-10 00:43:23