• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
cozzie

Power of normal mapping and texture formats?

10 posts in this topic

Hi all,

 

First of all, many thanks for helping me out with some challenges in the journey that's called 'my 3d engine'.

Below 2 screenshots to share the power of normal mapping, amazing what you can do with it. Imagine what adding a specular and/or alpha map can do, not even to talk about cool postprocessing effects... Sky's the limit (although for a lot you this might not be new :)

 

I've found that that when adding nice stuff, texture megabytes are also growing (enormously).

Do you have some pointers how to handle this efficiently? (other then procedural mapping, which is currently out of my league)

 

Some thoughts:

- Always use the same file format? (for example DDS?)

- Could I for example save alpha in normal map textures in the 'Z' channel, which is always sort of the same?
(or would this mean that 'height' will always be the same for all normal maps.. that would be bad I guess)

- How about texture compression?

(my normal map tool, Shadermap, has possibilities to save the maps as "DDS DXT 1 / 3 or 5" for example)

- What exactly is DDS DXT?

 

Curious what your thoughts are.

 

Without normal maps:

 

demo_nonormalmap.jpg

 

With normal maps:

 

demo_normalmap.jpg

 

2

Share this post


Link to post
Share on other sites


Some thoughts:
- Always use the same file format? (for example DDS?)
- Could I for example save alpha in normal map textures in the 'Z' channel, which is always sort of the same?
(or would this mean that 'height' will always be the same for all normal maps.. that would be bad I guess)
- How about texture compression?
(my normal map tool, Shadermap, has possibilities to save the maps as "DDS DXT 1 / 3 or 5" for example)
- What exactly is DDS DXT?

 

DDS is just a container for textures, it's not a format in and of itself.

 

DXT is the compressed format used for DX9. So absolutely use this if you can handle the reduction in quality.

 

Sure you could save the alpha in the blue channel of the normal map. Normally this would be in the alpha channel of your diffuse map though. But you can use stronger compression if you have textures without an alpha channel (DXT1 instead of DXT3/DXT5).

2

Share this post


Link to post
Share on other sites

DXT (DX9) / BC (DX10+) are block compression schemes. They take 4x4 blocks and instead of representing them with 4x4=16 RGB(A) color values, they represent them with only 2 degraded colors (5:6:5-bit instead of 8:8:8-bit) and 16 interpolation coordinates (each 3-bits). DXT1/BC1, for example, will save you always exactly 7/8 of memory, compared to raw R8G8B8A8_UNORM. The cost is quality, obviously.

 

The details vary: http://msdn.microsoft.com/en-us/library/windows/desktop/hh308955%28v=vs.85%29.aspx

 

For example for your normal maps, you might want to use non-compressed formats. But it all depends on how it looks, it has to first look bad enough to reach for a higher quality solution.

Edited by pcmaster
1

Share this post


Link to post
Share on other sites


Could I for example save alpha in normal map textures in the 'Z' channel, which is always sort of the same?

 

It's not always the same, but its value can be derived of the other two components.

 

D3D10 added the BC5_SNORM 2-channel format which lets you store the x and y channels in the normalized [-1, 1] range. The z component can then be re-calculated in-shader. This format provides high quality compression for normal maps.

1

Share this post


Link to post
Share on other sites

DXT it is Compression for DDS;

DXT1 it is strongest compression but it is no oportunity to save alpha channel;

DXT3 is like DXT1 but you can save alpha channel and it takes double memory instead of DXT1;

in d3d9 it is posible to use DXT1 - DXT5 compression for Direct3DTexture9 elements

if you load compressed texture witch function D3DXCreateTextureFromFile()

compression will be automatically taken and applied from file (it means yor texture will be compressed not only on hard disk but too in video memory)

in function D3DXCreateTextureFromFileEX() you may to set image format (for example A8R8G8B8 or DXT1) to any texture

 

you may use any compression for normal maps but CAREFUL normal maps is more sensetive for resolution and compression

than diffuse map!

 

if you will be save normal map in two channels it will takes some calculations in pixel shader and its hard to deside what is more valuable video memory or pixel fill rate

Edited by 8up tuotlo
0

Share this post


Link to post
Share on other sites


- How about texture compression?

(my normal map tool, Shadermap, has possibilities to save the maps as "DDS DXT 1 / 3 or 5" for example)

- What exactly is DDS DXT?

 

This is a really, really good article explaining the BC formats, starting with the DXT1-5 and then going on to talk about the newer DX11 level ones, which you can't use but are still worth knowingabout. http://www.reedbeta.com/blog/2012/02/12/understanding-bcn-texture-compression-formats/

 

My rule of thumb is to always use DXT compression for diffuse maps, and only roll it back to bigger formats if it looks really bad, which for textures destined to be used on 3D models is really quite rare

 

Normal maps are trickier, as the article suggests, using DXT5 with X encoded in the RGB, Y encoded in alpha and Z reconstructed seems reasonable. Note that the increased complexity of the shader as you reconstruct the normal won't necessarily mean that the shader is slower than an 8888 solution. The fact that you'll be fetching 1/4 of the data might* more than compensate for the extra calculations that the shader has to do. If you don't want to invest the time in modifying your shaders so you can use DXT5, then use a 16 bit texture format like 565 as it'll half your texture footprint for a pretty minimal effort.

 

*I say might. I strongly suspect it will be a win on most graphics cards, but a lose on some others. Graphics programming sucks sometimes.

1

Share this post


Link to post
Share on other sites
Thanks, I'l get into the links.
For diffuse maps I'll play around with DXT-3 and 5 (not sure yet what 5 brings compared to 3), with this I'll include the alpha map in the diffuse texture to save an extra texture for blended materials. I'm fully using directx3dtexture9 objects (and d3dx) so this should work fine.

On normal mapping for now I'll stay with DDS format for keeping it structured/ standardized, but without DXT compression.
0

Share this post


Link to post
Share on other sites

Thanks, I'l get into the links.
For diffuse maps I'll play around with DXT-3 and 5 (not sure yet what 5 brings compared to 3), with this I'll include the alpha map in the diffuse texture to save an extra texture for blended materials. I'm fully using directx3dtexture9 objects (and d3dx) so this should work fine.

On normal mapping for now I'll stay with DDS format for keeping it structured/ standardized, but without DXT compression.

 

If you're not sure which to use, use DXT-5 instead of DXT-3, I can't think of any real-life situations where DXT-3 is the better choice (DXT3 vs DXT5 is often referred to as a choice between sharper and smoother, but this is nonsense IMO). Unless you specifically only want 16 different shades of alpha for some reason, use DXT5.

1

Share this post


Link to post
Share on other sites

The only difference between DXT3 (AKA BC2) and DXT5 (AKA BC3) is how it stores the alpha value. In DXT3 the alpha value is explicitly stored as a 4-bit value per texel. In DXT5 the alpha value is interpreted based on a min/max alpha per 4x4 block and 16 indices. DXT5 tends to be more useful for real-world cases, since alpha is usually coherent across an image. 

2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0