MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / computeAlbedoLUT

Method computeAlbedoLUT

Source/Falcor/Scene/Material/MERLFile.cpp:186–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184 }
185
186 void MERLFile::computeAlbedoLUT(ref<Device> pDevice, const size_t binCount)
187 {
188 logInfo("MERLFile: Computing albedo LUT for MERL BRDF '{}'...", mDesc.name);
189
190 std::vector<float> cosThetas(binCount);
191 for (uint32_t i = 0; i < binCount; i++) cosThetas[i] = (float)(i + 1) / binCount;
192
193 // Create MERL material based on loaded data.
194 ref<MERLMaterial> pMaterial = make_ref<MERLMaterial>(pDevice, *this);
195
196 // Create and update dummy scene containing the material.
197 Scene::SceneData sceneData;
198 sceneData.pMaterials = std::make_unique<MaterialSystem>(pDevice);
199 MaterialID materialID = sceneData.pMaterials->addMaterial(pMaterial);
200
201 ref<Scene> pScene = Scene::create(pDevice, std::move(sceneData));
202 pScene->update(pDevice->getRenderContext(), 0.0);
203
204 // Create BSDF integrator utility.
205 BSDFIntegrator integrator(pDevice, pScene);
206
207 // Integrate BSDF.
208 auto albedos = integrator.integrateIsotropic(pDevice->getRenderContext(), materialID, cosThetas);
209
210 // Copy result into RGBA format needed for texture creation.
211 mAlbedoLUT.resize(binCount);
212 for (uint32_t i = 0; i < binCount; i++)
213 mAlbedoLUT[i] = float4(albedos[i], 1.f);
214 }
215}

Callers

nothing calls this directly

Calls 6

logInfoFunction · 0.85
integrateIsotropicMethod · 0.80
createFunction · 0.50
addMaterialMethod · 0.45
updateMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected