Hi,
I’m continuing to work on my Rubik’s cube JOGL-learning project, and am putting in lighting to make it look more interesting.
In order to get specular highlights off the black edges of the cubelets (they are slightly rounded cubes), I have given each cubelet the following material properties:
Kd 0.039216 0.039216 0.039216
Ka 0.000000 0.000000 0.000000
Ks 0.850000 0.850000 0.850000
Ke 0.000000 0.000000 0.000000
Ns 30
I then bind a texture over the top of them - the texture has solid blocks of colour with rounded edges for the stickers, and alpha=0 areas elsewhere. I bind them together like this:
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA);
gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL);
I am lighting the scene with a diffuse and specular light above, to the left and behind the camera and a secondary light above right and behind.
It looks like this, which I’m quite pleased with:
My question though is this:
How can I get the different faces of the cube to render in different shades as well, depending on their angle to the diffuse lights, eg in this example the blue face should be rendering darker. If I turn the texturing off but leave everything else the same, the different faces do render in different shades properly.
I guess I’m asking how can I shade the texture colours ?
(a lot of work for rendering a cheap plastic toy !)