Fake easy rim shader for game engine

I have found an easy way to fake back lighting in the blender game engine. I have only tried it using GLSL but it could be possible in multitexture mode some how.

This is the resulting effect: (exaggerated for effect, It can easily be more subtle)

To add a rim shader effect to a material is actually really simple. First create an image like this. The softness of the circle is what determines the softness of the lighting. You want the circle exactly in the center as this gives the most even final result. Mine is a rough example for testing. You would want a better one.


-Now create a texture with this image in the material you want to be rim shaded.

-Next select “Nor” for normal in the “Map Input” tab

-Use Size X and Size Y to adjust the size of the rim. In the above image I used .75 for both with the example texture

-Now go into the “Map To” tab and de-select “Col” (colour) and select “Emit

The result is that the object emits light around the edge as well as reacting to lighting in the scene creating an impression of back lighting

Holy shit dude! that’s perfect for skin shaders!

It looks great I can’t wait to put it in my demo.


Sounds cool, but I can’t see the image.:frowning:

Glad I could help, That does look better! I look forward to seeing your demoscene!

Its just a black circle on a white background. You want the circle to be large, dead center and have a blurry edge

Could you just upload the image to blenderartists?

In glsl you could probably use a color ramp instead of an image, for better accuracy, control, and filesize- probably speed too.

[edit] as far as I can tell you’d have to use nodes if you wanted a ramp-based rim shader- basically you’d plug nor from a geometry node into a ramp (using a nor node to get the dot product), and that into a color mix node set to add. The result goes to render.

Yeah I actually found a way to do it in a super mario galaxy style shader someone uploaded. I was just looking for an easy way to do it and this was the first thing I came up with, I’m not the best with nodes. I’m very much a “that does it so why do I need another way” type person.

This was an easy solution so I decided to stick it up here

I had that mario thing from a while back as well!
I had almost forgotten about it.:stuck_out_tongue:


This is a solution for many problems of shaders!
Thank you for provide it to us!

You know you can also use the Ramp shader for that?

Rim with circle image:

Rim with Ramp shader:

The Ramp shader might give you some faster setups and you do not need to use a
texture trick to get the same effect.

The Ramp shader also only works when lights are in the scene. the texture trick
also glows when no light is present!

well depends on what you need. with the texture trick you can make the rim
visible only even without any lights.

can it be done without glsl? and how? I can’t use glsl with my card. And the texture method doesn’t work for me.

Thanks for sharing.

fisicomolon: I think there are drivers or something for intel chipsets. If you have a desktop, just buy a card by newegg.com, or go out and buy it… They aren’t expensive.

Maybe using the texture as a reflexion and making it with alpha I think.

I have an ati 9550 and it is supossed to work with glsl, If I set everything "on " in my card glsl works but my computer get frozen in a few seconds, I have to set a few things “off” and the glsl stop working. The problem is my computer only have a AGP port, and new cars are PCX mostly. And AGP cards are old, and probably I’ll have the same problem. I’ll change my computer soon but no now. Thank you for you advice

I did it and it works, I pressed ESC and P again and it didn’t work :mad:

I’m trying right now.

Ok, I think I got something, if anybody is interested in doing something similar without glsl, here is the blend.


shader.blend (267 KB)

if you change the Map to too Col and use a sharper circle with inverses colours you can get a quick toon inline. Its a bit dodgy bit could be used for a few techniques.

Realised that a circle like this :
this made a very thin outline around the inside the character
I then made the circle smaller
and got this result

It looks funny at cretin angles but it works.Model from here:

more info here:

and more like this here:

This is nice looking, but is there a way to do it in 2.79? I dont really know the equivalents in this version? Thanks if you figure it out! :smiley:

2.79? What’s that version? To setup a light rim In the 2.74, do this: