Need info for using bump image texture

Started by Gopinath, January 07, 2014, 07:35:18 PM

Previous topic - Next topic

Gopinath

Hi,

From the docs and searches done, I understand that the applying bump image texture for 3D model using JPCT is not possible. Is there any update on how this can be done. Incase if there is any other method where the bump image can be applied apart from the texture to an object, pls share the same.

EgonOlsen

Of course it's possible. It's just not that the engine itself provides a special class to do it. You can use a shader for it, the HelloShader example that comes with the engine does an advanced kind of bump mapping called parallax mapping. Maybe that helps as a starting point.

Gopinath

Thank you EgonOlsen. But I had referred to the HelloShader sample. It uses face_height2.png which I do not have such a blur image with me from client. I only have the regular jpg texture image and the blue colored bump image.

So i have tried with TextureInfo and added both the textures to it and applied to the object. But I could not see any improvement on it.

ti = new TextureInfo(TextureManager.getInstance().getTextureID("texture0"));
ti.add(TextureManager.getInstance().getTextureID("bump_tex"), TextureInfo.MODE_BLEND);

I have included the GLSLShader code by copying the fragment and vertex files from HelloShader example to my project.

shader = new GLSLShader(Loader.loadTextFile(this.getAssets().open("vertexshader_offset.glsl")), Loader.loadTextFile(this.getAssets().open("fragmentshader_offset.glsl")));

temp.setTexture(ti);
temp.setShader(shader);
shader.setStaticUniform("invRadius", 0.0003f);

EgonOlsen

Without the height map, the shader will actually create "normal" normal mapping (which a little overhead, but that might not matter in this case). I'm not sure why it doesn't work for you...can you post a screen shot and the textures?

Gopinath

I tried considering the bump image texture for height. But still no gain. I have attached the bump texture for your reference. As there is size restriction of 64 kb, i could not upload full image, but now have cropped a small portion of it for reference.

Do I need to get the height map image from my client or can we create it from regular texture or bump image.

[attachment deleted by admin]

EgonOlsen

You don't need the height map at all. If you omit it (...you remove the ITextureEffect-stuff from the example), the result should be simple normal mapping. If you want to use a height map, there are free tools that create something like it from the original texture like Shadermap CL (http://shadermap.com/downloads/) (the height is called XXX_DISP in the result).

Gopinath

With out the inclusion of it, it does look like the normal mapping and hence the projection / depth of map like trees, etc., are looking flat.

I have checked the reference link, but i downloaded and it showed some _sdk folder with some files which I could not understand on how to use that to create the height map from the texture.

EgonOlsen

You have to use the CL (aka Command Line) version. And as the name suggests, it's a command line tool. There's some documentation included on how to use it.

But as said: You don't need that for normal mapping only...either you are doing something else wrong or we aren't talking about the same thing here. That's why i asked for a screen shot. You can use dropbox or some free image hoster  to upload them.

Gopinath

I will try to upload the image somewhere and share the path for better understanding. Meanwhile i will check the documentation again for commandline usage of the shadermap