I have created a hairstyle with Blender 2.66 using hair particle system. This looks like this :
As you can see, the luminosity has been applied on line fragments. After conversion, I have exported my hairstyle mesh to OBJ file format. I parsed it in my program and the render looks like this :
The particules have been drawn as GL_LINES (in my OBJ file I have 2 vertices per face).
In another test program I wanted to test luminosity with a simple line fragment. Here's my vertices buffers :
static GLfloat vertices[6] =
{
0.000000f, 0.000000f, -2.000000f,
0.000000f, 0.000000f, 2.000000f
};
static GLfloat normals[6] =
{
0.000000f, 1.000000f, 0.000000f,
0.000000f, 1.000000f, 0.000000f
};
static GLfloat colors[6] =
{
0.000000f, 0.000000f, 1.000000f,
0.000000f, 0.000000f, 1.000000f
};
And the result (the line is rotating at the origin orthogonally to the X axe -> I have called glLineWidth(5.0f) to have a better visible result) :
With the real-time animation, I could see that the luminosity is correct but just on a specific'side' of the line. It's normal because a line segment is supposed to have an infinity of normals and I have just two normals (one per vertex). I want to precise that these two normals are the normal of the plane of equation Y = 0 -> n(0.0, 1.0, 0.0). So I wonder if it's possible to add several normals per vertex ? I believe OpengL can't do that. But maybe an other way is possible. Here's a drawing that explains what I want to do to compute a correct luminosity on each part of the line segment :
Like you can see it above on the first picture, Blender can compute luminosity in real-time on line segment. Furthermore, it's an OpenGL render that is present on this picture. So I'm sure it's possible to do that. I tried repeat the same line segment coordinates two time but for the second line I apply the opposite normal n2(0.0, -1.0, 0.0) but it does not work. The 'other side' is 'dark'. It's the same thing with two polygons. Currently, I use GLSL shader. I think the thing is possible using special shaders like Geometry shader or tesselation shader. Maybe CUDA language is required. But I'm not sure.
Does anyone can help me?