Jump to content

Calling all shader experts! RGB Skins + cull twosided???


Go to solution Solved by Ruxith,

Recommended Posts

Hello,

 

I'm currently looking to expand on Loda's RGB Skins (http://jediknight3.filefront.com/file/RGB_Base_Skins;94323) and include RGB functionality for all of the default player models. I've run into a road block with Chewbacca though. An alpha shader is used on his fur to make part of the texture clear/invisible, resulting in the spikey hair all over his body. However, I want to be able to use the same alpha channel to allow for RGB. I've been having a lot of trouble combining these two features.

 

Below are the original shaders for Chewbacca. These are found in assets1.pk3 > shaders > players.shader

models/players/chewbacca/chewbacca_2sided
{
	cull	twosided
    {
        map models/players/chewbacca/chewbacca_2sided
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen lightingDiffuse
    }
}

models/players/chewbacca/chewbacca_1sided
{
	cull	twosided
    {
        map models/players/chewbacca/chewbacca_1sided
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen lightingDiffuse
    }
}

Here's what I have for the RGB skin.

models/players/chewbacca/tint_chewbacca_1sided
{
    {
        map models/players/chewbacca/tint_chewbacca_1sided
        rgbGen lightingDiffuseEntity
    }
	cull	twosided
    {
        map models/players/chewbacca/tint_chewbacca_1sided
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        detail
        rgbGen lightingDiffuse
    }
}

models/players/chewbacca/tint_chewbacca_2sided
{
	cull	twosided
    {
        map models/players/chewbacca/tint_chewbacca_2sided
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/chewbacca/tint_chewbacca_2sided
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        detail
        rgbGen lightingDiffuse
    }
}

Basically, I have two main questions:

1. Is what I'm trying to do even possible?

2. If it is possible, can you point out for me what is wrong with my shader file?

 

Thanks in advance!

Link to comment

Hey rad :)

 

So the bottom one is replacing the default one? You're specifying a totally different shader and texture with the bottom one. The path pointing to the models/players/chewbacca/tint_chewbacca_2sided should still be the original path, if I'm understanding correctly. And there should be a tint_chewbacca_2sided texture in that path, no?

 

Perhaps @@Ruxith or @@DT85 or others could be more help

Link to comment

Hey Circa!

 

The bottom two shaders are for the tint_chewbacca_1sided.tga and tint_chewbacca_2sided.tga textures to be used in the RGB skin. So, they will not replace the original shaders. This way you'll have chewbacca/default, chewbacca/red and chewbacca/blue like normal, but you'll also have chewbacca/rgb as a player model to use. I believe that the textures are in order, though if someone wants to look at them I can provide the image files.

 

The problem seems to be in how I'm using the alpha shader. I want to use it to do both the cull twosided and RGB functionalities.

Link to comment

No, you can't use RGB skins in team gametypes. If your model was chewbacca/default or chewbacca/rgb and you switch to TFFA/CTF/Siege, it will actually display chewbacca/red or chewbacca/blue depending on which team you're on. And you can't use a blue skin on the red team!  :P This would primarily be for use in the FFA or duel game modes.

Link to comment

I'm not really sure what you mean. If I use a species skin (default or custom) during a TFFA, I can choose my model's RGB colors from the options available and verify that the RGB values aren't 255 255 255 with /char_color_red, /char_color_green, /char_color_blue console commands. For example if I choose a blue color, then i get R=85, G=120, B=255, but in-game this is still displayed as red if I am on the red team. For the non-species models, it seems that it just uses the appropriate team skin, model/red or model/blue, if those skins are available. The RGB values appear to be unaffected. I'm curious about if a non-species model without team skins (like jawa) but with an RGB skin would allow you to change colors, or if it sets you to model/default...

Link to comment
  • Solution

Basically, in a team game you either need model_blue.skin/model_red.skin files, or your skin needs to have RGB and be inside a folder starting with "jedi_<name>" if you want team colours to work; the "jedi_<name>" solution is only for RGB skins, and the team skin files are for non-RGB skins.

 

You don't necessarily need head/torso/lower .skin files/species support or for it to be inside "jedi_<name>" for working RGB in team modes. Actually, if your skin just has rgb and you don't have species support then the RGB will automatically change, it doesn't need to be in "jedi_<name>" folder if I remember correctly, it only does if you have species support. I was testing this myself not long ago.

 

Your texture needs to work from 2 separate images  if you are using transparency. The solution I found is located here. If you have any problems let me know.

Link to comment

After a little bit of trial and error, using two of the same texture to do RGB and transparency worked! :D

 

Here's what my shader files ended up being for the fur textures:

models/players/chewbacca/tint_chewbacca_1sided
{
	cull	twosided
    {
        map models/players/chewbacca/tint_chewbacca_1sided
        blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        detail
        rgbGen lightingDiffuse
    }
    {
        map models/players/chewbacca/tint_chewbacca_1sidedb
	blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        rgbGen lightingDiffuseEntity
    }
}

models/players/chewbacca/tint_chewbacca_2sided
{
	cull	twosided
    {
        map models/players/chewbacca/tint_chewbacca_2sided
        blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        detail
        rgbGen lightingDiffuse
    }
    {
        map models/players/chewbacca/tint_chewbacca_2sidedb
	blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        rgbGen lightingDiffuseEntity
    }
}

I actually had to reverse items on the blendFunc line, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. Maybe that means I did the alpha channels backwards on the textures? In any case, that link gave me what I needed. Thanks Ruxith!

 

chewbacca_rgb.png

 

As for the team skins, I think I'm just going to let it use the default model/blue and model/red skins. But thanks for having those discussions with me, I think I learned a little bit from it!

Link to comment

Just so you understand it all properly, the shader you used, is just the chewbacca shader with the line to enable RGB added on the end. The basically allows transparency in the texture, allows RGB to work for the WHOLE IMAGE, and makes it double-sided because the fur is made with planes? Or flat model pieces which overlap to mimic the idea of fur, with the transparent textures.

 

The shader I concluded with in the topic I linked was to create something based off similar ideas (flat model/double sided, rgb, transparency), however I wanted to isolate a section of the texture to RGB it, not to RGB the whole area of the texture. I should've said that simply adding the line for RGB after the chewbacca shader would've worked but I wasn't sure what you were going for, so I linked my workings and tried to explain it xD

 

Glad you got what you wanted in the end though!

radiuks likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...