Parallax map looks noisy


I’m working on a map and i tried to use Lighting.j3md to implement Normal,Parallax and Steep Parallax.

With just normal map mesh looks decent:

But when i implement parallax and steep parallax it becomes like this:

This is the code i use for material:

       mat = new Material(getAM(), "MatDefs/Light/Lighting.j3md");
        mat.setTexture("DiffuseMap",getAM().loadTexture(new TextureKey("Textures/textures/map_texture.png",false)));
        mat.setTexture("NormalMap",getAM().loadTexture(new TextureKey("Textures/textures/normals/map_normals.png",false)));
        mat.setTexture("ParallaxMap",getAM().loadTexture(new TextureKey("Textures/textures/parallax/map_parallax.png",false)));
        mat.setBoolean("UseMaterialColors", true);
        mat.setFloat("Shininess",64f);  // [0,128] 
        mat.setBoolean("SteepParallax", true);

And this is normal and parallax map:

I think parallax map is not made correctly,but i’m not totally sure…can somebody explain me how the parallax map should be built?

Does your mesh have tangents?

Yes it has


I tried to disable parallax and to reduce parallax height.I also inverted colors in the parallax map but some noises still remain…did somebody have my same problem?

This is gonna make me crazy.


Steep Parallax:

I heard about a bug on steep angle ( [Patch] Bug in Steep Parallax Mapping of Lighting shader ) but this is old and it seems to be fixed in the shader that i use…

Your parallax map is not a valid parallax map. It’s not just a matter of making your normal map grey scaled…
holes you be black and spikes should be white…

Can you explain me a little how to make a proper parallax map? :blush:

There are some screenshots:

Parallax,normals and the result.

It’s not something you can paint unless you have a very simple shape. usually you generate them with a tool.
Look for heightmap generator, bump map generator. see what the heightmap in JME examples looks like

It has different levels of gray, and doesn’t roughly jump from black to white.
see this Parallax Map - polycount

Ok,thanks! I’ll read all that papers.And what about the distortion that increases when i start reaching the steep angle?

because the steeper the angle is the more you see the layers…
Parallax mapping is a trick of the eyes, and since your map is wrong, the effect is never really tricking you. And up close it’s worst

I also tried to use a total white map but the middle bar still remains :\ But anyway does anyone know a good linux program to generate heightmaps?I tried with gimp but even if mapping looks good i still see the texture deformed when i reach steep angle.

This is the code i use to register the material,maybe this can help understanding what i’m doing:

        Texture map_diffuse = getAM().loadTexture(new TextureKey("Textures/textures/map_texture.png",false));
        mat = new Material(getAM(), "MatDefs/LodLight/LodLighting.j3md");
        mat.setBoolean("UseMaterialColors", true);
        //mat.setBoolean("HighQuality", true);
        if(Options.useNormals) {
            Texture map_normal = getAM().loadTexture(new TextureKey("Textures/textures/normals/map_normals.png",false));  
            mat.setFloat("Shininess",0f);  // [0,128] 
        if(Options.useParallax) {
            Texture map_parallax = getAM().loadTexture(new TextureKey("Textures/textures/parallax/map_parallax.png",false));
            mat.setBoolean("SteepParallax", true);

LodLighting is just a modified version of the Lighting shader i made to disable effects after a certain distance,however the normal/parallax code is untouched and i already tried using the default Lighting.j3md material.

What does this test case looks like

Already tried that and it looks good,i’ll post you a screen.

EDIT: I tried to replace the texture using bricks and this is the result:

So i think this is probably something about the model :\

Well then it all boils down to the Texture then.
I use the substance suite for texturing and they have a software called Bitmap2material that generate pretty much anything from a bitmap
Though that’s a charged product. But maybe the free trial can help.

I saw a tutorial with blender once, but that was more a hack rather than proper baking, and you need a high poly mesh.
I’ve seen some tuts for Gimp
But that’s not gonna help you to generate the heightmap from a bitmap


But i tested with the brick texture and the noise still remains.

if by noise you mean the slight horizontal lines you see, that’s what parallax mapping does. To avoid this you need to increase the number of samples, but at the cost of performance.
If you mean the strange thing in the background on the right, I have no clue of what it is.

Yeah,i made some other testing and i think that the shader repeats the UV map,it reaches the pink texture and that’s what is the bar made.

I’ll try to resolve this,maybe by using triplanar mapping :slight_smile:

ho maybe you didn’t set the texture to repeat?

I tried with WrapMode.repeat but this still not works.

I divided the map into 2 meshes,i redesigned normals and parallax but there’s still the same exact bug.

The test is still good,there are diffuse/normals/parallax:

I have totally no idea what to try now,anyhow classic parallax looks ok.

EDIT: There’s a video → - YouTube