Two shader effects on one texture -1 reply

Please wait...

Guest

I didn't make it!

0 XP

 
#1 12 years ago

Is there any way to apply two seperate shader effects onto seperate parts of one texture? Best I've managed so far is one effect on part of the texture and the second effect on the entire thing.




Inyri Forge VIP Member

[Insert User Title Here]

55 XP

15th March 2005

0 Uploads

25,940 Posts

0 Threads

#2 12 years ago

Yes it's possible, but you'll have to be more specific if you want more specific assistance.




Guest

I didn't make it!

0 XP

 
#3 12 years ago

Let's say I'm currently trying to work on reskinning the torso of a model. On the left side I'd like an effect (lets say a nice shine for metal) completley different than the effect on the right side (scrolling lightning across it for example). I do not want either effect applied to the entire torso. I know this can be accomplished if I edited the model (I am truly horrible at 3d modeling and not about to even try this approah), but I want to know if there is a way to do it solely by the use of shaders. So far, the best I've managed is to just apply one of the effects to the apporpiate half, but I don't know how to render the second one so that it does not effect both sides.




Inyri Forge VIP Member

[Insert User Title Here]

55 XP

15th March 2005

0 Uploads

25,940 Posts

0 Threads

#4 12 years ago

Theoretically it can be done with layered shaders. For the example you provided, you would have to apply the lightning shader first, then have a PNG or TGA made with the section you want the shine to be on (the rest should be transparent, so the lightning shader shows through) and this new image will cover up the part you don't want the lightning to be on.

It's more complicated than it sounds, though :lol:. How much do you know about shaders, to begin with? If you know a little bit, it'll be easier to understand.




Guest

I didn't make it!

0 XP

 
#5 12 years ago

This is my second day playing around with the shader's in Jedi Academy, so not much. What you described is pretty much what I did to get one effect, but I'm uncertain how to write the second effect afterwards. When I attempt to draw the second one, it ends up getting applied to the entire torso.

What I have so far: { map models/players/test/torso rgbGen lightingDiffuse } { map gfx/effects/metal blendFunc GL_SRC_ALPHA GL_ONE depthFunc equal tcGen environment } { map models/players/jedi_test/torso_mask alphaFunc GT0 rgbGen lightingDiffuse blendFunc GL_SRC_ALPHA GL_ZERO depthFunc lequal tcGen base }

But if I try to add: { map gfx/effects/lightning001.jpg tcMod scroll 5 1 tcGen environment blendFunc GL_ALPHA GL_ALPHA rgbGen identity } it gets applied to the entire thing.




Kenoiyan

In a creative rush...

50 XP

9th October 2005

0 Uploads

85 Posts

0 Threads

#6 12 years ago

you need a reference before the brackets as to which texture the shader is applied to. just write the hierarchical place of the graphic file like this: before the '{' in a separate line write for example: models/players/idontknowwhat/etc.jpg




Guest

I didn't make it!

0 XP

 
#7 12 years ago

Sorry, I still can't get it. Maybe if someone would be nice enough to post an example for me?




Inyri Forge VIP Member

[Insert User Title Here]

55 XP

15th March 2005

0 Uploads

25,940 Posts

0 Threads

#8 12 years ago

Sorry I didn't get back to you last night. It was so late that I looked at your shader and I think I lost some brain content :lol:

Here's an example of a texture with a specular shader and a chrome shader on only part of the texture. Layer one is chrome, layer two is normal. This'll work for other things, like layer 1 (some effect) and layer two (some other effect).

models/players/jedi_hm/crusader_pants { q3map_nolightmap { map models/players/jedi_hm/crusader_pants_chr blendFunc GL_ONE GL_ZERO rgbGen lightingDiffuse } { map models/players/crusader/chrome blendFunc GL_DST_COLOR GL_SRC_COLOR tcGen environment } { map models/players/jedi_hm/crusader_pants_cl blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen lightingDiffuse } { map models/players/jedi_hm/crusader_pants_spec blendFunc GL_SRC_ALPHA GL_ONE detail alphaGen lightingSpecular } }

crusader_pants_chr was the normal texture, in JPEG format. crusader_pants_cl was the same texture, in PNG format (you can also use TGA) with a piece cut out of it - the piece I wanted to stay chrome. The rest was the part that I wanted to not be chrome.