No NormalMap effect

Hey! I’ll keep it brief:

I copy-pasted the HelloMaterial tutorial code “as is”. Everything works perfectly, except for the NormalMap definition (i.e., no “bumpiness” on the surface of the sphere). In your opinion, what could be the cause of that?

(all files are properly linked, the “normal_pond.png” file used to create the bumpiness exists and looks exactly like shown).



Thank you!



Amir.

Without seeing you code, it is impossible to know. But normals/steep parallax mapping requires light. Does you scene contain lighting (other than ambient)?

I just tried it and mine looks fine. So you copy and pasted it, without any changes? Can you take a screenshot, and post your system specs, mainly OS and graphics card.

Yep, simply copy-pasted it, without any changes.

I could paste the code here but i would just make my message pretty long. The code is exactly as written here:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_material

Here’s the screenshot, as you can see, everything working properly, materials and textures (and transparency) loaded correctly, only the NormalMap’s “bumpiness” doesn’t work: Imgur: The magic of the Internet



My computer:

Dell Studio 1558 laptop with:

Intel core i7 Q720 @ 1.6 Ghz

4GB RAM

Graphics card: ATI RADEON 5470 with 1 GB

(I have the latest driver, not from the windows updater but from the manufacturer’s site, have support for openGL, since the scene does load)

Windows 8 pro 64-bit operating system.



Any guesses? Or maybe just a general thought / direction?



Thanks again!

right its the graphics card it seems, as some had the exact same issue (with same graphics card):

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/problem-with-shiny-rock-example



are you running RC2 SDK?

Hey, thanks for finding that thread!

It seems the poster over there did have some NormalMap effect, while I’m having none. Could be driver issues (maybe the newer driver is worse? don’t know…).

If you’re referring to the jMonkey SDK then no, I’m using “Eclipse Juno” Version: 4.2.1.

@amirkr said:
Yep, simply copy-pasted it, without any changes.
I could paste the code here but i would just make my message pretty long. The code is exactly as written here:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_material
Here's the screenshot, as you can see, everything working properly, materials and textures (and transparency) loaded correctly, only the NormalMap's "bumpiness" doesn't work: http://imgur.com/QvoMu

My computer:
Dell Studio 1558 laptop with:
Intel core i7 Q720 @ 1.6 Ghz
4GB RAM
Graphics card: ATI RADEON 5470 with 1 GB
(I have the latest driver, not from the windows updater but from the manufacturer's site, have support for openGL, since the scene does load)
Windows 8 pro 64-bit operating system.

Any guesses? Or maybe just a general thought / direction?

Thanks again!


Out of curiosity, have you tried enabling steep parallax mapping? or maybe set the shininess waaaaay up? At least to see if you get any results... ATI Radeon cards are the anti-shader. I'm fairly sure if you look at the bottom of the card the serial number on every one is: 666

How do I enable steep parallax mapping?

I have tried playing with the shininess, didn’t help :frowning: raised it from 5 to 10 to 100 to 128, nothing worked.

I could simply move on, however I’m concerned about the lack of support by a (relatively) new graphics card.

If anyone has an idea other than “it’s the graphics card” please let me know.

Thank you.

@amirkr said:
How do I enable steep parallax mapping?
I have tried playing with the shininess, didn't help :( raised it from 5 to 10 to 100 to 128, nothing worked.
I could simply move on, however I'm concerned about the lack of support by a (relatively) new graphics card.
If anyone has an idea other than "it's the graphics card" please let me know.
Thank you.


Unfortunately, the lack of support is on Radeon's part. I have written shaders that work on all graphics cards and had Radeon just botch executing the instructions (vertex deforms comes to mind).

As for parallax... I believe the setting would be:

[java]mat.setBoolean("SteepParallax", true);
mat.setFloat("ParallaxHeight", someFloatValue);
mat.setTexture("ParallaxMap", someParallaxMapTexture);[/java]
Or.. if the parallax info is stored in the normal map... use:
[java]mat.setBoolean("PackedNormalParallax", true);[/java]

I believe you can use the normal map as your parallax map. Though, @nehon could answer this correctly.

Hey, thanks for your detailed comment.

It just seems odd; as explained, a NormalMap is really important in order to get the “feel” of a texture.

So it’s a VERY important part of gaming and the graphic card’s capability.

Should I just basically accept that the graphic card I have does not support that property? That won’t bother me much as I’m not an avid gamer, but it means I cannot use that feature with any of my created scenes. And neither can you!

And it’s a relatively new card! supporting openGL 3.2 and all.

(frustrated).

@amirkr said:
Hey, thanks for your detailed comment.
It just seems odd; as explained, a NormalMap is really important in order to get the "feel" of a texture.
So it's a VERY important part of gaming and the graphic card's capability.
Should I just basically accept that the graphic card I have does not support that property? That won't bother me much as I'm not an avid gamer, but it means I cannot use that feature with any of my created scenes. And neither can you!
And it's a relatively new card! supporting openGL 3.2 and all.
(frustrated).


Thought...

add this line and tell me what happens:

[java]mat.setBoolean("VertexLighting", false);[/java]

ATI cards seem to have issues with defines... and the Lighting shader only applies normal mapping IF vertex lighting is not on.

I really appreciate your input on my problem. Unfortunately it didn’t help with showing the textures.

I’m still a newbie with this so I’m not sure if my code is correct. Here’s what it looks like:



[java]

Sphere rock = new Sphere(32,32, 2f);

Geometry shiny_rock = new Geometry(“Shiny rock”, rock);

rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres

TangentBinormalGenerator.generate(rock); // for lighting effect

Material mat_lit = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

mat_lit.setTexture(“DiffuseMap”, assetManager.loadTexture(“Textures/Terrain/Pond/Pond.jpg”));

mat_lit.setTexture(“NormalMap”, assetManager.loadTexture(“Textures/Terrain/Pond/Pond_normal.png”));

mat_lit.setBoolean(“UseMaterialColors”,true);

mat_lit.setBoolean(“VertexLighting”, false);

mat_lit.setColor(“Specular”,ColorRGBA.White);

mat_lit.setColor(“Diffuse”,ColorRGBA.White);

mat_lit.setFloat(“Shininess”, 127f); // [1,128]

shiny_rock.setMaterial(mat_lit);

shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit

shiny_rock.rotate(1.6f, 0, 0); // Rotate it a bit

rootNode.attachChild(shiny_rock);

[/java]



What are the properties of the material (changed by “set boolean”) that I can touch and change?

I’ve already seen “VertexLighting” and “UseMaterialColors”, where can I find a comprehensive list? Maybe tweaking those could solve this.



Amir,

mat_lit.setFloat("Shininess", 127f); // [1,128]


wow... so big number, try to use 0-2f, really ;)

it work different than you think. more than 100f can be just invisible in most cases.

the more value you give, the more "precised" reflection it give. if you have too big number, then "highlight" area can be too small(that you dont see it).

The 127 is after a lot of tryouts :slight_smile:

I’ve tried setting it right now to 1f, 1.5f and 2f but all it did was brighten the sphere, without showing the NormalMap texture.

I have also tried searching the web for similar problems with NormalMaps and ATI RADEON, but couldn’t find something I saw relevant. Are there other terms related for this search? Perhaps some tweaking of the driver or the card could do the trick?

For example, when I just started to use jMonkey (a whopping 10 days ago or so) nothing worked, because the driver was updated by Microsoft and not ATI. Once I downloaded their “Catalyst” tool and updated drivers through the AMD website things started to work. Perhaps this problem requires a similar approach (I do already have the latest driver).

By the way sorry for the so many posts… it just seems like a hard problem :slight_smile:



Amir.

@amirkr said:
I really appreciate your input on my problem. Unfortunately it didn't help with showing the textures.
I'm still a newbie with this so I'm not sure if my code is correct. Here's what it looks like:

[java]
Sphere rock = new Sphere(32,32, 2f);
Geometry shiny_rock = new Geometry("Shiny rock", rock);
rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
TangentBinormalGenerator.generate(rock); // for lighting effect
Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
mat_lit.setBoolean("UseMaterialColors",true);
mat_lit.setBoolean("VertexLighting", false);
mat_lit.setColor("Specular",ColorRGBA.White);
mat_lit.setColor("Diffuse",ColorRGBA.White);
mat_lit.setFloat("Shininess", 127f); // [1,128]
shiny_rock.setMaterial(mat_lit);
shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit
shiny_rock.rotate(1.6f, 0, 0); // Rotate it a bit
rootNode.attachChild(shiny_rock);
[/java]

What are the properties of the material (changed by "set boolean") that I can touch and change?
I've already seen "VertexLighting" and "UseMaterialColors", where can I find a comprehensive list? Maybe tweaking those could solve this.

Amir,


Eh... on second though... remove the VertexLighting flag all together. I hate the way defines work >.<

And your scene does use a light other than an ambient, yes? Try commenting out the UseMaterialColors line and just rely on the scene light. Sorry for the random suggestions... The ATI Radeon card I had here failed a while back, so I can't test things locally :(
I’ve tried setting it right now to 1f, 1.5f and 2f but all it did was brighten the sphere, without showing the NormalMap texture.


it should make brighten only some of pixels(based on normalMap). Do you use DirectionalLight in Scene? it need it.

I always seek the easiest solution. Have you tried other normalMap examples / make your one?

maybe there is problem with normalMap texture or something. (just a stupid mistake or something)

I would propose you to use JME SDK. where you have Material editor, where when you change material, you have preview.
There you could check it out.

you can also make a testcase, so when it will work different for us, then it's Graphic Card for SURE ;)
Ofc, in that case, developers could try to fix shader, or just wait for new drivers.

Yes, I use a directional light (I will put all of the code at the end of this message).

I tried switching to the “Rock_Normal.png” texture from the test-data jar, but it didn’t work as well.

I don’t have the technical knowledge (yet) to create a NormalMap, but I did open it up in an editor and it showed a correct picture (attached here: http://imgur.com/l4aU3).



I do suspect it’s the graphic card, because this is a tutorial example, which surely works :slight_smile:



Here’s the entire code (copy pasted from the HelloMaterial tutorial):



[java]package jme3test.helloworld;



import com.jme3.app.SimpleApplication;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.material.RenderState.BlendMode;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.scene.shape.Sphere;

import com.jme3.texture.Texture;

import com.jme3.util.TangentBinormalGenerator;

import com.jme3.renderer.queue.RenderQueue.Bucket;



/** Sample 6 - how to give an object’s surface a material and texture.

  • How to make objects transparent, or let colors "leak" through partially
  • transparent textures. How to make bumpy and shiny surfaces. /



    public class HelloMaterial extends SimpleApplication {

    public static void main(String[] args) {

    HelloMaterial app = new HelloMaterial();

    app.start();

    }



    @Override

    public void simpleInitApp() {

    /
    * A simple textured cube – in good MIP map quality. /

    Box boxshape1 = new Box(new Vector3f(-3f,1.1f,0f), 1f,1f,1f);

    Geometry cube = new Geometry("My Textured Box", boxshape1);

    Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");

    mat_stl.setTexture("ColorMap", tex_ml);

    cube.setMaterial(mat_stl);

    rootNode.attachChild(cube);



    /
    * A translucent/transparent texture, similar to a window frame. /

    Box boxshape3 = new Box(new Vector3f(0f,0f,0f), 1f,1f,0.01f);

    Geometry window_frame = new Geometry("window frame", boxshape3);

    Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    mat_tt.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));

    mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

    window_frame.setMaterial(mat_tt);



    /
    * Objects with transparency need to be in the render bucket for transparent objects: /

    window_frame.setQueueBucket(Bucket.Transparent);

    rootNode.attachChild(window_frame);



    /
    * A cube with base color "leaking" through a partially transparent texture /

    Box boxshape4 = new Box(new Vector3f(3f,-1f,0f), 1f,1f,1f);

    Geometry cube_leak = new Geometry("Leak-through color cube", boxshape4);

    Material mat_tl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    mat_tl.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));

    mat_tl.setColor("Color", new ColorRGBA(1f,0f,1f, 1f)); // purple

    cube_leak.setMaterial(mat_tl);

    rootNode.attachChild(cube_leak);



    /
    * A bumpy rock with a shiny light effect /

    Sphere rock = new Sphere(32,32, 2f);

    Geometry shiny_rock = new Geometry("Shiny rock", rock);

    rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres

    TangentBinormalGenerator.generate(rock); // for lighting effect

    Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");

    mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));

    mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));

    mat_lit.setBoolean("UseMaterialColors",true);

    mat_lit.setColor("Specular",ColorRGBA.White);

    mat_lit.setColor("Diffuse",ColorRGBA.White);

    mat_lit.setFloat("Shininess", 1.2f); // [1,128]

    shiny_rock.setMaterial(mat_lit);

    shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit

    shiny_rock.rotate(1.6f, 0, 0); // Rotate it a bit

    rootNode.attachChild(shiny_rock);



    /
    * Must add a light to make the lit object visible! */

    DirectionalLight sun = new DirectionalLight();

    sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());

    sun.setColor(ColorRGBA.White);

    rootNode.addLight(sun);

    }

    }[/java]

Several updates (been working on it):



I have tried to use the JME SDK (latest version), problem persists. So it has to be something with my computer.

I then moved to try and record what my ATI RADEON 5470 Graphics Card can or can not do.

I found out about the logger:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:read_graphic_card_capabilites

but I have no idea how to “print” the data from the logging. So I used a simple “println” method using this code, at the end of the simpleInitApp() method:

[java]

Collection<Caps> caps = renderer.getCaps();

System.out.println(caps.toString());

[/java]

(as well as importing “com.jme3.renderer.Caps” and “java.util.Collection”).



I only got this printout: [NonPowerOfTwoTextures], which I don’t know what to make of (do I have a non power of two textures capability? or do I not? and where is all the other data that could be printed about my card?)



In addition, I have been running the JME tests for several applications, for example the “simpleWater” etc (found inside the JME3 examples folder in the SDK). Several things didn’t work (another indication of a graphic card problem) and I got an error message of this sort:

Unsupported Operation Exception: No default technique on material ‘Simple Water’ is supported by the video hardware. The caps [GLSL100] are required.



the “Caps” part is what caught my attention, as it seems my graphic card is indeed unable to handle some things.



I am really stretching my abilities here into unknown territories :slight_smile: would greatly appreciate if anyone could help me make sense of it, particularly how to print the logger. I would also like to thank again everyone who has been answering my post here throughout the day.



Amir.