L3DT users' community
Large 3D terrain generator

Vertex Normals

Any and all chit-chat regarding L3DT.

Vertex Normals

Postby Craig » Thu Dec 18, 2008 1:27 pm

Hi

Well I'm still learning all this stuff, and still trying to understand normals/normal maps so please forgive this newbie question.

A bit of background: I'm writing a game using Microsoft XNA Game Studio. I'm using L3DT to build the terrain. I generate a HeightMap, WaterMap, NormalMap and TextureMap. I export these maps using HFF, WMF, PNG and JPG formats respectively. I've written custom XNA pipeline importers / processors so that I can convert these exported files to the XNA xnb content file format so that I can load the content using the XNA ContentManager.

All is working well, except.. normals.

I am assuming the NormalMap is only useful for rendering the TextureMap because if I try to use it for HeightMap vertex normals it looks horrible.

I tried to precalculate the vertex normals in the XNA Pipeline importer, but it's difficult because I save the maps as a mosaic (they are big maps), and inside the Pipeline importers, you only have access to the current import file, so there is no way for me to build the edge normals because I can't load the faces of the neighbouring tiles.

I can calculate the vertex normals at runtime when I instantiate the height map, but it is very slow, so I really need to have them precalculated.

So my question is: Is there a way to export vertex normals from L3DT... or is there another way for me to handle this?

Thanks
Craig
Craig
New member
 
Posts: 6
Joined: Wed Dec 10, 2008 11:50 pm

Re: Vertex Normals

Postby Aaron » Fri Dec 19, 2008 11:01 am

Hi Craig,

Craig wrote:I am assuming the NormalMap is only useful for rendering the TextureMap because if I try to use it for HeightMap vertex normals it looks horrible.


L3DT uses the normal map as vertex normals when generating the lightmap. However, results will vary depending on the vertices used; vertex normals are only valid for the vertices from which they were generated. If your XNA importer generates vertices in a different way/order to how L3DT generated vertices when making the normal map or the light map, then the results will indeed look horrible. If your XNA importer is generating some sort of optimised mesh, then you also have to generate the vertex normals to match.

If you need edge heightmap pixels from neighbouring tiles, you may want to look at using the atGrowTilesByOne plugin to add an extra row and column of data to each tile. This plugin is included with the L3DT installer.

Cheerio,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia


Return to General discussion

Who is online

Users browsing this forum: No registered users and 17 guests