XNA UK User Group

A helping hand for bedroom coders throughout the land.
in

This Blog

Syndication

Twitters

RandomChaos

December 2008 - Posts

  • Merry Xmas

    Well, it's that time of year again and with the normal festive madness I have not had time to post any more on my HLSL series, but there is more to come in that range and once the festivities have died down and I sober up I'll start posting again.

    In the new year I also plan to post a revised GGR, GSM, a new Content Management component as well as some physics, and I guess what ever else comes to mind.

    Anyway, hope you all have a great Xmas and don't over do it too much :)

  • 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?

    Speeder_diff  Speeder_diffGlow

    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 have PhotoShop 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.

    Speeder_diff   Speeder_diffNormal

    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.

    Speeder_diff   Speeder_diffReflective

    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.