Advertisement

Need opinions on material texture setup

Started by September 26, 2009 10:41 PM
8 comments, last by n00body 15 years, 3 months ago
Situation: Okay, I have been trying to find what I think would be the smallest set of textures to cover the vast majority of objects/characters for my game project. I would like to have some input on the setup from artists and programmers alike. Texture Maps: Tex1 1024x1024 DXT1/DXT5 RGB = albedo A = alpha Tex2 1024x1024 DXT5 GA = normal R = detail mask B = reflection mask Tex3 512x512 DXT1 RGB = gloss Tex4 512x512 DXT1 RGB = emissive Detail 128x128 RGBA8/DXT5 GA = normal R = albedo offset B = gloss offset Reasoning: The worst case memory footprint is about 3.0MB, when you have all the textures and channels being used. If you remove the alpha and emissive components, it is only about 2.2MB. This is about as low as I have been able to get it while still keeping texture resolutions high-enough to look decent in HD. At the same time, accounting for all the data that an artist would typically need. Can anyone comment on any other data that might be needed? The albedo and normal maps have the highest resolution because they have the most influence on a surface's appearance. Gloss and emissive are stored at lower resolution because their contributions are usually small and isolated. Also, they are likely to be blown out by the glow effect, so the pixelation will be less noticeable. I had heard that per-pixel specular power isn't commonly used, so I avoided dedicating an extra channel to that. Can anyone say otherwise based on personal experience? I decided to go with detail & reflection masks so that I could shove them in the unused channels of the normal map. Since they will only be 0 or 1, they shouldn't mess up the normal stored in the green channel. One concern I had was with the use of per-pixel masks instead of weights for the reflection & detail maps. Can anyone chime in on the matter? Ambient occlusion will be pre-baked into both the albedo & specular maps to avoid having to store it separately. To the best of my knowledge, there is no real disadvantage to this approach, but I might be wrong. Can anyone comment on this? Closing: Any input would be most appreciated. Personal experience would be best, if possible. Thanks. [Edited by - n00body on September 26, 2009 11:31:39 PM]

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework


an 8-bit specular mask can do wonders to improve the realism of a surface. few materials have a uniform specular across the surface, and this helps break it up and look more realistic.

It's possible you've incorporated this functionality into your gloss map.

Typically only metals give off a specular color that is dependent on the material - if your characters don't have metal bits, you can likely ditch the colored spec (assuming this is what your gloss map is).

Using G+A of a DXT5 for normals is OK, but stuffing other data in the R and B channels is going to make the DXT compression artifacts worse. Consider using a 2-channel texture format like 3Dc for normal maps

What is the detail mask in the normal map for?

To save texture space and increase resolution, consider putting some detail in tiled textures. You can tile them pretty tightly to get very high resolution looking details
Advertisement
The gloss map is for providing colored specular and specular variance across the surface.

The detail mask says which parts of the surface will be combined with a tiled detail map. You can see the detail map format at the bottom of my texture list.

[Edited by - n00body on September 26, 2009 11:55:43 PM]

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

Cool, that's pretty complete, I'd say... Aside of course from any shader/feature-specific textures you might desire

Depending on how you're drawing things, you might consider splitting the alpha channel of the color texture into a separate texture - it can halve the size of that texture if you don't need both pieces of information in the same pass, reducing texture cache pressure.
where can i find more information about this type of system?

I'm more accustomed to the terminology of 3dsmax (diffuse, specular, gloss, bump, reflect, etc) so these terms are a bit confusing to me.
Just some thoughts:

1. memory footprint
Quote:
The worst case memory footprint is about 3.0MB, when you have all the textures and channels being used.

Do you have considered mipmapping ? With mipmapping your worst case memory footprint is about 6MB.

2. normal compression
Quote:
Using G+A of a DXT5 for normals is OK, but stuffing other data in the R and B channels is going to make the DXT compression artifacts worse. Consider using a 2-channel texture format like 3Dc for normal maps.

I seconded this one. Best compression quality for normals with DXT5 is by clearing the R+G channels. If I remember correctly, putting one value (i.e. gloss) into both R+B channels might give you one addtional channel with better compression than using both channels for diffent values.

3. texture units and atlas
In the worst case scenario you already use 5 diffent textures, this is about 5 texture units. What is your target hardware ? More than 4 texture units could be a problem for older hardware. Did you consider that there are other textures like reflection, light, and shadow maps which will need additional texture units ?
To reduce texture unit demand, you could use a texture atlas, but there you need atleast the same texture format.

4. engine
Quote:
where can i find more information about this type of system?

Your texture setup looks already customized to a special render engine. Every render engine uses diffent texture setups, supporting different texture configuration and special shader textures. If you're an artist without a fixed target render engine I would create more common textures(one for gloss, one for albedo etc.) in a lossless compression format like png or tga.

Ashaman
--
Ashaman
Advertisement
Perhaps a little more context is in order.

1.) My numbers included mip-mapping, both for DXT1 & DXT5.

2.) As I mentioned, I figured it would be fine if I made sure it was just a mask, limiting it to two possible values. From what I had heard, as long as the values are consistent across a 4x4 block of pixels, it wouldn't distort the compression too badly. Though I am starting to think that while I may be able to get away with the detail map mask in the normal map, I may not be able to keep the reflection mask. I considered this approach in the first place because Insomniac Games mentioned that they used all four channels for their detail map format (mine is exactly the same as theirs).

I had not heard of that trick you mentioned, where you mirror the value across the R+B channels. I will have to look into it, so thanks for mentioning it.

3.) I am targeting SM3.0 hardware with a hybrid renderer similar to what is being used by Starcraft 2. Directional lights will be forward rendered during the g-buffer phase. There will be shadowing from one direction (likely CSM or just orthographic) rendered during the g-buffer phase. Reflections will be provided by Radially Symmetric Reflection Maps, which only requires one small 2D map, and is also rendered during the G-buffer phase. So it only really comes out to about 7-8 maps in total for the worst case.

4.) That wasn't me. He was asking a different question, unrelated to mine.

[Edited by - n00body on September 28, 2009 6:32:19 AM]

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

Quote: Original post by Ashaman73
What is your target hardware ? More than 4 texture units could be a problem for older hardware.

He's using normal maps, so he's targeting SM2-level hardware or higher, which are ok with at least 8 texture units if I'm not mistaken.
Quote:
Quote:
where can i find more information about this type of system?

Your texture setup looks already customized to a special render engine.

That's a different dude, not the OP.
[edit]Oopsies... posted at the same time. My post is now redundant :(
Quote:
So it only really comes out to about 7-8 maps in total for the worst case.

Just asking, cause I thought that low-end hardware with SM3.0 support like GF6200,
GF7300, or
GF8300/8400 only got 4 texture units (<> texture coords ).

--
Ashaman
Last I'd checked, all modern cards support at least 16 texture units in a shader.

Anyway, let's get off the tangents and back to my original topic.

[Edited by - n00body on September 28, 2009 12:05:26 PM]

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

This topic is closed to new replies.

Advertisement