Page 1 of 1

How does the attributes map work?

PostPosted: Sat Dec 05, 2015 12:34 pm
by joehot200
Edit: Been waiting for about ~35 days for a reply. I'm not sure if you have seen the thread or not, or if I should contact you by email.

Hi,

Thank you for your patience on other threads. I have managed to import maps into my game, and it looks wonderful.

Image

As you can see though, the texture isn't detailed. I could generate a huge megatexture for it, since I now have the professional edition, but I would prefer a tiling (or I think you call it "Splatting") solution.

Since L3DT doesn't support blend maps(RGBA images specifying textures), and I since would have no idea how to use Alpha maps (also they're unnecessary hard drive space & lots of annoying extra images), I would like to de-code the attributes map in my code to be able to apply the correct textures.

Basically, I need help de-coding the attributes map. What sort of algorithms do you use to de-code the attributes map to work out which textures should be used? How can I make textures transition smoothly at the edges? How can I just in general make it look a lot like the L3DT generated texture, but with my tiled textures instead?

I'm somewhat stuck here, so any help would be appreciated.

Thank you for putting up with my constant questions
Joe

Re: How does the attributes map work?

PostPosted: Thu Dec 24, 2015 10:23 pm
by joehot200
I have taken your approach of using foliage on the terrain to cover up the lack of detail of the terrain underneath.
Image

However, this still leaves terrain further away.
Image

Unless there's any way to either render tons of grass further away without an FPS drop (which, of course, there isn't), then I will probably still have to somehow come up with highly-detailed textures for far-away objects.

Of course, I will also need to change the grass colour to take the colour of the texture below it, or else I appear to get green grass on a snowy hill. However that's an OpenGL problem for me to work on and not really something for L3DT. That said, if you've got any advice you could give me for techniques on that, it would be much appreciated.

Re: How does the attributes map work?

PostPosted: Tue Dec 29, 2015 12:18 pm
by Aaron
Hi joehot200,

I'm terribly sorry for my slow reply.

Since L3DT doesn't support blend maps(RGBA images specifying textures)...


Yeah, it does. Set 'layers per image' to 4 in the alpha mapping wizard, et voiĆ , you get RGBA alpha maps (same as blend maps).

I would like to de-code the attributes map in my code to be able to apply the correct textures.


This is what you seek. Also, this.

How can I make textures transition smoothly at the edges? How can I just in general make it look a lot like the L3DT generated texture, but with my tiled textures instead?


The texture blender in L3DT is relatively straightforward. It's basically just doing CPU-side texture splatting using masks generated from the attributes map. You can get the very same blending masks if you use the alpha maps from L3DT (higher the resolution, the better). The only thing that makes it slightly difficult to repeat on the GPU side at render time is that a) L3DT uses a whole lotta masks (easily more than 10 materials in play on a single terrain.), and b) L3DT suppresses repetition in the output texture by compositing each material's texture from a sequence of several base textures (sometimes the same image) blended at different resolutions.

Best regards,
Aaron.

Re: How does the attributes map work?

PostPosted: Tue Dec 29, 2015 5:22 pm
by joehot200
Aaron wrote:Hi joehot200,

I'm terribly sorry for my slow reply.

Since L3DT doesn't support blend maps(RGBA images specifying textures)...


Yeah, it does. Set 'layers per image' to 4 in the alpha mapping wizard, et voiĆ , you get RGBA alpha maps (same as blend maps).

I would like to de-code the attributes map in my code to be able to apply the correct textures.


This is what you seek. Also, this.

How can I make textures transition smoothly at the edges? How can I just in general make it look a lot like the L3DT generated texture, but with my tiled textures instead?


The texture blender in L3DT is relatively straightforward. It's basically just doing CPU-side texture splatting using masks generated from the attributes map. You can get the very same blending masks if you use the alpha maps from L3DT (higher the resolution, the better). The only thing that makes it slightly difficult to repeat on the GPU side at render time is that a) L3DT uses a whole lotta masks (easily more than 10 materials in play on a single terrain.), and b) L3DT suppresses repetition in the output texture by compositing each material's texture from a sequence of several base textures (sometimes the same image) blended at different resolutions.

Best regards,
Aaron.

Thank you for your reply,

I believe I had somewhat misunderstood how the attributes map worked. I thought it was a blend of what textures are required, but actually, it seems to be a colour representing what texture should be there
Image
As you can see (and probably know already) - No blending there.

So am I correct in saying that the only way to get smooth transitions of tetxures is to use a blend map? Since blend maps can only store 4 colours, how many blend maps would I need? Also, I'm guessing I would have to load them both into my shader, and then define different blend maps for different objects?

Anyway, I'm going to get attribute map texturing working first - Thanks for the help!

Joe

Re: How does the attributes map work?

PostPosted: Wed Dec 30, 2015 10:29 am
by Aaron
joehot200 wrote:it seems to be a colour representing what texture should be there


Pretty much, yes. As far as L3DT is concerned, each pixel in the attributes map is just two numbers that identify the climate and land type. The land type then specifies a material, which in turn works out the textures. The colour of the attributes map is just to give the user something pretty to look at, underneath (and in the map files) it's only two numbers.

joehot200 wrote:So am I correct in saying that the only way to get smooth transitions of textures is to use a blend map?


I'd say so. There may be other ways, but blend maps will be the easiest, and it's a well trodden path, so there will be good API and driver support, etc.

joehot200 wrote:Since blend maps can only store 4 colours, how many blend maps would I need?


That depends on how many land types / materials are in your map. In the alpha map wizard you can combine alpha layers to reduce the image count (see here), but in general I would think you will need of the order of 8 to 12 different materials, so that's 2-3 RGBA alpha maps.

joehot200 wrote:Also, I'm guessing I would have to load them both into my shader, and then define different blend maps for different objects?


Both in your shader, yes. Do you need a separate shader object for each blend map? I'm not sure, as I haven't actually implemented shaders in L3DT yet. If you can pass multiple images through to your shader object, then I'd use just the one object to do the multiple blend maps...but I am not a shader programmer, so I know nothing here.

Cheerio,
Aaron.