63 int numReflectionSamples = 1024,
64 int numAmbientSamples = 2048);
78 static std::vector<uint8_t>
generateAtlasRaw(
const float* srcData,
int srcW,
int srcH,
80 int numReflectionSamples = 1024,
81 int numAmbientSamples = 2048);
104 std::vector<std::vector<std::vector<float>>> data;
108 static HdrCubemap equirectToCubemap(
Texture* source,
int size);
109 static HdrCubemap equirectToCubemap(
const float* srcData,
int srcW,
int srcH,
int size);
112 static void generateMipmaps(HdrCubemap& cubemap);
115 struct Color3 {
float r, g, b; };
116 static Color3 sampleCubemap(
const HdrCubemap& cubemap,
float dirX,
float dirY,
float dirZ,
float mipLevel);
119 static Color3 sampleFace(
const std::vector<float>& faceData,
int faceSize,
float u,
float v);
122 static void dirToFaceUv(
float x,
float y,
float z,
int& face,
float& u,
float& v);
125 static void dirToEquirectUv(
float x,
float y,
float z,
float& u,
float& v);
126 static void equirectUvToDir(
float u,
float v,
float& x,
float& y,
float& z);
129 static void hemisphereSampleGGX(
float& hx,
float& hy,
float& hz,
float xi1,
float xi2,
float a);
130 static void hemisphereSampleLambert(
float& hx,
float& hy,
float& hz,
float xi1,
float xi2);
133 static float D_GGX(
float NoH,
float linearRoughness);
136 static std::array<uint8_t, 4> encodeRGBP(
float r,
float g,
float b);
139 static void writeEquirectRegion(uint8_t* atlas,
int atlasSize,
140 int rx,
int ry,
int rw,
int rh,
141 const HdrCubemap& cubemap,
float mipLevel);
146 static void writeEquirectFromSource(uint8_t* atlas,
int atlasSize,
147 int rx,
int ry,
int rw,
int rh,
148 const float* srcData,
int srcW,
int srcH);
151 static void writeGGXRegion(uint8_t* atlas,
int atlasSize,
152 int rx,
int ry,
int rw,
int rh,
153 const HdrCubemap& cubemap,
154 int specularPower,
int numSamples);
157 static void writeLambertRegion(uint8_t* atlas,
int atlasSize,
158 int rx,
int ry,
int rw,
int rh,
159 const HdrCubemap& cubemap,
int numSamples);
162 static int getRequiredSamplesGGX(
int numSamples,
int specularPower);
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.