Page 1 of 1

Alpha.xml Material Name Information

PostPosted: Mon Jun 04, 2012 12:09 am
by David Walters
Hi Aaron,

I've recently revisited my terrain engine project with a view to replacing my naive single texture system with something more modern that uses alpha maps. I've been looking into the support for this in L3DT and it seems very useful and easy to use. Naturally I'm excited about having texel densities greater than a few px/m :-)

However I've run into a stumbling block when dealing with the XML file that gets exported along with the alpha images. I'd like it to include the material name (i.e. std_grass_lush, std_pebbles) in the <Layer> element so that I can use that to map to my game engine's material system - right now I only have texture paths to work with which are ambiguous.

So, I'd very much like to request something like <Layer> <LayerMaterial>std_cliff_grey</LayerMaterial> ... </Layer> be added to the alpha maps XML export [strike]so I can continue on this path[/strike].

edit: Sorry, this is far less urgent now, I've worked using L3DT's layer mixer and now don't think I'll need to work with the XML. Although it's still a piece of information I think would still be useful in there.

Thanks in advance,
David

ps. I'm using the mesh export now too instead of height fields, that works great in my new FPS engine as I can a) use my existing mesh collision and physics system and b) eventually work with the exported mesh after L3DT in my workflow to carve out of the rock.

Re: Alpha.xml Material Name Information

PostPosted: Tue Jun 05, 2012 1:02 pm
by Aaron
Hi David,

Thanks for the request. I have added the material name(s) to the alpha XML file in the next dev build, which should be available for download in the next week or so. [Edit: it's available now.]

FYI, the material name(s) are provided in a <MtlList> item, which echoes the handling of texture filenames in the <TexList> item. A simple single-material layer looks like:

Code: Select all
<Layer>
   <LayerColour>green</LayerColour>
   <TexList>
      <TextureFile>"C:\Users\YouKnowWho\L3DT\Resources\All versions\Climates\common\grass\grass1.jpg"</TextureFile>
   </TexList>
   <MtlList>
      <MtlName>std_grass</MtlName>
   </MtlList>
</Layer>


If you have used the 'combine alpha layers' wizard, you may have several materials in a single layer. In this case, the <Layer> item will look like:

Code: Select all
<Layer>
   <LayerColour>blue</LayerColour>
   <TexList>
      <TextureFile>"C:\Users\YouKnowWho\L3DT\Resources\All versions\Climates\common\rock\rock1.jpg"</TextureFile>
      <TextureFile>"C:\Users\YouKnowWho\L3DT\Resources\All versions\Climates\common\rock\rock1.jpg"</TextureFile>
      <TextureFile>"C:\Users\YouKnowWho\L3DT\Resources\All versions\Climates\common\rock\rock1b.jpg"</TextureFile>
   </TexList>
   <MtlList>
      <MtlName>std_cliffs_steep</MtlName>
      <MtlName>std_cliffs_grey</MtlName>
      <MtlName>std_cliffs</MtlName>
   </MtlList>
</Layer>


The above is not a very elegant piece of XML hierarchy, but it should maintain backwards compatibility with any existing software that parses these files. I hope this is acceptable. If you would like any changes, please let me know.

Best regards,
Aaron.

Re: Alpha.xml Material Name Information

PostPosted: Tue Jun 05, 2012 5:21 pm
by Telarus
Good feature addition. 8)

Re: Alpha.xml Material Name Information

PostPosted: Tue Jun 05, 2012 10:49 pm
by David Walters
That's exactly what I was expecting to see in the XML, thanks for the speedy update!

Regards,
David

ps. It's nothing you haven't seen before but here's my first attempt at using alpha-maps to control detailed textures. I used the noise-threshold based blending technique described here: http://www.m4x0r.com/blog/2010/05/blend ... -textures/ to blend things although it's probably hard to see at this distance.

http://www.davidwaltersdevelopment.com/share/desert-terrain-l3dt.png

That's a 16km^2 terrain (2K * 8m, split into 2x2 tiles). Using 2 x 1k terrain textures (sand and sandy-rock), and a 2K control map for each tile consisting of blend layer 1 in Red, blend layer 2 in Green (optional for 3 texture terrains) and the shadow-map in Blue. With fog ending at the 2Km mark.

Fog and shadows help the visuals so much! Next to port over some vegetation using masks again.

L3DT has made all this very easy so far. It's very easy to work with its output!