Hello,
I have a really strange problem. When I add a NormalMap to my model, which is a simple textured quad, everything looks fine. Once I clone that quad (or load it again via the assetmanager) and attach it with an offset, one of the quads is always brighter than the other and it looks like the normalmap is somehow messed up… This video shows what I mean:
Sorry for the reddish tone, that’s because of f.lux. As you see, it is dependent of the camera position.
This is my code:
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Spatial;
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
Spatial plane = assetManager.loadModel("Models/wall/plane.j3o");
plane.scale(.5f);
rootNode.attachChild(plane);
Spatial clone = plane.clone();
clone.setLocalTranslation(2, 0, 0);
rootNode.attachChild(clone);
initLight();
flyCam.setMoveSpeed(10);
}
private void initLight() {
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
}
@Override
public void simpleUpdate(float tpf) {
}
@Override
public void simpleRender(RenderManager rm) {
}
}
This is the material file:
Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
Diffuse : 0.8 0.8 0.8 1.0
UseMaterialColors : true
ParallaxHeight : 0.05
Ambient : 0.8 0.8 0.8 1.0
GlowColor : 0.0 0.0 0.0 1.0
DiffuseMap : Repeat Textures/william_wall_01_D.png
Specular : 0.089473695 0.089473695 0.089473695 1.0
Shininess : 12.5
NormalMap : Repeat Textures/william_wall_01_N.png
}
AdditionalRenderState {
PointSprite Off
FaceCull Back
AlphaTestFalloff 0.0
DepthWrite On
ColorWrite On
PolyOffset 0.0 0.0
DepthTest On
Blend Off
Wireframe Off
}
}
Oh and BTW, is it normal that normalmaps do not work with just an ambientlight (I don’t see the bumps)?