HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Swapping Textures & SkinTones  (Read 1281 times)

grogbro

  • World Owners
  • ****
  • Posts: 117
  • ZOMBIES! YAY! RUN!!
    • View Profile
    • My Portfolio
[Resolved] Swapping Textures & SkinTones
« on: Jan 21, 13, 10:39:15 PM »

Currently I have a Dynamic Character with two parts, one for the head named 'chead' and the body named 'cbody'. I've spent some time setting up Dynamic Texture Banks on both chead and cbody and I am realizing that Dynamic texture banks are really only for skin/tinting and not for swapping textures on a single model.

What I want to do is pretty basic which is to have one model, say the Head of a character and have the choice of having around 10 diffuse textures swappable on it for character creation. The same with the body, one model and swap 10 textures on it.

I know what you are going to say which is "just make part, 10 head .hgm's and have those point to each of your 10 textures", same with the body part.

^^ I know I will get flamed for this but it just doesn't make sense to me why I can't just have 1 model and have swappable textures on it similar to how the Dynamic Texture banks work, but instead of Tinting I am cycling between 10 textures on a single model. Maybe with a new type like 'Type = Swap' ;)

Am I missing something in the dynamic texture bank .dtb settings? If I set  Type = Tint1  or something similar will that allow me to just cycle between say 3 textures on the model? Here is what I have so far.

Code: [Select]
!
! Texture bank definition
!

[Root]
Character\Dynamic_2\TextureBanks\chead\

[Layout]
-chead

[Layers]
{chead}
   Type=Skin
   Region=(0,0,511,511)
   {Settings}
     Palette1=Skin,SkinBlend.dds
   {Files}
      (1024,1024)
  chead_1_d.dds
  chead_2_d.dds
  chead_3_d.dds
   {Pieces}
      (Diffuse)
        Blends=3
         head1
           DefaultBlend=1
         head2
           DefaultBlend=0
         head3
           DefaultBlend=0

I am actually OK with doing 10 parts if thats what I need to do, but does Hero Engine have some magic code that ignores the other 9 (or whatever amount of heads I have), and realizes they are the same model? This could just get expensive if I had say 30 head texture swaps, and its just a waste if I can use just One model, since they would be the same.
« Last Edit: Feb 06, 13, 05:46:10 PM by HE-Cooper »
Logged

grogbro

  • World Owners
  • ****
  • Posts: 117
  • ZOMBIES! YAY! RUN!!
    • View Profile
    • My Portfolio
Re: Swapping Textures
« Reply #1 on: Jan 22, 13, 12:39:40 PM »

Ok I still don't know if swapping textures is possible via the Dynamic Texture Banks but from all I have read it's not meant for that and you need to make separate parts for each texture you want to swap.

I did get tinting on the Head at least to work which was a struggle because I believe the Wiki left out the fact that even your textures need to be named the same as your 'bank' folder. So basically to be safe make sure you name EVERTYTHING starting with the name of your texture bank.

Example:  My folder inside Texturebanks is named 'chead', the DTB file (shown below) is named 'chead.dtb', all of my textures are named 'chead_1_d.dds', 'chead_2_d.dds', 'chead_3_d.dds' (I only have three test ones right now). And as it says in the wiki make sure your Material is named ~dt2_nameofyourtexturebanksfolder. My head material in 3dsMax is named ~dt2_chead   but in Maya its a different prefix.

As it says in the wiki you have to have 3 files, so I have 3 textures, and it has to point to the Skin DDS which is listed in this line  ->       Palette1=Skin,SkinBlend.dds   and thats what shows up when you go in-game, Hit F5, CCS tab, Character Manager, Skin Tone tab, move the arrow on the triangle.

I hope this helps. I am sure naming everything is overkill but I've struggled with this and that's the only way I could get it to work.

Stadi was able to lend me the starter for their code so here it is below with my edits. Thanks Stadi for all of your help!

Code: [Select]
!
! Texture bank definition
!

[Root]
Character\Dynamic_2\TextureBanks\chead\

[Layout]
-chead

[Layers]
{chead}
   Type=Skin
   Region=(0,0,1023,1023)
   {Settings}
     Palette1=Skin,SkinBlend.dds
   {Files}
      (1024,1024)
  chead_1_d.dds
  chead_2_d.dds
  chead_3_d.dds
  chead_1_n.dds
  chead_2_n.dds
  chead_3_n.dds  
   {Pieces}
      (Diffuse)
        Blends=3
         Human Caucasian Normal
           DefaultBlend=1
         Human African Normal
           DefaultBlend=0
         Human Asian Normal
           DefaultBlend=0
      (Normal)
        Blends=3
         Human Caucasian Normal
           DefaultBlend=1
         Human African Normal
           DefaultBlend=0
         Human Asian Normal
           DefaultBlend=0    


NOTE: Also the Region is important. If you are using a 512x512 texture region would be 0,0,511,511 if you are using 1024x textures it would be 0,0,1023,1023

I hope this info at least helps you with any skin toning.

 

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Swapping Textures (skin tone)
« Reply #2 on: Jan 22, 13, 12:48:27 PM »

You have definitely wandered on to the oldest documentation we have, and the most complicated parts of the art pipeline. Bennett will have to comment on specifics, but I think you are correct in all of your assumptions. The dynamic parts system swaps parts, and doesn't have a "just swap texture" aspect. It swaps the whole part. As for required naming conventions, that sounds like something we would require, so I'd stick with it. :-)
Logged

grogbro

  • World Owners
  • ****
  • Posts: 117
  • ZOMBIES! YAY! RUN!!
    • View Profile
    • My Portfolio
Re: Swapping Textures (skin tone)
« Reply #3 on: Jan 22, 13, 01:30:04 PM »

Sounds good! I will start exporting out Head parts for the diffuse option choices for Character Creation. Each head is going to need its own material too, which is going to add to the load. And, if I want skin tones on each 'diffuse choice' I think they will each need their own texture bank folder for every head part. LoL, it could get expensive.

I love the material override function. Is it possible to have something later on in future builds for character parts where you can assign different materials on one mesh? Just curious. I am sure there are tons of things to consider running in the background of HE already that I don't understand which makes this a hard question to answer.
« Last Edit: Jan 22, 13, 01:32:33 PM by grogbro »
Logged

Triplelexx

  • World Owners
  • ****
  • Posts: 23
    • View Profile
Re: Swapping Textures (skin tone)
« Reply #4 on: Jan 22, 13, 05:55:40 PM »

I was thinking about selecting ethnicity in the character creation system, Caucasian, Asian e.t.c.

This seems like a good way to get more variation using the 3 way skin blend.
Logged

grogbro

  • World Owners
  • ****
  • Posts: 117
  • ZOMBIES! YAY! RUN!!
    • View Profile
    • My Portfolio
Re: Swapping Textures & SkinTones
« Reply #5 on: Jan 24, 13, 12:44:38 AM »

The Dynamic Texture system is great. It works awesome for skins tones. But there is no way to swap multiple textures on 1 mesh. As mentioned before, the only way to do it is you have 1 mesh for every material. If you want 20 textures to swap on your head model, export that head (as a part) 20 times with different materials.   :'(

I guess this is resolved! hehe