TTK-Bandit@Posted: Thu May 29, 2008 5:37 pm :
hey
currently I'm adding a texture via blend to a model like this:
Code:
..
    {
        nopicmip
        blend   blend
        map     models/bla.tga
    }
..

the image has its alpha channel.. but since I have multiple of these stages in one shader, which use all the same texture, just a different alpha channel, would it be possible to have the alpha channel in a different file ?



rich_is_bored@Posted: Fri May 30, 2008 6:06 am :
Use the maskcolor and maskalpha keywords.



TTK-Bandit@Posted: Fri May 30, 2008 11:38 am :
thanx..
though I can't get it to work...
my code:
Code:
    {
        nopicmip
        blend   blend
        map     basetexture.tga
        color   1, 0, 0, 1 // red
    }
    // first mask
    {
        maskcolor
        map alpha1.tga
    }
    {
        nopicmip
        blend blend
        maskalpha
        map texture.tga
        color   0, 1, 0, 1 // green
    }
    // second mask
    {
        maskcolor
        map alpha2.tga
    }
    {
        nopicmip
        blend blend
        maskalpha
        map texture.tga
        color   0, 0, 1, 1 // blue
    }

now what happens: the blue stage is drawn all over the model, alpha images seem to be completely ignored..
had the alpha images as normal textures first, then I added it to the alpha channel as well, but still wouldn't work.



simulation@Posted: Fri May 30, 2008 12:30 pm :
Not sure that maskalpha and maskcolor will do what you want here. I think they just prevent a channel from being written to "dst".

If your red, green and blue textures all have zeros in the alpha channel (or no perhaps no alpha?) and you could try this..
Code:
{
    blend    blend
    map      add(red_texture.tga, alpha.tga)
    rgba     1,0,0,1
}
{
    blend    blend
    map      add(green_texture.tga, alpha.tga)
    rgba     0,1,0,1
}
{
    blend    blend
    map      add(blue_texture.tga, alpha.tga)
    rgba     0,0,1,1
}
No idea of this works, I'm not in a position to test right this second.



TTK-Bandit@Posted: Fri May 30, 2008 1:08 pm :
thanx, at least partial success.. it does work.. but only if both texture.tga and alpha.tga are RGBA images,
which costs a lot of space, any way to do it with RGB for texture.tga and Grayscale for alpha.tga ?



simulation@Posted: Fri May 30, 2008 1:55 pm :
TTK-Bandit wrote:
thanx, at least partial success.. it does work.. but only if both texture.tga and alpha.tga are RGBA images,
which costs a lot of space, any way to do it with RGB for texture.tga and Grayscale for alpha.tga ?


Probably not, if you've tried and it didn't work. When you talk of 'cost' do you mean purely on disk space? The final three compostite "map" textures will be red+alpha, green+alpha and blue+alpha and will each take up the same space irrespective of how they are generated.

I'm pretty sure these add() maps must be created when the stage is parsed during first use of the material and don't change from that point on. The constituent four images can then be discarded from whatever resource pool manages images as they're no longer needed in their own right. I'm assuming that things work in this way, as it would explain why the scale() function will only accept constants for its scale factors; this implies a "one off" process to me.

Edit: Just re-read your post and I think I may have missed something. Are the three "coloured" textures the same physical TGA or are you attempting to blend the RGB channels from three seperate images? I'm assuming the latter, otherwise you could just use one RGBA image for everything and this wouldn't be an issue.



lowdragon@Posted: Fri May 30, 2008 1:59 pm :
wouldnt it work by define an alpha stage and blend the textures in, like
Code:
// ..
{
blend gl_zero, gl_one
map makeAlpha (path/to/texture) //rgb image 1
}
{
blend gl_one, gl_one_minus_src_alpha
diffusemap (path/to/texture)
}
// ..



TTK-Bandit@Posted: Fri May 30, 2008 2:00 pm :
yeah, talking about diskspace.. I don't want my mod to grow too much in size, it is already pretty big.



simulation@Posted: Fri May 30, 2008 2:32 pm :
TTK-Bandit wrote:
yeah, talking about diskspace.. I don't want my mod to grow too much in size, it is already pretty big.

Yes, I'm doing a texture elimination exercise to make EMZ smaller in the next release. Anything non-essential that was just put in "because we can" is being ditched.



TTK-Bandit@Posted: Fri May 30, 2008 5:04 pm :
simulation wrote:
Edit: Just re-read your post and I think I may have missed something. Are the three "coloured" textures the same physical TGA or are you attempting to blend the RGB channels from three seperate images? I'm assuming the latter, otherwise you could just use one RGBA image for everything and this wouldn't be an issue.

I have one texture file, that is colored by the material, and 2 alpha files to select what is drawn in what color.
in other words, I want to draw different parts of one image in different colors.. so no it's not possible with one rgba file.

@lowdragon:
no, doesn't work, seems like alpha is a full white image then.



6th Venom@Posted: Fri May 30, 2008 5:54 pm :
TTK-Bandit wrote:
I have one texture file, that is colored by the material, and 2 alpha files to select what is drawn in what color.
in other words, I want to draw different parts of one image in different colors.. so no it's not possible with one rgba file.

I think you could achieve this with a RGBA texture that basicly represent your AColor and Bcolor in white plus the alpha channel, then you could substract 2 different "filter" passes, one for the AColor, and the other one for BColor.

Just keep in mind that you must substract the inverted color you want:
Red = White - (Blue + Green) => so to make your Acolor become Red, you must "filter" a turquoise color.

Also remember that everything that MUST NOT be affected by the filter map must be white (white will never be substracted in "filter" stages of a material)



TTK-Bandit@Posted: Fri May 30, 2008 7:46 pm :
ah, now I get it.. that sounds like it could work, I'm going to try it, thanx.



TTK-Bandit@Posted: Fri May 30, 2008 9:04 pm :
hm tried the following:
made an RGBA image, which had the alpha data from part1 in the red channel and the alpha data from part 2 in the green channel, and the alpha channel was used for the texture to be colored..
as long as I would want to use only predefined colors, this would probably work, but the colors I want to use here are not predefined, they are passed via shaderparms, and when I try to modify the color afterwards, then I can only get shades of red or green, depending on what channel I used for the part to be colored...
on the other hand, I dont have much of a clue how to use the blending functions, so I guess Im probably just too stupid to find out the right way :\
help?



6th Venom@Posted: Fri May 30, 2008 10:36 pm :
You should do something like this:
download/file.php?mode=view&id=111
pict1.png
(FINAL is what you should have in D3, with a material that blend/diffuse the RGBA pict, then a Filter 1 and a Filter 2)
:wink:



TTK-Bandit@Posted: Sat May 31, 2008 12:15 am :
how am I supposed to create a filter like that using shaderparms?
when using the color keyword, white parts get colored, the only way I could imagine this to work is with 2 stages just for the filter, one for the color and one for the white part.. but I dont think thats what you meant, right?



simulation@Posted: Sat May 31, 2008 8:30 am :
TTK-Bandit wrote:
how am I supposed to create a filter like that using shaderparms?
when using the color keyword, white parts get colored, the only way I could imagine this to work is with 2 stages just for the filter, one for the color and one for the white part.. but I dont think thats what you meant, right?


It would be useful (to me at least) if you described what it is you are trying to achieve; in words - without reference to channels, alphas etc. "I have a model and I want to texture it in this way..." sort of thing. Mockup results may be useful too.



LDAsh@Posted: Sat May 31, 2008 10:26 am :
Doom3 engine is very specific about how it does alphas anyway, you need to keep in mind if you expect your surface to glow-in-the-dark and be seen straight through fog or not. If those 2 factors aren't an issue, you can do a lot. If you care about light and fog, however, you are restricted to just a couple of methods and you can probably just forget all about any fancy blends, you probably have the wrong engine. And especially if you expect bumpmapping on your surface, you will go around in circles until you finally join the rest of us here at Station Alphatest. :P
If you figure out how to softly blend one alpha'd bumpmapped surface into another, you will be famous among idtech4 developers forever.



TTK-Bandit@Posted: Sat May 31, 2008 10:42 am :
ok, I have a model, which has a basic skin. this skin is used om the diffusemap.
then I have 3 parts on the skin, which I want to color dynamicly, i.e. I set shaderparms via game dll.
they use the same skin(not the diffusemap), but different areas which should get colored.

@LDAsh: That's ok, bumpmaps/lighting is supposed to go away, i.e. it should stand out.



6th Venom@Posted: Sat May 31, 2008 12:09 pm :
I don't understand what you call "skin"...

1) Technically, Doom3 skins are just a way to change materials applied on a model by another material.
This is helpfull to have different versions of the same monster without the need to remake the exactly same model:
Classic IMP (grey) <=> Hell IMP (more orange with burned flesh)

2) Model's skin is the way your bones are connected/applied/parented to your 3d model, in your 3d application (like max/maya/blender/etc)

It seems you call "skin" something else, like the skin color of you character?



TTK-Bandit@Posted: Sat May 31, 2008 2:31 pm :
skin is the texture you put on a model.
bones don't have anything to do with the skin, they change the appearance of the polygons on the model.
at least that's what it was in the old generation of games.

but meh, with newer games it is hard to tell since all definitions got dumped..
in q3, materials where called shaders, doom3 says skins are just a replacement config for materials, whats next.. models get renamed to volumes ?



TTK-Bandit@Posted: Mon Jun 02, 2008 10:02 pm :
well technically this is what I wanted, but my skins are supposed to be brightskins, so lighting should not affect them too much.



TTK-Bandit@Posted: Thu May 29, 2008 5:37 pm :
hey
currently I'm adding a texture via blend to a model like this:
Code:
..
    {
        nopicmip
        blend   blend
        map     models/bla.tga
    }
..

the image has its alpha channel.. but since I have multiple of these stages in one shader, which use all the same texture, just a different alpha channel, would it be possible to have the alpha channel in a different file ?



rich_is_bored@Posted: Fri May 30, 2008 6:06 am :
Use the maskcolor and maskalpha keywords.



TTK-Bandit@Posted: Fri May 30, 2008 11:38 am :
thanx..
though I can't get it to work...
my code:
Code:
    {
        nopicmip
        blend   blend
        map     basetexture.tga
        color   1, 0, 0, 1 // red
    }
    // first mask
    {
        maskcolor
        map alpha1.tga
    }
    {
        nopicmip
        blend blend
        maskalpha
        map texture.tga
        color   0, 1, 0, 1 // green
    }
    // second mask
    {
        maskcolor
        map alpha2.tga
    }
    {
        nopicmip
        blend blend
        maskalpha
        map texture.tga
        color   0, 0, 1, 1 // blue
    }

now what happens: the blue stage is drawn all over the model, alpha images seem to be completely ignored..
had the alpha images as normal textures first, then I added it to the alpha channel as well, but still wouldn't work.



simulation@Posted: Fri May 30, 2008 12:30 pm :
Not sure that maskalpha and maskcolor will do what you want here. I think they just prevent a channel from being written to "dst".

If your red, green and blue textures all have zeros in the alpha channel (or no perhaps no alpha?) and you could try this..
Code:
{
    blend    blend
    map      add(red_texture.tga, alpha.tga)
    rgba     1,0,0,1
}
{
    blend    blend
    map      add(green_texture.tga, alpha.tga)
    rgba     0,1,0,1
}
{
    blend    blend
    map      add(blue_texture.tga, alpha.tga)
    rgba     0,0,1,1
}
No idea of this works, I'm not in a position to test right this second.



TTK-Bandit@Posted: Fri May 30, 2008 1:08 pm :
thanx, at least partial success.. it does work.. but only if both texture.tga and alpha.tga are RGBA images,
which costs a lot of space, any way to do it with RGB for texture.tga and Grayscale for alpha.tga ?



simulation@Posted: Fri May 30, 2008 1:55 pm :
TTK-Bandit wrote:
thanx, at least partial success.. it does work.. but only if both texture.tga and alpha.tga are RGBA images,
which costs a lot of space, any way to do it with RGB for texture.tga and Grayscale for alpha.tga ?


Probably not, if you've tried and it didn't work. When you talk of 'cost' do you mean purely on disk space? The final three compostite "map" textures will be red+alpha, green+alpha and blue+alpha and will each take up the same space irrespective of how they are generated.

I'm pretty sure these add() maps must be created when the stage is parsed during first use of the material and don't change from that point on. The constituent four images can then be discarded from whatever resource pool manages images as they're no longer needed in their own right. I'm assuming that things work in this way, as it would explain why the scale() function will only accept constants for its scale factors; this implies a "one off" process to me.

Edit: Just re-read your post and I think I may have missed something. Are the three "coloured" textures the same physical TGA or are you attempting to blend the RGB channels from three seperate images? I'm assuming the latter, otherwise you could just use one RGBA image for everything and this wouldn't be an issue.



lowdragon@Posted: Fri May 30, 2008 1:59 pm :
wouldnt it work by define an alpha stage and blend the textures in, like
Code:
// ..
{
blend gl_zero, gl_one
map makeAlpha (path/to/texture) //rgb image 1
}
{
blend gl_one, gl_one_minus_src_alpha
diffusemap (path/to/texture)
}
// ..



TTK-Bandit@Posted: Fri May 30, 2008 2:00 pm :
yeah, talking about diskspace.. I don't want my mod to grow too much in size, it is already pretty big.



simulation@Posted: Fri May 30, 2008 2:32 pm :
TTK-Bandit wrote:
yeah, talking about diskspace.. I don't want my mod to grow too much in size, it is already pretty big.

Yes, I'm doing a texture elimination exercise to make EMZ smaller in the next release. Anything non-essential that was just put in "because we can" is being ditched.



TTK-Bandit@Posted: Fri May 30, 2008 5:04 pm :
simulation wrote:
Edit: Just re-read your post and I think I may have missed something. Are the three "coloured" textures the same physical TGA or are you attempting to blend the RGB channels from three seperate images? I'm assuming the latter, otherwise you could just use one RGBA image for everything and this wouldn't be an issue.

I have one texture file, that is colored by the material, and 2 alpha files to select what is drawn in what color.
in other words, I want to draw different parts of one image in different colors.. so no it's not possible with one rgba file.

@lowdragon:
no, doesn't work, seems like alpha is a full white image then.



6th Venom@Posted: Fri May 30, 2008 5:54 pm :
TTK-Bandit wrote:
I have one texture file, that is colored by the material, and 2 alpha files to select what is drawn in what color.
in other words, I want to draw different parts of one image in different colors.. so no it's not possible with one rgba file.

I think you could achieve this with a RGBA texture that basicly represent your AColor and Bcolor in white plus the alpha channel, then you could substract 2 different "filter" passes, one for the AColor, and the other one for BColor.

Just keep in mind that you must substract the inverted color you want:
Red = White - (Blue + Green) => so to make your Acolor become Red, you must "filter" a turquoise color.

Also remember that everything that MUST NOT be affected by the filter map must be white (white will never be substracted in "filter" stages of a material)



TTK-Bandit@Posted: Fri May 30, 2008 7:46 pm :
ah, now I get it.. that sounds like it could work, I'm going to try it, thanx.



TTK-Bandit@Posted: Fri May 30, 2008 9:04 pm :
hm tried the following:
made an RGBA image, which had the alpha data from part1 in the red channel and the alpha data from part 2 in the green channel, and the alpha channel was used for the texture to be colored..
as long as I would want to use only predefined colors, this would probably work, but the colors I want to use here are not predefined, they are passed via shaderparms, and when I try to modify the color afterwards, then I can only get shades of red or green, depending on what channel I used for the part to be colored...
on the other hand, I dont have much of a clue how to use the blending functions, so I guess Im probably just too stupid to find out the right way :\
help?



6th Venom@Posted: Fri May 30, 2008 10:36 pm :
You should do something like this:
download/file.php?mode=view&id=111
pict1.png
(FINAL is what you should have in D3, with a material that blend/diffuse the RGBA pict, then a Filter 1 and a Filter 2)
:wink:



TTK-Bandit@Posted: Sat May 31, 2008 12:15 am :
how am I supposed to create a filter like that using shaderparms?
when using the color keyword, white parts get colored, the only way I could imagine this to work is with 2 stages just for the filter, one for the color and one for the white part.. but I dont think thats what you meant, right?



simulation@Posted: Sat May 31, 2008 8:30 am :
TTK-Bandit wrote:
how am I supposed to create a filter like that using shaderparms?
when using the color keyword, white parts get colored, the only way I could imagine this to work is with 2 stages just for the filter, one for the color and one for the white part.. but I dont think thats what you meant, right?


It would be useful (to me at least) if you described what it is you are trying to achieve; in words - without reference to channels, alphas etc. "I have a model and I want to texture it in this way..." sort of thing. Mockup results may be useful too.



LDAsh@Posted: Sat May 31, 2008 10:26 am :
Doom3 engine is very specific about how it does alphas anyway, you need to keep in mind if you expect your surface to glow-in-the-dark and be seen straight through fog or not. If those 2 factors aren't an issue, you can do a lot. If you care about light and fog, however, you are restricted to just a couple of methods and you can probably just forget all about any fancy blends, you probably have the wrong engine. And especially if you expect bumpmapping on your surface, you will go around in circles until you finally join the rest of us here at Station Alphatest. :P
If you figure out how to softly blend one alpha'd bumpmapped surface into another, you will be famous among idtech4 developers forever.



TTK-Bandit@Posted: Sat May 31, 2008 10:42 am :
ok, I have a model, which has a basic skin. this skin is used om the diffusemap.
then I have 3 parts on the skin, which I want to color dynamicly, i.e. I set shaderparms via game dll.
they use the same skin(not the diffusemap), but different areas which should get colored.

@LDAsh: That's ok, bumpmaps/lighting is supposed to go away, i.e. it should stand out.



6th Venom@Posted: Sat May 31, 2008 12:09 pm :
I don't understand what you call "skin"...

1) Technically, Doom3 skins are just a way to change materials applied on a model by another material.
This is helpfull to have different versions of the same monster without the need to remake the exactly same model:
Classic IMP (grey) <=> Hell IMP (more orange with burned flesh)

2) Model's skin is the way your bones are connected/applied/parented to your 3d model, in your 3d application (like max/maya/blender/etc)

It seems you call "skin" something else, like the skin color of you character?



TTK-Bandit@Posted: Sat May 31, 2008 2:31 pm :
skin is the texture you put on a model.
bones don't have anything to do with the skin, they change the appearance of the polygons on the model.
at least that's what it was in the old generation of games.

but meh, with newer games it is hard to tell since all definitions got dumped..
in q3, materials where called shaders, doom3 says skins are just a replacement config for materials, whats next.. models get renamed to volumes ?



LDAsh@Posted: Sat May 31, 2008 3:08 pm :
Yeah, "skins" were "textures on models" for Quake 2, official terminology from the game itself. It's hard to keep up sometimes.

Are there any examples of what you're trying to do in some other games? I think I understand now what you want, and maybe how to do it, but not as optimised as you might like it. You may need to use 3 different images for your different circles. Also, I don't understand the relation between "blend skin" and "final", it seems like you want a double-transparency, one draws to background and one draws to a different texture? I'm pretty sure that's impossible, you'd need some kind of "matte" shader to draw 2 different transparencies, let alone doing it in just 1 material. You might need to settle on using 3 different blends and 3 different images.

Maybe if you upload your assets and mockup for us to check out, there might be a better solution.



TTK-Bandit@Posted: Sat May 31, 2008 4:07 pm :
I'll try to explain it with math equation:
finalimage = diffusemap + BlendA * BlendSkin + BlendB * BlendSkin + BlendC * BlendSkin.
so I want the Blendskin to be added (with a color) to the final image, but only the parts that are specified via blendA/B/C
sorry, this is hard to explain..
I'll try it this way:
imagine the diffusemap was a wall texture, and BlendSkin would have these 3 words on it: Give, Me, Money.
now the BlendA texture would have white pixels at the position of the word Give, same for BlendB => Me, and BlendC => Money.
Now the final image would produce a wall texture with the 3 words on it, but each word in a different color.



6th Venom@Posted: Sat May 31, 2008 4:53 pm :
So what's wrong with a brick diffuse map, and 3 add maps for Give, Me and Money with parms for RGB values?
(Where the words are white on black, and parms define their colors)



TTK-Bandit@Posted: Sat May 31, 2008 7:18 pm :
the size of it is the problem.. if I do it this way I need 4 32bit tga files, which are 4megs each.
it is a waste of space having 4 32bit tga files when all I use is the 3 alpha channels and one rgb(24bit) image.



6th Venom@Posted: Sun Jun 01, 2008 8:59 am :
You can't use multiple different alpha on a single material in D3/Q4 (i think).
But why would you need alphas on materials' Add stages?

If i remember correctly, if you define diffusemap first (the one with the alpha channel), every material' stages after will "use" this alpha.
Just look at some D3 materials used on mapobjects that only have an alpha on the diffusemap, and not on the specular / bumpmap.



simulation@Posted: Sun Jun 01, 2008 9:15 am :
TTK-Bandit wrote:
ok, I have a model, which has a basic skin. this skin is used om the diffusemap.
then I have 3 parts on the skin, which I want to color dynamicly, i.e. I set shaderparms via game dll.
they use the same skin(not the diffusemap), but different areas which should get colored.

@LDAsh: That's ok, bumpmaps/lighting is supposed to go away, i.e. it should stand out.


So you're using 9 shaderparms to color the area marked as "Blend A", "Blend B" and "Blend C" with three different RGB values? Where does the color for the rest of the surface come from, or do "A", "B" and "C" constitute all of it?



TTK-Bandit@Posted: Sun Jun 01, 2008 9:41 am :
>So you're using 9 shaderparms to color the area marked as "Blend A", "Blend B" and "Blend C" with three different RGB values?
Yes!

>Where does the color for the rest of the surface come from, or do "A", "B" and "C" constitute all of it?
Well first layer is a diffusemap, which is precolored, no dynamic coloring needed.
Then the 3 color layers will be added on top of the diffusemap.

edit: current code looks like this:
Code:
models/mytex
{
    noSelfShadow
    unSmoothedTangents

    {
        nopicmip
        blend   diffusemap
        map   models/mytex_d.tga
    }

    bumpmap addnormals ( models/mytex_local.tga, heightmap ( models/mytex_h.tga, 2 ))
    specularmap   models/mytex_s.tga

    {
        nopicmip
        blend blend
        map add(models/mytex_maskbase.tga, models/mytex_mask1.tga)
        color   Parm0, Parm1, Parm2, Parm11
    }
    {
        nopicmip
        blend blend
        map add(models/mytex_maskbase.tga, models/mytex_mask2.tga)
        color   Parm3, Parm4, Parm5, Parm11
    }
    {
        nopicmip
        blend blend
        map add(models/mytex_maskbase.tga, models/mytex_mask3.tga)
        color   Parm8, Parm9, Parm10, Parm11
    }
}

Technically it works perfect, but it takes up too much hdd space



6th Venom@Posted: Sun Jun 01, 2008 1:02 pm :
Are the Dynamic A B C colors only fading colors (Red to black, black to Red), or let say A is Red and go to Blue then to Purple etc?
If it the first case, you probably could use only one parm with maths for each add stages.

Could we see what looks like models/mytex_maskbase.tga and models/mytex_mask1.tga?
Did you tried to just remove the alpha channel of A B C and try like that?
Code:
    {
        nopicmip
        blend add
        map models/mytex_maskbase2.tga
        color   Parm3, Parm4, Parm5, Parm11
    }



simulation@Posted: Sun Jun 01, 2008 1:08 pm :
If you combine the three "masks" into an RGB so you could try something like this...
Code:
models/mytex
{
    noSelfShadow
    unSmoothedTangents

    {
        nopicmip
        blend   diffusemap
        map   models/mytex_d.tga
    }

    bumpmap addnormals ( models/mytex_local.tga, heightmap ( models/mytex_h.tga, 2 ))
    specularmap   models/mytex_s.tga

    {
        nopicmip
        blend blend
        // use the red channel for this stage
        map makeAlpha(scale(models/mytex_RGBmask.tga,1,0,0,1))
        color   Parm0, Parm1, Parm2, Parm11
    }
    {
        nopicmip
        blend blend
        // use the green channel for this stage
        map makeAlpha(scale(models/mytex_RGBmask.tga,0,1,0,1))
        color   Parm3, Parm4, Parm5, Parm11
    }
    {
        nopicmip
        blend blend
        // use the blue channel for this stage
        map makeAlpha(scale(models/mytex_RGBmask.tga,0,0,1,1))
        color   Parm8, Parm9, Parm10, Parm11
    }
}

You may need to mess with the values in 'scale' because makeAlpha() is an average, so you may need to scale them by three instead of one to counter balance that.

Sim



TTK-Bandit@Posted: Mon Jun 02, 2008 8:44 am :
@6th Venom:
A/B/C can get any rgb values.
Problem with 'blend add' is, that it does not take alpha into account, but it depends on how black the pixel is.
But I want dark colors to be possible too.

here's what the images look like:
Diffusemap
Blend Skin
Blend A
Blend B
Blend C
This is the result I want

@simulation:
nice idea, but it does not add much, i.e. it looks like it has very low alpha. and when I raise the scale to 3, it somehow loses information, stuff that was colored with scale 1 is not colored anymore.

looks like this:
RGB Blend Texture
Resulting Image (scale 1)



LDAsh@Posted: Mon Jun 02, 2008 9:29 am :
In terms of decals, this blend will do darks and brights together using middle-gray as transparent - "blend GL_DST_COLOR, GL_SRC_COLOR" (may need "translucent"/"decal_macro" keywords in the material though)
I don't think you will get this multiple alpha thing working, to be honest, but I've never tried anything like this either. You are actually using it for player colour customisations on the vanilla Q4 characters? That would explain why you can't layer the conflicting materials, and why you want to keep the texture use down. It's a very interesting concept, if it ends up working.



TTK-Bandit@Posted: Mon Jun 02, 2008 9:54 am :
>In terms of decals, this blend will do darks and brights together using middle-gray as transparent...
hm that sounds like I would have to predefine which colors would be dark, and which bright..

>You are actually using it for player colour customisations on the vanilla Q4 characters?
Not just vanilla characters, but yeah

>It's a very interesting concept, if it ends up working.
well as said, it does already work, but it needs 32bit images for Blend Skin,Blend A/B/C, which is 128bits total, while the actually used bits are only 48.
and with 1024x1024px tga files, this is 6MB vs 16MB (and this is with dds files not taken into account yet)



simulation@Posted: Mon Jun 02, 2008 12:05 pm :
TTK-Bandit wrote:
@simulation:
nice idea, but it does not add much, i.e. it looks like it has very low alpha. and when I raise the scale to 3, it somehow loses information, stuff that was colored with scale 1 is not colored anymore.


How about applying a scale() after the makeAlpha() too?


scale(makeAlpha(scale(filename.tga,1,0,0,1)),1,1,1,3) ?



TTK-Bandit@Posted: Mon Jun 02, 2008 3:04 pm :
nice, that seems to work.. I get a few artifacts, but that might be due to the quickly made rgb image.
I will rebuild it more clean and tell you if it's good.
Thanks :)



6th Venom@Posted: Mon Jun 02, 2008 4:25 pm :
Remember seen that?
Image
Image
(from my mainmenu...)

The player's material's code was...
Code:
models/characters/marine/vmarine_default
{
   noSelfShadow
   unsmoothedTangents
   flesh
   forceOverlays
   clamp
   collision

   {   // burning corpse effect
      if   parm7         // only when dead
      // make a burned away alpha test for the normal skin
      blend   gl_zero, gl_one         // don't draw anything
      
      map models/monsters/spectre/dis2.tga   // replace this with a monster-specific texture
      alphaTest 0.05 + 1.7 * (time - parm7)
   }

        diffusemap     models/characters/menu_mplayer/marine_color0.tga

   {
      blend   diffusemap
      
      map     models/characters/menu_mplayer/marine_color1.tga
                red     0.59
                green   0.54
                blue    0.37
   }

   {
      blend   diffusemap
      
      map     models/characters/menu_mplayer/marine_color2.tga
                red     0.14
                green   0.14
                blue    0.14
   }

   bumpmap        addnormals(models/characters/male_npc/marine/marine_local.tga, heightmap(models/characters/male_npc/marine/marine_h.tga, 10 ) )

   {
      blend   specularmap
      
      map     models/characters/male_npc/marine/marine_s.tga
                red     1
                green   1
                blue    1
   }

   {
      blend   specularmap
      
      map     models/characters/male_npc/marine/marine_s.tga
                red     1
                green   1
                blue    1
   }

}

...and...

models/characters/marine/vmarine_orange1
{
   noSelfShadow
   unsmoothedTangents
   flesh
   forceOverlays
   clamp
   collision

   {   // burning corpse effect
      if   parm7         // only when dead
      // make a burned away alpha test for the normal skin
      blend   gl_zero, gl_one         // don't draw anything
      
      map models/monsters/spectre/dis2.tga   // replace this with a monster-specific texture
      alphaTest 0.05 + 1.7 * (time - parm7)
   }

        diffusemap     models/characters/menu_mplayer/marine_color0.tga

   {
      blend   diffusemap
      
      map     models/characters/menu_mplayer/marine_color1.tga
                red     0.5
                green   0.3
                blue    0.05
   }

   {
      blend   diffusemap
      
      map     models/characters/menu_mplayer/marine_color2.tga
                red     0.35
                green   0.2
                blue    0.05
   }

   bumpmap        addnormals(models/characters/male_npc/marine/marine_local.tga, heightmap(models/characters/male_npc/marine/marine_h.tga, 10 ) )

   {
      blend   specularmap
      
      map     models/characters/male_npc/marine/marine_s.tga
                red     1
                green   1
                blue    1
   }

   {
      blend   specularmap
      
      map     models/characters/male_npc/marine/marine_s.tga
                red     1
                green   1
                blue    1
   }

}

...and as you noticed, multiple declarations of diffuse, specular and bump are OK!
the only problem is that the game multiply/add each declaration's color by the others, so i used the same textures as your A B C, and red+black+black=red, black+blue+black=blue, etc...

...and light interactions work like usually. (not like with blend)

Edit: Download my mod and look at textures, materials etc to understand it better if needed.



TTK-Bandit@Posted: Mon Jun 02, 2008 6:32 pm :
nice, though not what I need.
@simulation:
there is a problem with slightly overlapping color channels, those pixels get a mixed color,
which is at some points pretty obvious and ugly to look at, but It should be possible to remove those, just a lot of work :D



simulation@Posted: Mon Jun 02, 2008 7:46 pm :
TTK-Bandit wrote:
nice, though not what I need.
@simulation:
there is a problem with slightly overlapping color channels, those pixels get a mixed color,
which is at some points pretty obvious and ugly to look at, but It should be possible to remove those, just a lot of work :D


Yeah, coders doing texture editing is never a joy to behold ;) I have that pleasure to come on the RGB skins and proskins for my new player models soon!

On the subject of mutiple/repeated stages there is a good description of how the renderer handles them on http://www.iddevnet.com/doom3/ (scroll down to "11/12/04 Rendering Order").

Sim



6th Venom@Posted: Mon Jun 02, 2008 7:54 pm :
TTK-Bandit wrote:
nice, though not what I need.

Sorry for missunderstood so, cause i really thought that you tried to have 3 separates textures (and/or colors) shared by the same model (player), and dynamicly customizable by players... like so:
Attachment:
shot00002.png
shot00002.png [ 253.37 KB | Viewed 259 times ]

That's what i did.

So, you try to do something like that but absolutly "blended"?



simulation@Posted: Mon Jun 02, 2008 8:10 pm :
Yes, this IS what Bandit is doing. But he does not want the disk space cost of having individual TGA and DDS files for every map.

One question Venom (I can't check your mod again now, I'm not at my desktop) but how do you handle having two selectable colour elements in an "assets only" mod - i.e., without SDK changes to allow different values for ui_skin and mod_validSkins?



6th Venom@Posted: Mon Jun 02, 2008 8:28 pm :
I... do not!
This technique was made while i was thinking of making a Denton version with some skin modifications to allow Clans to choose "more" colors / combinations.
In a time i was also thinking of a way to secretly put the 2 colors informations at the start of the player's name like:

Name= "^1^6^06th Venom"

where ^1 is the firstcolor and ^6 the secondcolor.
^0 just bring back colors to normal before displaying the "real" player's name as "6th Venom" for other players.

Somehow, the mainmenu and Guis would have catch these 2 colors and displayed these.

...i never go further. :D



TTK-Bandit@Posted: Mon Jun 02, 2008 10:02 pm :
well technically this is what I wanted, but my skins are supposed to be brightskins, so lighting should not affect them too much.