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 / .x file and multilayer

Author
Message
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 16th Jul 2015 15:31
i'm playng with the .x file format, it's easy to read and modify.

i wonder if someone know how to implement multilayer textures in .x.
or, maybe, have a .x file with multilayer to study on.

i try to explain more:

this is the way to create a material


in this section we can assign the material to a face:



but i can't figure how to assign more than one texture layer to a single face..

anybody does?

Lucka - gawteam coder - www.gawgames.com
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 16th Jul 2015 17:34
do you mean for dbpro's texture stages, for example applying diffuse, specular, and normal maps?

I'm not sure that you can directly in .x

Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 17th Jul 2015 00:54
i think it too.

i'd like to get a look on the .dbo file specs.. are available somewhere?

Lucka - gawteam coder - www.gawgames.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jul 2015 01:58
Quote: "i'd like to get a look on the .dbo file specs.. are available somewhere?"


Not sure if this leads to what you need, but have a look in your DBPro/Help/Documents folder.



Powered by Free Banners
James H
16
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 17th Jul 2015 02:26 Edited at: 17th Jul 2015 02:35
Looking at a mesh with multiple uv's created by memblock that is then saved as a mesh .x file, you should find a section within the brackets of the mesh data and is located at the end of all mesh data that reads something like this in notepad;

FVFData {
338;
18;
1234567890,
1234567890,
and so on
}

First value is fvf code, second value is how many total u+v coords there are(ie above 18=9 pairs of coords which for a single triangle would be 3 pairs per vertex thus 3 additional texture stages 1 2 and 3). The rest of values after this would of course be the uv coords. Although they are dword values they are converted back into floats. Also within the mesh data section you will find TextureCoords section. This only lists the first stage texture coords(at stage 0) and this time is in float format, but the rest(1 to 7) are put into the FVFData section all as dwords. This has something to do with the templates defined at the beginning of the file. But this is how dbp produces them which could be different to x files from other sources.

Sadly you cannot load these saved .x files back as anything other than meshes, they don't work correctly as objects for some reason..in these mesh .x files the fvf code is always wrong. This is possibly a dbp bug though am not sure. It might be possible you can just write this info into your object .x file and it works, I don't know and have not bothered trying in past, but felt you might want to give it a whirl if it suits your needs. You may need to right the fvf template in as well - I don't know that either, any saved mesh file should give you a template to copy from though.

If you check this link there are 2 downloads, 1 by hotline of a model that has what you ask of with 2 textures and the data does at a glance act as I suggest above, but its difficult to wade through with my eyesight so you may wish to take a look at that - it has a fair number of vertices. The other download is by me which is just dbp code for a single poly memblock mesh(4 textures) which you can alter the code to save the mesh of and then look at that x file as the layout is much easier on the eyes than the one hotline produced (in 3ds max I think). It might help you get a better grip on things, for example working out if the uv data is laid out for all uvs for vertex 1 and so on or if its laid out as vertex 1 stage 1 uvs followed by vertex 2 and then after cycle is completed the second stage for vertex 1 etc.

edit forgot link!
http://forum.thegamecreators.com/?m=forum_view&t=211829&b=1
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jul 2015 03:19 Edited at: 17th Jul 2015 03:22
I think the issue concerns multiple materials and texture layers, not multiple sets of UV data.

I didn't know there was a problem with meshes saved with multiple sets of UV.

Just checked your link and found this post:

http://forum.thegamecreators.com/?m=forum_view&t=211829&b=1&msg=2529412#m2529412

Well, who am I to argue?



Powered by Free Banners
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 17th Jul 2015 06:07
i don't think you can use more than one layer of texture from .x files (diffuse only). This would require a bunch of additional data in the x file,

Render states (how the layers should be drawed ? , zwrite , alpha transparent , additive etc)
Blending mode (how the layers should be blended ?) actually this is tricky and requires lots of flags and stuff to be set , to get the desired effect (Source blending , destination blending etc)

This data is not available in the .x file structure. So no ,you can't use multiple materials per face.

Here is a link to the x file structure.
http://paulbourke.net/dataformats/directx/

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 17th Jul 2015 10:18
yep.. no multiple materials per face in .x



in fact, the original problem was this:

i create a cube with make object, i load 3 different texture (1-diffuse,2-height, 3-normal) textured on 3 different stages.
then, using something like "ReliefMapping.fx" i get the result.

now..
i create a complex model with Silo or Blender, i texture it with a dozen of different textures (i.e. brick, stones, brass, etc.)
it's a simple cube wrapping of diffuse texture over the model.
i save it like a .x and i can easly find WHERE and HOW every single texture is applied on the model.

what i want to do is: for every texture (i.e. bricks) i'd like to duplicate the same position , rotation, texturecoords, etc. on a second (and maybe a third) stage on the same 3d model.

in theory doesn't seems so difficult. for every single texture use the same data, just a different stage. (and of course a different image file)

is there any way to reach this?
.dbo files can contain multiple stages, but they are not so easy to read and edit!

Lucka - gawteam coder - www.gawgames.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jul 2015 13:45
Have you considered combining all your diffuse textures into a single "texture atlas"? Then do the same thing with the normal maps, etc. Then use the texture atlas idea discussed on another recent thread? See more recent posts in

http://forum.thegamecreators.com/?m=forum_view&t=214859&b=1

You would need to do a bit of extra fiddling about with UV coordinates and texture borders to avoid seams - but at least you'd only be using 3 or 4 textures overall.



Powered by Free Banners
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 17th Jul 2015 16:26
i must jump in a real example:

this is one of my object, modeled with Silo3D, textured with a CUBIC mapping of 12 different textures (12 seamless textures).



the object already have all the proper texture coords for every single texture, i'd like to use the same data with the normal texture version of every texture.

for example the bricks: there's a diffuse texture, attached to some vertices, with some position, rotation, etc.
i'd like to simply SHARE all this data with another layer (the normal layer).

Same dimension of texture, same coords, same ALL.. only a different layer to be used for the .fx tu obtain bump mapping (or relief).

Lucka - gawteam coder - www.gawgames.com
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 17th Jul 2015 17:43
the simplest way to go about this is probably to separate the model by material. if you don't want multiple models you could split it in to limbs within one model and use texture limb, set limb effect

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jul 2015 20:29
Yes, that sounds like the most practical option.



Powered by Free Banners
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 20th Jul 2015 16:53 Edited at: 20th Jul 2015 16:53
just to say WHERE all my questions are involved..

http://forum.thegamecreators.com/?m=forum_view&t=214976&b=8&p=0

Lucka - gawteam coder - www.gawgames.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2015 18:15
Looks good. Hope you give us all updates on this.



Powered by Free Banners

Login to post a reply

Server time is: 2024-04-19 20:32:06
Your offset time is: 2024-04-19 20:32:06