Author Topic: Need info for using bump image texture  (Read 1287 times)

Offline Gopinath

  • byte
  • *
  • Posts: 22
    • View Profile
Need info for using bump image texture
« on: January 07, 2014, 07:35:18 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Need info for using bump image texture
« Reply #1 on: January 07, 2014, 08:26:55 pm »
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.

Offline Gopinath

  • byte
  • *
  • Posts: 22
    • View Profile
Re: Need info for using bump image texture
« Reply #2 on: January 08, 2014, 06:27:52 pm »
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);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Need info for using bump image texture
« Reply #3 on: January 08, 2014, 09:23:25 pm »
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?

Offline Gopinath

  • byte
  • *
  • Posts: 22
    • View Profile
Re: Need info for using bump image texture
« Reply #4 on: January 09, 2014, 08:49:09 pm »
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]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Need info for using bump image texture
« Reply #5 on: January 09, 2014, 08:54:44 pm »
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).

Offline Gopinath

  • byte
  • *
  • Posts: 22
    • View Profile
Re: Need info for using bump image texture
« Reply #6 on: January 10, 2014, 04:30:47 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Need info for using bump image texture
« Reply #7 on: January 10, 2014, 05:10:07 pm »
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.

Offline Gopinath

  • byte
  • *
  • Posts: 22
    • View Profile
Re: Need info for using bump image texture
« Reply #8 on: January 10, 2014, 07:10:11 pm »
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