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 / Texturing object with multiple images

Author
Message
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 17th Feb 2010 00:29
I have an alien 3d model. The body and head have seperate Uv images like most models. I also have 2 normal map images, for the head and body. In dbpro, how do I apply the head normal map to only the head and the body normal map just to the body?

If it hasn't exploded yet, I haven't touched it.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Feb 2010 00:34
Texture limb.

My signature is NOT a moderator plaything! Stop changing it!
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 17th Feb 2010 00:59
Thanks. I didn't know it would be that simple.

If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Feb 2010 02:03
That will only work if the head is not part of the same "mesh" as the body. If you are using a single skin mesh for the character, then it's one mesh.

The fastest code is the code never written.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 17th Feb 2010 03:01
Well it is one mesh so what do I do?

If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Feb 2010 03:23
Combine your textures into one. Then in your 3D modeling program, do a "UV unwrap" and assign the body with the UV coordinates so that it uses the body part of the texture and the head as the other. I am assuming you know what "UV unwrap" is.... Make sure you combine the normal map the same way as your texture. This seems like a lot of trouble, but without cutting off the head and making it a different mesh (which will make it a "limb" in DBP), I don't know how.

The fastest code is the code never written.
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 17th Feb 2010 11:16
Ajem, from what Madscientist told, I would try 'Texture limb' first
Put the texture map in stage 0 and the normal map in the stage 1.
You'll need to load a normal map shader and then use 'set limb effect', for normal maps to be used.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Feb 2010 12:39
But he said:

Quote: "Well it is one mesh so what do I do?"


i.e. only one limb I suppose?
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Feb 2010 14:25
Didn't someone say once that single objects with multiple textures create pseudo limbs for each texture?

My signature is NOT a moderator plaything! Stop changing it!
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 17th Feb 2010 14:35
Quote: "i.e. only one limb I suppose? "

Well, then follow Hawkblood advice, but it could be worthy to check first if the model is already prepared.

Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 17th Feb 2010 14:59
I think that he is looking for is possible with shaders, although, I don't know how to do it.


If you aren't using shaders the only way is to combine the texture as far as I know.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Feb 2010 15:56
Quote: "Didn't someone say once that single objects with multiple textures create pseudo limbs for each texture?"


I haven't heard that, but if true it offers some scope for re-texturing. Something to look into? A simple perform checklist should reveal the true situation.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 17th Feb 2010 21:50
Quote: "Didn't someone say once that single objects with multiple textures create pseudo limbs for each texture?"

I tried that just now with a cube where the top of the cube was textured with a red image and the bottom was textured with a seperate blue image. It's not true. There were no seperate limbs for each section of the cube.

If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 17th Feb 2010 22:04
In some documentation "texture" and "material" are synonimous. In D3DX they are actually separate intities, but the term "material id" is meant to refer to the combination of the "texture" and "material". The texture is simply a picture with no reguard to lighting. Material is what is used to give the object a "reaction" to lights and lighting effects such as specular and can even have a color change for diffuse, ambient, and emissive.

All this means is that when you have an object the "texture" refernece is actually a "material id". There is ONLY one material id per object. There may be a distiction between the texture stages, but I've never seen a use for that. The two suggestions I made earlier:
Quote: "Combine your textures into one."

or
Quote: "cutting off the head and making it a different mesh "


Are the methods I know and love. And I think they are the only way.

The fastest code is the code never written.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 17th Feb 2010 23:47
I think I'll just seperate the head from the body since combining the textures would lower the resolution of the textures.

If it hasn't exploded yet, I haven't touched it.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 00:06
Quote: "There is ONLY one material id per object."


?????

Here's an extract from an example from a recent thread. The object has TWO materials (though in this case only one was used - you can get both merely by changing some of the 1's to 0's):

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 00:34
An "object" can have many "limbs", but each limb can only have 1 material applied to it at a time. The term "object" in DBP can be a an array of meshes with each having their own material and texture(s). When I say "Material ID", I am refering to the material-texture combo. That's not to say that the mesh can't have multiple textures-- each in a different stage.

As a side note, assigning stage textures won't fix his problem. If someone has a better way to do what he needs, please tell me also.

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 01:50
Quote: "but each limb can only have 1 material applied to it at a time"


What do you mean? Each limb can have several materials as in the example I've just given. It might have only one material list. Is that what you mean? It certainly seems that you can only apply one material in DBPro but that's just a DBPro limitation - DBPro displays multimaterial X file objects fine.

Quote: "That's not to say that the mesh can't have multiple textures-- each in a different stage."


That's a different issue.

Quote: "As a side note, assigning stage textures won't fix his problem."


It might if he had a suitable masking or blending texture on one of the stages.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 18th Feb 2010 03:06
Well I seperated the head from the body but they both share the same bone rig. Will that effect the limb of the head?

If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 05:09
I'm not sure we are both talking about the same things GG. How many diffuse values can you apply to a mesh?

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 13:22 Edited at: 18th Feb 2010 13:23
I'm talking about the same things DX9 is talking about.

For example, from the horse's mouth:



and



What are you talking about?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 13:23
Second image for above post.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 17:05
One of us must be wrong then. My understanding is that the nMaterials is always the same as the number of distict subsets or "limbs" that are in the vertex buffer. The vertex buffer has all the vertices associated with that "scene" (yea... right now I'm not sure what it's called so I'll say "scene"). Even though that scene has say 10 distict subsets in it, it's all within that VB. Each of the 10 subsets have a Material, and that's what I understand as the use of nMaterials.
Quote: "The number of subsets is equal to the number of materials and textures in the mesh."

Ref. http://www.thehavok.co.uk/scene/32bits/tutorials/directx/techniques/tut4meshes.php

It is true that you CAN make multiple passes with multiple textures each with it's own material, but that's not what I'm talking about.

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 18:05
Quote: "and that's what I understand as the use of nMaterials."


Maybe, but what DX9 understands is the number of materials as described in the DX9 docs.

Quote: "My understanding is that the nMaterials is always the same as the number of distict subsets or "limbs" that are in the vertex buffer."


Not sure about that. It's quite possible for a mesh to have several materials declared in the X file and for the mesh to only use one of them. Does that mean that the vertex buffer contains redundant empty "subsets" corresponding to the unused materials. I doubt it.

I've just looked at your link and it seems clear that the materials are associated with subsets of vertices, no more no less. Nothing about "each limb can only have 1 material applied to it at a time", etc, just one per subset. That makes perfect sense because that is how the X file is constructed. I guess it's possible for some applications to turn those subsets into limbs (which can make sense) - but I don't think DBPro does. As far as I can tell DBPro turns frames, meshes and bones into "things" () that DBPro calls limbs.

I guess part of the problem is that different applications use the term "limb" to mean different things - and the DX9 SDK doesn't use it at all, just objects, meshes, frames and bones.

Quote: "It is true that you CAN make multiple passes with multiple textures each with it's own material, but that's not what I'm talking about."


What do you mean?

Anyway, one thing is certainly true, you can have several materials applied to different parts of a single mesh or limb (in the DBPro sense) - you just can't work with it easily within DBPro even though DBPro will accept such a mesh and display it correctly.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 18:32
Quote: "What do you mean?"

I mean you can do that with a shader that uses multiple passes. I am by far not an expert, but if you would show me some real-world examples... i.e. a program that actually does what you are saying, I would like to see it. Materials are not the easiest thing to understand in DX.

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 18:43
DBPro already does what I am saying. What do you mean?
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 19:13
Please send some code examples.

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Feb 2010 19:22 Edited at: 18th Feb 2010 19:22
Of what exactly?

Anyway, here's a simple demo. It uses a simple X file with ONE mesh, ONE limb (according to DBPro), and FIVE materials.

All five materials show, exactly as I have been saying, in both DBPro and DX9's mesh viewer. What more can I say?

It took just 10 minutes to create.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 19:43
I'll have to look at it when I get home. But, what I can see, you are correct-- there's no other way to put it. I have missed that for years. Now my question is: How do I get 3dsMax 10 to utilize my new-found knowlege??? Or, how to do it on the fly in DBP??? I mean, I don't want to have to write my own .x file each time I want to make a mesh.

The fastest code is the code never written.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 18th Feb 2010 21:40 Edited at: 18th Feb 2010 21:40
Well not to interupt your intense conversation hawkblood and GG but does it?
Quote: "Well I seperated the head from the body but they both share the same bone rig. Will that effect the limb of the head?"


If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 22:28
No. If you are using bones. I'm relatively sure it will have no effect except that now you have to texture the head separately. You may want to keep looking here as GG has taught me something new that you may be able to use as well. Once he can tell me how to use this new found knowlege, I'll be rolling in that.

The fastest code is the code never written.
Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 18th Feb 2010 22:39
Quote: "Or, how to do it on the fly in DBP???"

You can't.

Quote: "Now my question is: How do I get 3dsMax 10 to utilize my new-found knowlege???"

Convert object to editable mesh, select face mode and texture each face with material you want.

God is real unless declared integer.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Feb 2010 23:57
You mean it's been in front of me the whole time!!!!??? I need to figure out how to make this work in DBP.....

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Feb 2010 00:38
Quote: "You mean it's been in front of me the whole time!!!!???"


Probably.

Quote: "I need to figure out how to make this work in DBP"


Please let us all know how to do it when you find out.

I'm sure it can be done by sheer coding effort - but if you can find some useful shortcuts a lot of people will be very grateful. If you do a search on this board for multi-texturing and related topics you'll find several threads where people have had this problem with no satisfactory solution available in DBPro - yet.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Feb 2010 01:49
I'm not trying to "make" the tex/mat association in DBP, I'm wanting to utilize what you showed me and texture the object on the fly.
Brendy boy says
Quote: " You can't."

But I have nothing better to do than bash my head against the wall for several hours.....

The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Feb 2010 12:53
I believe you can - once you know how.

I don't at the moment, but the DX9 SDK is full of all the functions you probably need. Unfortunately I'm not a C++ programmer so I can't give specific advice. If you are though, then you can probably make a dll using those functions . I'll have a dig around in the docs and see if there's anything that looks relevant.

This is just the sort of thing for IanM or Diggsey to have a look into.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Feb 2010 13:00 Edited at: 19th Feb 2010 13:00
This looks relevant - especially Step 2:

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Feb 2010 19:33
Well, he was talking about doing it within the DBP framework.... I think he's right; it can't be done....
I have had some experience in C++ programming, but not in making .dll's in any language. As for my applications, I don't need to do the multi-materials per mesh stuff. So unless LOTS of people need it, I'll just stick with the framework in place. Otherwise, if in the future I do start needing it, then I'll research how to make .dll's and when I finish it I'll post it prominently.

The fastest code is the code never written.
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 22nd Feb 2010 05:57
I have used more than one limb for muli-texturing, but only when I created them for that purpose. DX/DBP does not create additional limbs when multi-texturing.

I'm still not exactly sure what you want.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Feb 2010 13:15
Quote: "I'm still not exactly sure what you want."


Have a look at the demo I posted on 18th Feb - and study the X file. The X object is one of IanM's plains with materials added to it.

What is required is a simple command to allow you to change the individual images used to texture the object. At the moment the DBPro "texture object" command does nothing when a limb or object has more than one material. The ideal solution would be an extra parameter, matId, in the command, e.g.

texture object objId, stageId, matId, imageId

etc.

I'm sure it can be done - I just don't know how to do it myself.
Daniel wright 2311
User Banned
Posted: 22nd Feb 2010 14:57
wow, all i do is I assing the textures to each object sepretly in milkshape, I give each material a serpret name, like material 1, I will name head for the head, and the same for the body, I will then assing the head to the head then the body to the body before I convert my modle into max for rigging. then max reads this in before I export out into .x. then when I load my guys into dark basic pro or even fpsc the program loads the textures, i specify no textures to let the program to decide. or I use a shader to load the textueres and all I do is leave the shaders field to default.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Feb 2010 21:23
Quote: " or I use a shader to load the textueres and all I do is leave the shaders field to default."


How? How exactly are you changing, say, just the material 1?

Remember, the point is to do this from within DBPro so the textures can be changed in realtime.

Login to post a reply

Server time is: 2026-07-28 19:06:54
Your offset time is: 2026-07-28 19:06:54