4
\$\begingroup\$

Im going through a tutorial to create a basic directx framework, and i've noticed that in there (and other tutorials, when i checked out) use DXGI_FORMAT_R32G32B32A32_FLOAT inside the input element description. is there any reason to use this in a program over DXGI_FORMAT_R8G8B8A8_<something> in terms of noticeable graphical difference? im thinking quadrupling the memory involved to store color would be a little heavy for larger programs.

Also, i don't know if i have this right, but pure coloring isn't used much in more complex programs, and textures are used instead. so does this really matter?

\$\endgroup\$
2
  • \$\begingroup\$ Personnaly, I can't really see the difference between RGB(128/255, 0, 0) and RGB(129/255, 0, 0), so using 32 bits colors seems irrelevant... \$\endgroup\$ Jun 19, 2015 at 12:48
  • \$\begingroup\$ Tutorials tend to use the easiest types. Setting up the vertex color for a DXGI_FORMAT_R32G32B32A32_FLOAT is a simple float[4] array, where setting a BGRA or RGBA 32-bit value takes a little bit magic that might distract from the core lesson. For mesh per-vertex color in 'real world' models, float4 is likely overkill. \$\endgroup\$ Jun 23, 2015 at 7:28

1 Answer 1

8
\$\begingroup\$

For HDR (high dynamic range) rendering, you would want to use more than 8 bits usually - since you are not only encoding color, but also intensity of the light much more precisely (and thus over a greater range) than 8 bit RGB can do.

Of course, your monitor can likely only display 8 bit RGB (if even that), so this only matters if you are actually doing some processing on the data before displaying it using ordinary 8 bit RGB - as is often done with HDR rendering (applying bloom, tone mapping, more realistic lighting...)

So if you use HDR rendering, you sometimes want more bits to more accurately represent the color over a wide range of intensities.

For the CPU side, operating on floating point color values is probably more convenient than working with integers when it comes to operations other than addition/subtraction, as well.

Even if you didnt use HDR rendering, you could use the higher color range to implement dithering on the GPU. This would reduce the color banding effect you get due to 8 bits not being enough for creating visually smooth gradients of color in some cases.

For 'normal' uses of textures, you wont be doing anything that would significantly benefit from more than 8 bits per component.

\$\endgroup\$
3
  • \$\begingroup\$ Most modern GPUs have 10-bit DACs, but it does indeed depend on your exact combination of monitor, cable, GPU, and requires full-screen exclusive mode with 10:10:10:2 or 16:16:16:16 swapchain format to get >8-bits to the viewer. HDR render targets, however, that are tone-mapped to 8-bit or 10-bits can indeed make more compelling visuals, particularly for outdoor scenes. \$\endgroup\$ Jun 23, 2015 at 7:25
  • \$\begingroup\$ HDR rendering setups usually use standard LDR material colors, but the lighting then "blows them out" to HDR. This requires > 8 bit render targets, not necessarily floating-point RGB channel per-vertex colors as is the case in the original question. \$\endgroup\$ Jun 23, 2015 at 7:30
  • \$\begingroup\$ Yeah I have never used HDR rendering so probably some mistakes, I was thinking of skyboxes which are more of a special case then I guess? \$\endgroup\$
    – Waterlimon
    Jun 23, 2015 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .