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 / Loading pretextured objects

Author
Message
Unseen Ghost
21
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 2nd Aug 2021 14:21 Edited at: 2nd Aug 2021 18:54
Hi, I have read somewhere that someone has been able to load pretextured objects. That would be less code and less memory used. In other words you would not have to load textures for objects and paste them on.

What does this involve and how can it be done? Do you have to maybe embed the texture into the object in modeling software or how is it done?
Gigabyte Board/ AMD 3.3 Ghtz Quad core/8GB Ram/Nvidia Geforce 730 GT 2GB/1TB Western Dig. SSD/Windows 10 Home/Dark Basic Pro 9Ex

No one cares how much you know until they know how much you care.
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 5th Aug 2021 09:35

Just put the textures used for pre-texturing the object in the same folder where the object is. When loading the object, the textures will be loaded and applied to the object automatically.
Bored of the Rings
User Banned
Posted: 5th Aug 2021 14:34
yes, I don't think there is a way to retain texture data in the actual object so when you load the object it's there fully textured without having to load the actual image file. I did see somewhere that someone had achieved this iusing b3d format
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 6th Aug 2021 06:04 Edited at: 6th Aug 2021 06:05
In a very large program, this isn't a good feature to use since you will likely end up with duplicate textures in memory, not to mention time wasted loading needless textures.

One way to load textures faster is to use the DDS image format.

Ideally the best way is to make wrapper functions for image and object loading. This way you can have it keep track of path names, then automatically determine if loading a new image is needed or merely texturing object using existing loaded image.


You can only get about 2GB of textures loaded before DBPro begins to crash. I am not sure about DBPROEX.


Edit:
Also if you use DDS Image Format, the Mip Maps are generated in the image file, instead of being generated by DBPro during loading. This is a major reason why DDS Images load faster.

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!
Unseen Ghost
21
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 6th Aug 2021 13:31 Edited at: 6th Aug 2021 14:50
So I put all textures (if more than one) for each object in it's own folder. Load the object and it should show in the program textured, correct?

Also, I understand that dbo,x and dds are native object and texture formats, should I convert objects to dbo or x and use dbo or x with dds textures?

Can DBP still convert objects and textures to dbo or x and dds with simple load, save program made in DBP?

Or should I go with some other format like 3ds?
Gigabyte Board/ AMD 3.3 Ghtz Quad core/8GB Ram/Nvidia Geforce 730 GT 2GB/1TB Western Dig. SSD/Windows 10 Home/Dark Basic Pro 9Ex

No one cares how much you know until they know how much you care.
Kuper
16
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 6th Aug 2021 22:40
Texture filenames should be assigned in .x file. You can just open it with TexPad and see.
File name have to be full path or just "name.dds", but then, you should place .dds file and object file inside one folder to its correct load.
I export to .x file from 3dsMax and then convert it to .dbo (by DBPro itself) Textures save to .DDS via Photoshop. It is the fastest way to load it to DBPro.
Any way I think that it is really bad idea to use pretextured objects
- Some of objects use the same textures so it will increase memory consumption with no good
- In .x file you can set only one texture per limb - but most of shaders use more then one texture ( you need normals, masks and more )
Pretextured objects can be used for quick tests and demos but not more than that IMHO.
Unseen Ghost
21
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 7th Aug 2021 03:57 Edited at: 7th Aug 2021 04:06
Quote: "In a very large program, this isn't a good feature to use since you will likely end up with duplicate textures in memory, not to mention time wasted loading needless textures.

One way to load textures faster is to use the DDS image format.

Ideally the best way is to make wrapper functions for image and object loading. This way you can have it keep track of path names, then automatically determine if loading a new image is needed or merely texturing object using existing loaded image.


You can only get about 2GB of textures loaded before DBPro begins to crash. I am not sure about DBPROEX.


Edit:
Also if you use DDS Image Format, the Mip Maps are generated in the image file, instead of being generated by DBPro during loading. This is a major reason why DDS Images load faster."



Quote: "Texture filenames should be assigned in .x file. You can just open it with TexPad and see.
File name have to be full path or just "name.dds", but then, you should place .dds file and object file inside one folder to its correct load.
I export to .x file from 3dsMax and then convert it to .dbo (by DBPro itself) Textures save to .DDS via Photoshop. It is the fastest way to load it to DBPro.
Any way I think that it is really bad idea to use pretextured objects
- Some of objects use the same textures so it will increase memory consumption with no good
- In .x file you can set only one texture per limb - but most of shaders use more then one texture ( you need normals, masks and more )
Pretextured objects can be used for quick tests and demos but not more than that IMHO."



What I'm wanting to build is a soccer game. There will be a large amount of teams in a bunch of different leagues, but you will only see one game played, your team against a computer controlled team or another real person's team. The rest of the games will be simulated instantly using data. So I was going to load 1 goalie object and clone it to make a goalie for each team, they can be same color outfits. I would load 1 object and clone it for the 10 other team members for each team on the field, but texture each team in their own team clothes. I would load 1 object for a referee and clone it to make 2 refs.

So:
2 goalies one per team (same color clothes for both goalies)
10 field players per team (each set of 10 would have their team clothes)
2 refs (same color clothes)

So... if there are more than one texture for the playing field, different formats, jpg, png do I convert all textures to dds? Because I have grass image, normals image, transparent image for goal net etc etc.
Gigabyte Board/ AMD 3.3 Ghtz Quad core/8GB Ram/Nvidia Geforce 730 GT 2GB/1TB Western Dig. SSD/Windows 10 Home/Dark Basic Pro 9Ex

No one cares how much you know until they know how much you care.
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 24th Aug 2021 11:29
You can use what ever you want. You may find that the fastest way is to use DBO for models, and DDS for textures. It's better to not to use "pretextured objects" this way you can keep track of the textures loaded, and simply point to that texture (if already loaded) when applying it to a new model using TEXTURE OBJECT. If you keep track of which models are loaded, you can similarly use the CLONE OBJECT command instead of LOAD OBJECT. This is also faster since it skips I/O with the hard drive.

If you happen to use these suggestions you will be using a minimal amount of memory and your program will load in a fairly optimized fashion.

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: 2024-04-27 05:47:45
Your offset time is: 2024-04-27 05:47:45