I've given myself a massive headache over the past few months with trying to get GLSL to work and I'm finally ready to ask for help.
I am using vertex brightness to darken the models based on what room they are in, so each vertex is darkened to room[x].light if model is within boundaries of room[x].
The goal is to apply the original, full bright texture to the outline of the model.
What I want are fixed shader programs, not dynamic light or anything fancy, so far I can deduce that I need edge detection for finding the edges of the models and then reading the original texture's fragment data and writing over the top of the darkened fragment data.
This is the effect I'm trying to achieve:
Here's a diagram:
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 massive lack of GLSL tutorials in the world has finally stunted my project's development.
Edit:
I've had a second go at this and at the moment I have this based on vertex normals:
Just ignore that poser on the far right!
Replies
But due to the low polygon count of the models using interpolated normals might not be the best idea for calculating rim terms...