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 / Loaded 3ds/X object polygons always counted

Author
Message
kevinguitars
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 8th Jan 2019 19:11
Good evening!
I am using still DarkBasic Pro and I have a problem, which I don't know how to fix, and why it is happening. In a game a just create we can plant trees, and I load these tree object from 3ds or X files. As a new tree is planted and visible to the camera the polygon count goes up (statistic(1)). For example it's a low poly 30 polygon tree. I plant 3 of them and the program says 90 polygons. Thats ok, but when they are not in the screen the program also says 90. So it's like they always renderes, and after thousands of trees and with a high poly count the program slows down.

I tried it with simple box object created with make object box.... and this way as they move out of the camera view the poly count goes down... so I hope you understand, sorry for my bad english.

What causes this? Is anything wrong with my objects? They come from 3dStudio exported to 3ds and have an old converter to X files.

Thank you for any answers.
Kuper
11
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 9th Jan 2019 15:23
Maybe DBPro get object radius not correctly? Try to get object size and then "set object radius" manually.If not work than try to "set object radius" to some small value.Also try to convert .x file to .dbo
kevinguitars
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 9th Jan 2019 18:16
Thank you for the answer.

Do you mean the object collision radius? I don't have a "get object radius" command.

I tried to set it to the value it should be. I tried it with .3ds, .x (converted with the original DarkBasic CD-s converter) and saved the file as .DBO too. But unfortunately none of these worked.
kevinguitars
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 9th Jan 2019 18:28
Update: I loaded some objects from the original DarkBasic's static models library, and they work as they should. So they move out of the screen and the poly number goes down. So it has something to to with my objects I create with 3d Studio and export them. But I don't know what.
Mage
12
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 10th Jan 2019 01:17
You have discovered a deceptively difficult problem all games have. You need to use these commands.

The Most Important Commands You Need:
Exclude Object On (makes the object not get drawn anymore)
Exclude Object Off (makes the object get drawn again)
Rule 1: You cannot use both of these commands on the same object without having a SYNC happen in between. So if you are sloppy and hide everything then try to set stuff to be shown that won't work.

The Idea:
You got to dream up a clever way of knowing when objects are on screen (intended to be visible) and when they are off screen (intended to be not visible). Then you use the above commands to add/remove the objects from the rendering pipeline.
So maybe you can do some math and calculate when an object is too far away for the camera to see it, then exclude them. Don't forget to reverse this when they become visible again.

Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!
Kuper
11
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 10th Jan 2019 16:19
@kevinguitars
You have to get radius of an object manually.Try to get vertex coordinates and theb calculate object size from this or just find code snippet here.
kevinguitars
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 10th Jan 2019 18:09
SOLUTION FOUND!!!

Thank you for everyone who responded. I had the idea the whole day in my head that there must be something with the objects. I opened a X file (which worked well) from the old DarkBasic CD-ROM and one object I created in 3d Studio and searched for some different sections. The only difference I found was that in my files there was a part at the end starting with

AnimationSet x3ds_animset_0 {
Animation x3ds_anim_0 { .... etc...

And as these objects are not animated I deleted this section and now as the objects move out of the screen the polygon numbers decrease.

Mage
12
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 15th Jan 2019 04:19
I think I remember a post from about 10 years back mentioning that objects without animations are special exception with culling. Like DBP might cull them off screen without some special system. It's been a long time and the details are a bit hazy.

Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!

Login to post a reply

Server time is: 2019-06-17 13:42:43
Your offset time is: 2019-06-17 13:42:43