Skip to content

Tutorial 14 Bump Normal Mapping

MasDennis edited this page Apr 5, 2013 · 5 revisions

Very easy :O There’s an extra mTextureManager.addTexture() parameter that you can use to indicate that you’re adding a Bump/Normal map. A material called BumpmapMaterial should be used for this:

Bitmap diffuseTexture = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.diffuse_texture);
Bitmap bumpTexture = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.bump_texture);

myObject.setMaterial(new BumpmapMaterial());
myObject.addTexture(mTextureManager.addTexture(diffuseTexture, TextureType.DIFFUSE));
myObject.addTexture(mTextureManager.addTexture(bumpTexture, TextureType.BUMP));

To see this in full splendor you can add in an animated light:

Animation3D lightAnim = new RotateAroundAnimation3D(new Number3D(), Axis.Z, 6);
lightAnim.setDuration(5000);
lightAnim.setRepeatCount(Animation3D.INFINITE);
lightAnim.setTransformable3D(mLight);
lightAnim.start();

That’s all there is to it. For a full example check out the RajawaliExamples project on Github.

Clone this wiki locally