[Dx9] Specular and Normal Map

Started by
4 comments, last by Starnick 13 years, 3 months ago
[font=arial, sans-serif]I would like to take a question, I looked on google but found nothing to answer.
[font=arial, sans-serif]

[font=arial, sans-serif]I have a big map with about 20mil tris, and various textures:
89149380.png

[font=arial, sans-serif]
How do I apply normal map and specular map in this model?
I'm exporting from 3D Studio Max for the format .x
[font=arial, sans-serif]Would using shaders? (HLSL)
[font=arial, sans-serif]

[font=arial, sans-serif]Thanks
http://mateusvitali.wordpress.com/
Advertisement

[font="arial, sans-serif"]I would like to take a question, I looked on google but found nothing to answer.
[font="arial, sans-serif"]
[font="arial, sans-serif"]I have a big map with about 20mil tris, and various textures:
89149380.png

[font="arial, sans-serif"]
How do I apply normal map and specular map in this model?
I'm exporting from 3D Studio Max for the format .x
[font="arial, sans-serif"]Would using shaders? (HLSL)
[font="arial, sans-serif"]
[font="arial, sans-serif"]Thanks

I never worked with DirectX 9.0 but I'm almost sure you have to use shaders if you want to do normal mapping and add specular light to your models.
[font="arial, sans-serif"]Someone who uses directx9, can you confirm whether to apply Normal and SpecularMap is through shaders? (HLSL)
[font="arial, sans-serif"]
[font="arial, sans-serif"]How do I apply a model with different textures and a Normal Map Specular Map?
I'm kinda lost on how to apply them in my maps, which are in format DirectX (. x)
being that they contain different textures, eg the main map has more than 20 textures, ashe will know what is specular and normal map for each texture?

I apply this in 3D Studio Max and time to export this information go together?
http://mateusvitali.wordpress.com/

[font="arial, sans-serif"]Someone who uses directx9, can you confirm whether to apply Normal and SpecularMap is through shaders? (HLSL)
[font="arial, sans-serif"]
[font="arial, sans-serif"]How do I apply a model with different textures and a Normal Map Specular Map?
I'm kinda lost on how to apply them in my maps, which are in format DirectX (. x)
being that they contain different textures, eg the main map has more than 20 textures, ashe will know what is specular and normal map for each texture?

I apply this in 3D Studio Max and time to export this information go together?


Hi, well, the pixel shader work for all rasterized pixels, you do perform light equation and specular highlights in the pixel program, also normal maps and so on, this should
tell you that the shader programs has nothing to do with your model format.

If you are using DX functions to load your model, the loader create one subset for each different material, check the D3DXMATERIAL argument in your D3DXLoadMeshFromX call.
Hi,


Yes, but for example I use shaders to implement Normal Map and Specular Map on the model .x?
And how they apply the model? Do you know any tutorial / book that teaches and explains how to do? Or any sample that makes it so I can learn? :)
http://mateusvitali.wordpress.com/
There's a lot of resources out there on HLSL you can find with a quick web search. I would strongly recommend to check out the documentation on the MSDN website for HLSL and the D3D9 effect system. There's many tutorials out there on how learning to program using HLSL too. I would also recommend checking out some of the XNA tutorials, because there is one for normal mapping. XNA is C# and you don't directly use the D3D9 interfaces and functions, so it may not help much on the CPU side, but the HLSL code is something to check out. You may also want to check out XNA's Per-Vertex and Per-Pixel lighting tutorials (for the shader code and explanations).

A shader can be thought of as a material - it defines how geometry is processed on the GPU and how it gets drawn. And since you write the shader, you're able to dictate to the GPU how do perform these operations.

So given a piece of geometry you want to render, you have a shader that is used to render it. Before you tell the GPU to draw anything, you need to make sure all the parameters are set on the shader (world-view-projection matrices, your geometry's texture, etc). When you command the GPU to draw, the shader is then executed. For D3D9, a complete effect is a vertex shader and a pixel shader. Vertex shaders execute for each vertex in your geometry, and the pixel shader for each pixel (more or less). So "applying a normal map" is basically setting an effect parameter, which happens to be the normal map texture. You should look at resources out there (again, google search) on how to load and use effects. There's a lot out there. You should get well acquainted with those shader topics before you tackle normal mapping, since that can be considered an advanced technique.

As far as understanding what normal mapping and specular mapping is, the concept is rather simple, but the implementation is not. As I mentioned earlier, there's per-vertex and per-pixel lighting techniques. A normal map is a texture of normal vectors that are used for per-pixel lighting. Rather than using normal vectors from the geometry (which for a low-poly model can be a small number), you use the texture. So you have more information to work with, and as a result you can produce surfaces that look rough or bumpy *without* requiring to render more geometry. E.g. in 3DS you can generate a normal map from a 2 million triangle character, create a low-poly character with 2k triangles, and render them to be almost the same. Specular maps are similar where they encode values that impact specular calculations along the surface of a model. E.g. make the surface look shinier or duller.

Since they both have to deal with lighting techniques, I would get a good grasp of how to do per-pixel lighting before advancing to normal maps.

This topic is closed to new replies.

Advertisement