Sunday 8 July 2012

Basic HLSL Lighting Techniques - Episode 4: How to apply Episode 3 shader to another model




In this post I am going to show how you can apply the effects from Episode 3 to another model. In this case the LandShark model that also ships with the DirectX SDX. It's not really a HLSL post, but related.

The model comes with a diffuse texture already called Speeder_diff.jpg, but we also need a glow map, a normal map and a reflection map, how do we create these textures?

Well we have the diffuse texture so we can derive all the other textures we need from this.
So how do we get from the diffuse map to a glow map?



Open up the diffuse texture in an image editor of your choice. I am told Paint.Net is quite good. Then Just black out the bits you don't want to have on the glow map, as you can see I also blurred and altered the colour slightly on my map. Save the new texture.

Now we need a normal map. This is not so easy to do and you will need a tool like CrazyBump or if you havePhotoShop the NVIDIA add on. Paint.Net I am told also has an add on for this. I also found this tool too. So, put your diffuse texture through this process.



Now we need a reflective map. This is as simple as the glow map, just black out what you don't want reflection on and highlight what you do want reflection on. In this case I just wanted it on the windshield of the LandShark which can be found near the top right hand corner of the texture. To find it I simply looked at all the black areas on the texture and put a red dot on the diffuse map, then loaded the model up to see where my red dot came up.





So, there you have it, all the textures you need to apply the shader effect, easy eh.

Solution for this post can be downloaded here.

3 comments: