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.

Newcomers DBPro Corner / Multiple textures using a shader

Author
Message
airforce1
15
Years of Service
User Offline
Joined: 2nd Apr 2009
Location:
Posted: 18th Apr 2009 03:48
Can anyone by any chance tell me how I can put more than one

texture on a object that uses a shader. My problem is that I

have a object that has 3 different textures on it. I want to use

the parallax shader on it. I have tried it with three seperate fx

files, but it takes the last one loaded and textures the whole

object with it. When I tried to load all the textures into one

file the object disappears. Anyone know how to do this?


thanks
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 18th Apr 2009 21:21
There doesn't seem to be a way to use multiple texture maps on a single limb in DBP, except when auto-loading the textures upon import - which doesn't help much if you want bump-mapping or other effects. Apparently you need to split your object into separate limbs by texture map, or even into separate objects in some cases, in order to multi-texture. (The latter case seems true of animated figures using weighted skeletal rigging. In .x or .dbo, the weighted meshes are all merged into one limb, rather than split into limbs which are associated with the bones. To make multiple limbs of this merged portion, it seems you need to use it as a separate figure, attached to the main figure.)

It would be really cool if someone would develop a plugin which can work around this limitation somehow. Assuming that's even a possibility, with DB's foundations.... :thoughtful, speculative emoticon goes here:
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 18th Apr 2009 22:59
Show us what code your using as well as a model sample with textures and the name of the product you used to create and export the model. This will help us determine a solution quicker.

Cagedrei: A model can have any number of limbs and limbs can be single meshes or bones. What your refering to is materials in the model editor where a single mesh can have more than 1 texture, but when ported to dbp only 1 ever shows?(depends on model editor, sometimes they don`t show any texture) - I believe the materials are just effects. In dbp you can texture limbs or objects with multiple textures and apply an effect. You just need to find/create your own effect and texture the limbs then apply the shader to the limbs.
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 18th Apr 2009 23:25
Quote: "Cagedrei: A model can have any number of limbs and limbs can be single meshes or bones. What your refering to is materials in the model editor where a single mesh can have more than 1 texture, but when ported to dbp only 1 ever shows?(depends on model editor, sometimes they don`t show any texture) - I believe the materials are just effects. In dbp you can texture limbs or objects with multiple textures and apply an effect. You just need to find/create your own effect and texture the limbs then apply the shader to the limbs."


Maybe I shouldn't be posting on such topics. LOL I'm repeating some information from what I've read on the board and making some assumptions from my own (probably flawed) tests. Hmm.

Basically, I haven't found a way to get a model with weights (not just 1.0 weights for each vertex to one bone, but graduated weights for multiple bones) to export to .dbo or .x (and then work) without the weighted meshes in the model all being merged into one limb. I've read on this board that .x files can only contain one diffuse texture map per material, and my tests suggested that .dbo has the same limitation.

Multiple textures can be applied, but can you use separate textures with different parts of a single limb which have different UV mapping? I'd like to know how, if you can! (and so would others, based on the threads I've read.)

But I may actually be more off-topic for the thread than I thought. :blush: My apologies. Don't let me sidetrack things.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Apr 2009 03:08 Edited at: 19th Apr 2009 05:01
Its not really off topic, plus we need to see some stuff from airforce1. Your right about the uv limitation afaik, but then I haven`t made any real efforts/attempts in this direction. One way around it although I haven`t tried, might be to export the mesh with each uv layer on seperately as the first uv layer, then make a memblock mesh of the combined data after importing the meshes into memblocks. Probably wouldn`t work for bone animated models(I`ve never had any luck assigning vertex groups in memblock meshes) and seems a lot of work for something that should be already done. I haven`t looked at truespace yet BUT it may have better support for this. Your probably right though about bone rigged models having problems with multiple meshed limbs and additional textures. Failing all that you could always try to rewrite the x file itself, again a lot of effort for something that really needs automating.
Btw disregard what I said about materials being effect specific, I use blender and I just noticed shaders have a seperate menu within the materials section, so it could be that they are a mix of effects and additional objects unidentifiable as seperate objects in the modeling package, or maybe fragment shaders or something.

Edit:
http://forum.thegamecreators.com/?m=forum_view&t=147830&b=3
have a look at post by user tatts dated 30th Mar 2009 22:48
Quote: "Did I mention DBPro loves multi textured X files from TS 7.6"

Probably the way to go?
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 19th Apr 2009 08:07 Edited at: 19th Apr 2009 08:13
Thanks, James H. After my last post, I did some more searching on the forum here and learned some things about loading multiple textures onto the object or limb, using different uv sets or texture slots. There didn't seem to be anything which covered my problem. I'm assuming that the OP is talking about what I'm going on about, one model with overlapped UV regions which would represent different materials zones in your average 3D application. I find no mention anywhere of something that can deal with that situation in DBP, aside from the things I initially mentioned.

Am I right that .x and .dbo files can only contain one texture listing per material listing, and that will just be the diffuse texture? And that texture is the one which will auto-load in DBP with the model. If there's a way to hack a .x file to add in, say, a bump map listing and have that load as well, that would solve my own problem.

But it wouldn't help load three parallax shaders onto one object.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Apr 2009 16:35 Edited at: 19th Apr 2009 16:36
Quote: "There didn't seem to be anything which covered my problem. "

Haven`t found anything myself yet. Have just taken a quick look at the newsletter turial for truespace but it doesn`t cover this or texturing. The only way I can get multi textured meshes with different uvs is to export from blender several times, the mesh with each uv layer on seperately; import the meshes into dbp, make memblocks from them, make a memblock of the correct size for the suitable fvf format and fill it with the right data from the other memblock meshes. Make a mesh and object from that memblock and texture the stage indexes accordingly. This can be done again and again adding the meshes as limbs and texturing the limbs stage indexes. However I can`t get this to work for bone rigged objects.

Quote: "Am I right that .x and .dbo files can only contain one texture listing per material listing, and that will just be the diffuse texture? And that texture is the one which will auto-load in DBP with the model."
It seems to be the case but I wouldn`t know for certain.

Quote: "If there's a way to hack a .x file to add in, say, a bump map listing and have that load as well"

Yes, but I`m not sure it would work with dbp. The model viewer for direct x can load this type of x file, but I have had no success in getting them to work in dbp. (assuming you mean auto load fx files)

Quote: "I'm assuming that the OP is talking about what I'm going on about"
could well be, but he/she could be using parralax mapping in their model editor - parralax mapping uses 3 textures(at least in the example I have it does) - base, normal and height. They may not be using a bone rigged model either, its possible there are three seperate meshes and a texture for each, difficult to say with the info given. In fact the last two sentences don`t really make too much sense without seeing the project and media.
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 20th Apr 2009 01:28
Quote: "
Haven`t found anything myself yet. Have just taken a quick look at the newsletter turial for truespace but it doesn`t cover this or texturing. The only way I can get multi textured meshes with different uvs is to export from blender several times, the mesh with each uv layer on seperately; import the meshes into dbp, make memblocks from them, make a memblock of the correct size for the suitable fvf format and fill it with the right data from the other memblock meshes. Make a mesh and object from that memblock and texture the stage indexes accordingly. This can be done again and again adding the meshes as limbs and texturing the limbs stage indexes. However I can`t get this to work for bone rigged objects."


Interesting. I'm making a note of that process, to try it. Hmm. I haven't seen anything which suggests that vertex weights can be handled in DBP. Is there a way to define a second UV set for an existing mesh? Perhaps one could load the rigged object and then copy in the second UV layer from another object. I've no idea. Hmm.

Quote: "could well be, but he/she could be using parralax mapping in their model editor - parralax mapping uses 3 textures(at least in the example I have it does) - base, normal and height. They may not be using a bone rigged model either, its possible there are three seperate meshes and a texture for each, difficult to say with the info given. In fact the last two sentences don`t really make too much sense without seeing the project and media."


Oh! So it's probably more a question of handling texture layering. Presumably a parallax shader is set up for multiple layers, if three textures is the norm. Wouldn't it just be a case of using texture object, then, with the proper stages?

James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Apr 2009 02:00 Edited at: 20th Apr 2009 03:14
There is a list for the fvf codes flying around somewhere, but iirc just add 256 for each uv layer to the current format so with fvf 338 just do something in the lines of "convert object fvf objnum,338+256+256" etc, I`m not sure but for certain formats you probably have to set them up like "convert object fvf obj, hex value||hex value||hex value||hex value etc". The problem with bone rigged objects is that when I grab a mesh and make a memblock from it there is no place in the memblock filled with weight and vertex assignment data, so we can copy uv data into a fresh mesh but can`t reassign the weights etc, or at least my efforts so far have failed so I can`t say its not or is possible.
To apply shaders you load the effect file, texture the stage indexes for either limbs or whole object then apply the effect;

sometimes the textures for effects are dictated in the fx file in which case you have the option to add ,0 or ,1 at the end of the load effect line. If you do a forum search for ultimate shaders you should find a free download of dbp shader projects all ready to go.

Edit:
the ultimate shaders pack thread is stickied at the top of the work in progress board
uploaded a text file I got off the forum some time ago so I can`t remember who posted it - fvf list/intsructions

Attachments

Login to view attachments
airforce1
15
Years of Service
User Offline
Joined: 2nd Apr 2009
Location:
Posted: 23rd Apr 2009 19:44
First thing is I would like to thank each of you for your help.

Here is a screen shot of the object I am testing.

load effect "objects\buildings\Transport\Wheel_barrel.fx",9,1

LOAD OBJECT "objects\buildings\Transport\wheel_barrel.x",w_barrel
POSITION OBJECT w_barrel, 7732,502,9890
YROTATE OBJECT w_barrel,0
SCALE OBJECT w_barrel,1600,1600,1600`1800,1800,1800
SET OBJECT w_barrel,1,0,1
SET OBJECT DIFFUSE w_barrel,RGB(3,3,3)
SET OBJECT AMBIENCE w_barrel,RGB(75,75,75)
SET OBJECT EFFECT w_barrel,9


This is with auto texture no effect its fine.

Attachments

Login to view attachments
airforce1
15
Years of Service
User Offline
Joined: 2nd Apr 2009
Location:
Posted: 25th Apr 2009 00:11
Ok isn't there a way for me to check to see how many limbs one

object has. Even though it was imported as one object. So I could

texture each particular limb as well as put a effect on it.If

so please explain.


Thanks
Cagedrei
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 25th Apr 2009 07:15 Edited at: 25th Apr 2009 07:18
This is from the help files:



There are also functions in the DKAVM plugin and the Matrix1 plugin which can give the limb count. The Matrix1 allows you to get a limb by name, which is useful.

As for the parallax mapping, I've tracked down the Evolved ParallaxMapping.fx shader. This is how it's set up in the example dba included with the shader:



So the three required textures are loaded onto different texture layers, and the shader looks for them there.

And... that's exactly what James H already posted. Heh. THanks for the FVF info, James! I just re-checked this thread today, rather belatedly. I put together a program to help myself understand the fvf handling. That seems to have helped. At least I'm no longer ranting about how DB is put together sideways. LOL (Obviously it's DirectX which was put together sideways. Hmm.)

Login to post a reply

Server time is: 2024-09-28 06:22:08
Your offset time is: 2024-09-28 06:22:08