Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

GLSL Rim Highlight

I want to do some half-rim highlighting, I want a GLSL vertex+fragment shader that renders the edge of the model with the original full-bright texture.

This is the effect I'm trying to achieve:
v6okzn.jpg


Here's a diagram:
lighting_shader.jpg


The rendering path I'm trying to get is:
  • Render 3D model darkened to light level of room
  • Find direction of nearest light source
  • If light source is not in-front
  • Start shader program[light_direction] to highlight the model rim with original, undarkened texture

Ideally I want this to be 3 shader programs, one for behind, one for the left, one for the right so I can select which one to use out of 4 states, no program, left program, right program, behind program.

Thanks if anyone can help, I'm pulling my hair out over this one as the internet lacks GLSL tutorials massively.


I've had a second go at this and at the moment I have this based on vertex normals:
lighting_test.png


Just ignore that poser on the far right!

EDIT: Completed the tint lighting effect that is added to the shader, the dwarf below has a blue tinge in the darkened areas that make the light (Now yellowish) stand out more.
dwarflight.png
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top