Jump to content

Shader for glowing RGB texture


Go to solution Solved by Ruxith,

Recommended Posts

I'm not much good at creating my own shaders, so upon editing skins i've come to a halt with creating something that I wanted. Making RGB skins has been my "next stage" of learning reskins, and I have figured that out. But now I want to enable a shader which will change depending on the RGB choices. I have done so with a glow shader I already had, but the glow effect and colour intensity is very pale.

 

I was just wondering if anyone had experimented/created something similar in the past and could put me in the right direction :P as I am unsure if it is part of the code that I have done wrong, or the texture (I followed an existing style and it shouldn't be because of this). I've changed areas both shader and non-shader in the skin, and the area without the glow section has worked fine, so I guess it must be with the code.

 

Below is the screenshot of the shader in-game, and the code I am using;

 

 

 

glows.jpg

 

 

models/players/jedi_kdm/head_2ryo
{
    {
        map models/players/jedi_kdm/head_2ryo
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map gfx/models/jedi_kdm/head_2ryo_glow
        blendFunc GL_ONE GL_ONE
        glow
        rgbGen identity
    }
    {
        map models/players/jedi_kdm/head_2ryo
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA        
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_2ryo_spec
        blendFunc GL_SRC_ALPHA GL_ONE        
        alphaGen lightingSpecular
    }
}

 

 

(Yep, i'm working from ryojin's keldor reskin for anyone who guessed xD ).

Thanks in advance for any brave volunteers!

Link to comment
  • 1 month later...

True, sorry about that I should've given them initially.

Here's the pk3 and the shader in text:

 

http://www.mediafire.com/?mwaaayf581tpe6q

 

 

models/players/jedi_kdm/head_pic

{
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_ONE GL_ZERO        
        glow
        rgbGen lightingDiffuseEntity
    }
    {
        map gfx/models/jedi_kdm/head_pic_spec
        blendFunc GL_SRC_ALPHA GL_ONE        
        alphaGen lightingSpecular
    }
}
 
models/players/jedi_kdm/icon_head_h8
{
    nopicmip
    nomipmaps
    {
        map models/players/jedi_kdm/icon_head_h8
        rgbGen identity
    }
    {
        map models/players/jedi_kdm/icon_head_h8
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen vertex
    }
}
 
models/players/jedi_kdm/icon_piccolo
{
    nopicmip
    nomipmaps
    {
        map models/players/jedi_kdm/icon_piccolo
        rgbGen identity
    }
    {
        map models/players/jedi_kdm/icon_piccolo
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen vertex
    }
}

Link to comment

Arrange it in the below order that will help. I also fixed the blendfunc in the glow section. They probably both work, but that's the one I've had the most success with.

 

What kind of glow are you trying to achieve here? Because you've essentially set it up so the eyes are kind of a dull grey. As far as I can tell it's working, it's just not very pronounced. I tested it by changing the color of just the glow map. Not really sure you're going to be able to have a shader be dynamic like you want.

 

 

models/players/jedi_kdm/head_pic

{
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_spec
        blendFunc GL_SRC_ALPHA GL_ONE        
        alphaGen lightingSpecular
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_SRC_ALPHA GL_ONE
        glow
    }    
}

Link to comment

Thanks for that. On the glow side I don't think it's glowing currently as far as I can see.

This is the glow that I am intending, as you can see alongside the comparison with a screenshot from the code you quoted, where the RGB is working but what doesn't seem to be a glow:

 

BOOxBM2.jpg

 

 

I did test it myself a couple weeks ago by making a few changes in the code to try and understand what they do, and also having @@Milamber look at a few ideas.

I was able to get (what looked to be) the glow working, but it set the head to be completely black, with the RGB eyes glowing (it is dark, but if you up the brightness of the screenshot you can see the red colour has spread around the eyes as it would for a glow);

 

FybjHD1.jpg

 

Which used this code:

 

models/players/jedi_kdm/head_pic

{
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA        
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_spec
        blendFunc GL_SRC_ALPHA GL_ONE        
        alphaGen lightingSpecular
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_ONE GL_ZERO        
        glow
        rgbGen lightingDiffuseEntity
    }

}

 

I assume this is the closest, as the glow is working (when it isn't with other attempts), but I don't know why the head is being set to black as I don't know much about shaders code besides changing the paths.

 

Otherwise this was my end result, and the second pic is milamber's result; both glowing heads but not with the desired effect:

 

eGjp5.jpgqJlGzvf.jpg

 

 

This was my first real time experimenting with shaders; usually I copy and paste shaders others have used for the visuals I wanted so I didn't need to play around to learn the code for them. I'm unsure if the texture is the cause as the rgb's work fine for the areas which don't glow and are actually more grey in colour to the _glow texture I have for the eyes. I hope this helps if you are able to do any more with this.

Link to comment

My glow now is pretty much the same brightness as the normal rgb, but the head is still black and I don't know why.

 

TYaIGHx.jpg

 

When I add "blendFunc GL_SRC_ALPHA GL_ONE" to the glow texture's shader, with the line for rgb "rgbGen lightingDiffuseEntity" it makes the head transparent and the glow parts are invisible.

 

This is my shader currently;

 

models/players/jedi_kdm/head_pic
{
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_ONE GL_ZERO
    glow
        rgbGen lightingDiffuseEntity
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_spec
        blendFunc GL_SRC_ALPHA GL_ONE
        alphaGen lightingSpecular
    }
}

Link to comment

That's cool Mil, I just thought i'd try and get some help from others too, to see if there's a simple solution xD

I've finally got it to glow, and the RGB areas to work, but the glow doesnt react to RGB yet. Here's the screenshot and code:

 

Q1KQaas.png

 

 

models/players/jedi_kdm/head_pic

{
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_ONE GL_ZERO        
        rgbGen lightingDiffuseEntity
    }
    {
        map models/players/jedi_kdm/head_pic
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
        rgbGen lightingDiffuse
    }
    {
        map gfx/models/jedi_kdm/head_pic_glow
        blendFunc GL_ONE GL_ONE
    glow
        rgbGen identity
    }
    {
        map gfx/models/jedi_kdm/head_pic_spec
        blendFunc GL_SRC_ALPHA GL_ONE
        alphaGen lightingSpecular
    }

}

 

For the glow to work and not make the head black, "rgbGen identity" seems to be a requirement, changing it to the same as on the usual RGB shaders to lightingDiffuse or lightingDiffuseEntity doesn't work.

Link to comment

Indeed. I have found out that LightingDiffuse sets the alpha's of the texture transparent, LightingDiffuseEntity sets the WHOLE texture space RGB compatible, and adding the two with the glow makes the head black but glow and no RGB xD

 

 

 

8M3tQ20.jpg sJ1GD59.jpg xPa6PUh.jpg

 

 

 

I'm lost. Maybe the choice of blendfunc's for the 3 separate parts of the shader for the 2 RGB and the 1 to glow are wrong to make them work together, but I wouldnt know :L

Link to comment

Well I've managed to get an RGB glow shader working, so i'm halfway there :L the first screenshot is of several screenshots ot show a variation of the colours, and the second is of one to show the overall visual of the glow working with RGB.

I guess shaders don't like having RGB twice in the same texture, although it allows 2 different glow's :@

 

fauhRKX.jpgWBdloHa.jpg

 

Link to comment

Wait didn't you and me already achieve that before? The problem was having the eyes be different besides another glow?

 

...I don't remember the details of the issue I spent the good hours of an entire day working on :|

 

But I'm sure you already had the glowing rgb done for the rest of the guy >_> Or was that something I did while testing without realizing you needed that for the rest of the body too?

 

 

Think I'm gonna re-reply to this tomorrow when I'm not too tired to remember.

Link to comment

Looking back at your version, yeah that's what you did with the shader. I didn't notice it until now lol.

This was just another skin I tested it on, however it still doesn't solve the issue of having 2 RGBs in one texture's shader; one for basic rgb, and another for rgb glow of different parts of the texture.

It could either be an issue with the texture, or the blendfunc. Basically, with the additional rgb glow part of the shader, it needs something to make what isn't in the alpha to be transparent (how do I do this?), otherwise it sets the whole texture to rgb glow

Link to comment

I've finally got the glow to work as intended; should've looked at JKHub's tutorials to begin with!

izocl9N.jpg


As you can see, the glow for the side shots gives a nice effect, from using the original texture (which was purple) without desaturating it. Also, the head doesn't glow completely, which was bugging me.
All I need to figure out now is if it's possible to have 2 RGBs on one texture, as currently it doesn't seem to allow the second one to work, no biggie though as the RGB glow was the main thing that I wanted to figure out.
The info was from these tutorials; Key and Crazy Assassin

Link to comment
  • Solution

Apologies for the double post, but I have fixed my shader finally!

 

kKaVgP4.jpg

 

It includes: 2 glow shaders, 2 RGB shaders, 1 spec shader.

I looked back at the first RGB tutorial that I looked at when I begun trying to figure out how it was done, back on jk3files, again by Crazy Assassin (big credits go to this guy!).

Thankyou Inyri and Milamber for the help you have given to me during this, and i'm gllad I have managed to finally figure it out with your help and the tutorials.

Ryojin 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...