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 / Global texturing in Dark Basic Pro? From Blender to DBP

Author
Message
Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 6th Apr 2013 21:57
Say I created a forest level in blender, I applied all kinds of pretty textures for meshes like Rocks, Trees, Grass, Terrain, and so on.

The process of transferring all that to DBP is pretty easy. Export .x file and use:
load object "demoworld.x",7
scale object 7,800,800,800

Now what about all those pretty textures?
How do I save the textures for that forest and how do I apply it in DB Pro?

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com
Sergey K
21
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 6th Apr 2013 23:24
idk about blender,
but most X exporers export the model and includes the textures inside same folder too
also when u your .x mdoel in dbp, it should include them automaticly as long the path of the textures exists..

Advanced Updater for your games!
Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 6th Apr 2013 23:40
Sergey is right; simply copy the textures to the same folder as the level and DBPRO will load the textures for you. You must assign materials to these objects, not just face textures.

Note that the Blender DirectX format cannot reference more than one texture per object/limb for blend shading; for this reason, using shaders and your own texturing system is a better idea than relying on blender to set textures for you. Modern games use shaders so there isn't much support for defining complex materials in DirectX files.

Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 6th Apr 2013 23:52
Well then in order to achieve multiple textures I need to use limbs. Is there a way to assign limbs in lender which would be recognized in BDPro?

Also if I created an object in Blender and textured it then don't I need to export the texture from blender? It's not like I could just copy and paste the texture file in the same folder as the x file and it would automatically assign it to the appropriate model the exact same way I applied it in blender?

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 7th Apr 2013 06:30
Quote: " It's not like I could just copy and paste the texture file in the same folder as the x file and it would automatically assign it to the appropriate model the exact same way I applied it in blender?"


yes, as the others said, it will do just that as long as the image has been uv mapped to the object and assigned in a material before the export

Chris Tate
DBPro Master
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 7th Apr 2013 06:34 Edited at: 7th Apr 2013 06:49
The DirectX file will contain the names of the limbs, and the file name of each texture (excluding the path). Arguably you could open the ASCII based DirectX file in a texture editor and search for the texture file in the text, and even edit it directly. This information is retained when you load your object, and all the limbs will be textured providing DBP can find the texture files written in the DirectX file. You do not need to do anything other than apply a material with an assigned image texture in Blender, stored in the same folder as the DirectX file to have DBP handle your texture loading for you.

The best way to understand what is going on is to look under the surface of blender, DirectX and DBP.

Blender's elements are all datablocks; a bit like DBP user defined types. Textures reside in one array, materials are in another. Blender objects contain an array of materials, which inturn contain an array of textures per stage; the issue is Microsft did not design the DirectX format to store more than one texture per limb according to the creator of the export script.

When you export to DirectX format from blender, the script does a for loop on all objects in the scene (or selected objects if the option is picked) that contain a mesh or are empties. Any curve or surfaces need to be converted to meshes. Any duplicates need to be made real. Shape keys cannot be animated in DirectX, but can be exported statically or as bone controlled. 99% Modifiers will work when apply modifiers is checked.

The actual script writes the mesh names, location, scale, rotation and vertex data to the file; and each blender object becomes a DBP limb, and can contain animation data. So Blender objects are as you stated, DBP limbs; giving them memorable names are a good way of describing what they are for when dealing with them in your game engine.

For each limb, the script searches for the first material in the material array, then if this entry exists, it writes the material's diffusing colour to the file (I am not currently sure if it can store more than one diffuse for every vertex); then it searches for the first texture assigned to that material and writes the file name of the image texture to the DirectX file for the limb. It will ignore any other type of texture, including clouds or noise. By default all meshes contain vertices with a UV value of zero, therefore you will not see a textured object in the engine without hitting the U key in blender's edit mode to unwrap the mesh; a reason why it is good to use dupligroups of pre-UV unwrapped meshes.

You could actually open the Python DirectX script and see how it does all of this, it simply searches for all the appropriate datablocks, which can all be referenced via tooltips. I believe the person who created the script is in the TGC community. Looking at the script reveals how you could actually create your own file format. The X3D format is quite a good script to look at because it is XML based.

With Blender you have to use it everyday with your engine to get familiar with their differences. Eventually such practice becomes a valuable investment because Blender can actually be your world editor, character editor and texture editor, but only with practice.

Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 7th Apr 2013 18:13
Quote: " I believe the person who created the script is in the TGC community. "


yes, the main thread is on the 3d chat board

http://forum.thegamecreators.com/?m=forum_view&t=166987&b=3

Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 7th Apr 2013 21:07
I am jumping back and forth between Blender, 3D world studio and Cartography shop trying to evaluate which one would work better.
I did notice that one, after creating a tree in tree magic, I have imported that model into the models folder in the 3D world studio but when I placed the entity in the editor environment it got textured with the default chosen texture of the editor. After a bit of searching I came to a conclusion that the trees textures need to be placed i nthe texture folder separate from the .x model and after I've done so, the multi-textured model started showing up in the editor.

However the level loaded in DBP only contained the terrain texture (signle texture)

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 7th Apr 2013 21:40 Edited at: 7th Apr 2013 21:41
a model setup with multi-textures will still load and apply textures automatically as normal.

note that in the .x file there are 2 materials listed, each with a texture filename, and that both textures are present/auto-applied when loaded:



Attachments

Login to view attachments
Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 7th Apr 2013 22:08
Alright that is good to see. So then as long as the textures are in the same folder as the model, it should work out fine.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com

Login to post a reply

Server time is: 2025-05-17 16:46:33
Your offset time is: 2025-05-17 16:46:33