Please, maybe I am wrong , but seens the light bump map is not working(is it one of the bugs?).
Hmm. Works fine here. I have another demo floating around that I found was not quite correct. I'd accidently put in the wrong source for the input to the DOT3 - I'd used object colour rather than Blend colour.
I guess to have nicer effect on bumps you may have to code de light correctly (it may takes time...) , put it in one TextureUnit, put the normal map in next one and aply combine dot3 :
That's not the correct way to do light maps in multitexturing. Might work fine if you're doing multipass texture rendering, but for MT code, the best way of doing it is to use either per-vertex colours to set the incident light direction or blend color for a global effect. With what you are doing here, you are changing the light *direction* on a per-pixel basis. That's a really horrible way of going about it - particularly if you want to do multiple light sources or coloured lighting effects. It means that the texture is fixed relative to the object, so if either the light or the object move, your lighting gets really off.
Remember that the output of the DOT3 is a scalar, grayscale value and so if you wanted to run coloured lighting effects, it would be lost. Also, if you are trying to do dynamic lighting effects then that would require you to regenerate the texture every frame, which is highly inefficient use of internal bus bandwidth.
A much more efficient way of doing the effects you want is to use the texture Blend colour as the second input to the DOT3. Then multiply in your texture color, followed by the light map, then add the specular color as the last stage. To then do dynamic lighting, all you have to do is play with the texture transform of the light map to get the right effects.
I just finish a new Dot3 bump demo, I have several bugs, but I find a nice way to update the light map: setting the light map with a SPHERE_MAP texture coordinates. I've failed to create light maps with CubeMap...
Here's a second example. Cube maps are really easy to do it with. Just set the last stage of your MT texture pipeline to be the cube map, with auto generated texture coordinates. The key to doing this is that you must use NORMAL_MAP and not REFLECTION_MAP so that the specular represents the real colour directly in front of that vertex. If you want to see this in action, go to examples/texture of the j3d.org code CVS and run SpecularCubeDemo.
TextureCubeMap tex_cube = new TextureCubeMap(Texture.BASE_LEVEL, Texture.RGB, imgWidth);
.....
TexCoordGeneration cube_coords = new TexCoordGeneration(TexCoordGeneration.NORMAL_MAP,
TexCoordGeneration.TEXTURE_COORDINATE_3);
TextureUnitState[] state_list = {
new TextureUnitState(bump_tex, bump_attr, null),
new TextureUnitState(color_tex, color_attr, null),
new TextureUnitState(tex_cube, specular_attr, cube_coords),
};...
// Set up the geometry
int format = GeometryArray.COORDINATES |
GeometryArray.NORMALS |
GeometryArray.TEXTURE_COORDINATE_2;int[] tex_set = { 0, 0, -1 };
TriangleArray geom = new TriangleArray(data.vertexCount, format, 3, tex_set);
Note the -1 here in the texCoordSetMap. This tells j3D that you are going to auto-generate the texture coords for that particular stage of the MT pipeline.
-- Justin Couch http://www.vlc.com.au/~justin/ Java Architect & Bit Twiddler http://www.yumetech.com/ Author, Java 3D FAQ Maintainer http://www.j3d.org/ ------------------------------------------------------------------- "Humanism is dead. Animals think, feel; so do machines now. Neither man nor woman is the measure of all things. Every organism processes data according to its domain, its environment; you, with all your brains, would be useless in a mouse's universe..." - Greg Bear, Slant -------------------------------------------------------------------
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
