Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Frostbite PBR: different compression on separate texture channels of the same texture

Is it possible, and if yes how would it be possible, to create and read a RGBA Texture with different compression algorithms on separate channels in OpenGL4.x:

Example A without real meaning:

  1. RG channels stores a normal map encoded in 3Dc
  2. B channel stores height values for lets say tesselation with some encoding
  3. A channel stores raw MaterialID without compression

Example B:

  1. RGB stores material parameters compressed with DXT1
  2. A saves MaterialID without compression

Background:

In the Frostbite implementation of Physically Based Rendering PBR (PDF) on page 15 and 18, the authors are describing how they structured material parameters into different texture channels. They also mention that they avoided texture compression on some channels not going into detail which channels they mean by that.

Page 15

All basic attributes (Normal, BaseColor, Smoothness, MetalMask, Reflectance) need to be blendable to support deferred decals. Unblendable attributes, like MaterialId are stored into the alpha channel. We have also avoided compression and encoding mechanisms which could affect blending quality.

Page 18

We chose to avoid compression on few of our attributes and rely on simple, linearly-interpolating alpha blending in this case.

like image 902
James Takarashy Avatar asked Nov 08 '22 08:11

James Takarashy


1 Answers

There is no OpenGL or Hardware support for reading in a texture with different compression on different channels. Of course, one could create a prepass which would split such a handcrafted texture into separate textures and then decompress these separately.

As Nicol Bolas suggested, the Frostbite PBR implementation avoids compression due to blending.

like image 156
James Takarashy Avatar answered Dec 15 '22 14:12

James Takarashy