i wrote a little demo with a modified lambert function in webgl:
You can clamp the illumination into the “brighter” colors that is expanded into the (usually unlit) back areas and thus allows you lit the whole object. The light can be toggled between a (fixed) lightsource and the camera-position. This is usefull if you (cheaply) don’t want to show “dark parts” of 3d-models while still showing the structure. It can be further tweaked (not implemented yet!) by adding gamma or a two-tone mapping.
Just because I googled it three times in the last couple of weeks – as a personal reminder/recommendation:
And yes, I realize it couldn’t be much simpler…
Modern OpenGL relies heavily on GLSL shaders. They are needed for pretty much everything you draw. To ease the handling of shaders I’ve decided publish my shader-collection (well, part of it, for now) on github. The shaders are sorted by GLSL version (currently: version 1.5, webgl 1.0) and “purpose”. Their implementation is focused on readability, not speed. Hence, they can be optimized quite heavily and be combined as well. Anyway, here’s the link:
I’m planning on continuously adding shaders.
I’ve shared parts of my rendering library on github:
here’s a feature list:
- OpenGL 3.2 core profile rendering
- cpp, compiles with gcc & VS 2010
- cmake project-file
- focus on Imagefilters via GLSL fragment-shader
Here’s a little code example on the usage:
using namespace SciIllLib;
CFilter fltFXAA = new CFilter();
SFilterEngine::ReGenerateTexture(&m_rtScene, GL_FLOAT); SFilterEngine::ReGenerateTexture(&m_rtFinal, GL_FLOAT);
... render as usual ...
SFilterEngine::Apply(fltFXAA, m_rtScene, m_rtFinal);
Of course it can do much more – load textures, load models, …