This project is read-only.

How to use Normalmap Texture with Models

Dec 11, 2009 at 2:34 PM


I created some Model with 3ds max. I used standard marterial with diffuse texture and normal map texture. then, I exported Model to .X File with Panda DirectX Plugin.

but Panda DirectX Plugin export only diffuse texture.

So, I tried that directly load normalmap Texture into "Texture2D normapmap", and set ModelData's MaterialShader.

->       ModelData.Meshes[0].Geometry[0].MaterialShader.NormalMap = normalmap;

However, the model was not changed.

My Content folder has 3 files

->TexturedBox.X (.X File)

->TexturedBox.bmp (diffuse Texture) (Automatically Loaded and complied with .XFile)

->TexturedBox_Normalmap.bmp (Normalmap Texture) (Loaded in code with content manager)

Does a solution exist?


Dec 28, 2009 at 1:21 PM

Hey kkc, I never saw your message until just now - I'm not sure how this slipped past. Very sorry for that. I guess I missed the email notification :-(

As for normal maps, this is something I'm not totally sure about - as I'm not a content guy. However there have been other questions about this. Eg I'm sure there was at least one other, but I can't find it.

There are two requirements here, the first is the lights you are using must be per-pixel lights. Otherwise the normal map will never be used. Secondly, if you are simply assigning the normal map, then chances are the runtime would get an exception. To use nomal maps, you also need tangent / binormal vertex data. By default, this is only generated if a model has normal maps in use - or it has the 'Generate Tangent Frames' property set to true (default is false).

As is mentioned in that thread, the importer looks for textures with a few select names, such as "Bump0" - which is apparently the most common name for a normal map. So if it's not being loaded, then I guess it is a model export issue. Sorry but there isn't really much I can help with I'm afraid.


Once again, I'm sorry for not seeing your post here. I swear I've looked a number of times :-) I was only arriu's post that had me notice it. (Things are a bit quiet of christmas it seems)

Dec 29, 2009 at 2:47 AM

Thanks! your reply is just on time.

According to my survey , there is a problem that panda X exporter in 3dsmax export only one texture (diffuse). Normal map Texture is ignored.

I wil try another exporter.