Rogy-Engine-
Rogy-Engine- copied to clipboard
When I change a different HDR, the engine cannot render
When I change a different HDR, the engine cannot render.
Do you mean different ToneMapping? what happens?
When I change a path,it will show this
don't render
Here is a quick workaround: (I'm adding and fixing stuff and I will update the source code when I finish; thanks for reporting this bug:)) in the renderer.cpp, change the SetEnv_SkyCapture function:
void Renderer::SetEnv_SkyCapture(std::string path)
{
if (SkyPath == path)
return;
ibl.Init(); // ADD THIS
SkyPath = path;
ibl.DeleteCapture(m_SkyCapture);
glDeleteTextures(1, &envCubemap);
ibl.LoadHDR(SkyPath.c_str(), envCubemap );
ibl.CreateCapture(envCubemap, m_SkyCapture);
}
// ----------
And we don't want to load the shaders again so in IBL::Init function you add:
void IBL::Init()
{
// pbr: Load baking shaders (independent from MaterialLibrary)
// ---------------------------------------------
if (!shadersLoaded) // this
{
equirectangularToCubemapShader.loadShader("core/shaders/iblBaking/E2Cubemap.rsh");
irradianceShader.loadShader("core/shaders/iblBaking/irradiance.rsh");
prefilterShader.loadShader("core/shaders/iblBaking/prefilter.rsh");
shadersLoaded = true; // and this
}
.......
}
Also define shadersLoaded in the IBL class as a boolean:
class IBL
{
public:
IBL();
~IBL();
.........
private:
bool shadersLoaded = false; // THIS
};
It's ready to run