Jump to content

Why are deferred and alpha blended materials differently shaded


photo

Recommended Posts

Hi,

 

we did observe that alpha blended and deferred materials have completly different shading when using a LightEnvironmentProbe with a static cubemap environment texture baked by the probe.

This results in a much darker shading than only deferred.

In the example you can also see when setting the dynamic mode and increase renderpasses the probe starts to flicker.

When not using a environment probe the shading is more equal to deferred.

Is there any bugfix, workarround for these two problems?

alpha_env_probe.thumb.PNG.3db9259597f5930dd4a2e4d5711bcca7.PNG

 

alpha_env_probe001.PNG.bd96d901a50892ca0a1c050145ae8bd8.PNG

Thanks

Sebastian

 

 

 

 

data.zip

Link to comment

Hi did change the setting by code and editor but the shading is still a little bit different.

In our application it did not change anything.

I generate the textures dynamically on application startup since we are loading different environments on the fly.

	//Initialize Environment Probe on startup	
	m_probe = Unigine::LightEnvironmentProbe::create(Unigine::Math::vec4(1, 1, 1, 1), Unigine::Math::vec3(100000, 100000, 100000), "");
	m_probe->setDynamic(0);
	m_probe->setEnabled(1);
	m_probe->setPosition(Unigine::Math::Vec3(0, 0, 150));
	m_probe->setSkyCutout(1);
	m_probe->setBoxProjection(1);
	m_probe->setBoxSize(Unigine::Math::vec3(100000, 100000, 100000));
	m_probe->setZNear(10);
	m_probe->setZFar(100000);
	m_probe->setRenderFacesPerFrame(6);
	m_probe->setAmbientEnabled(true);
.
.
.
	//When first frame gets rendered after everything is loaded set it to dynamic
	m_probe->setDynamic(1);
.
.
.
	//After frame is rendered copy texture from dynamic and save it and change probe to not dynamic
	m_probeTexture = m_probe->getTexture();
	auto image = Unigine::Image::create();
	m_probeTexture->getImage(image);
	auto savepath = AT2Builder::getTempPath() + std::string("ung_environment.dds");
	//Unigine::FileSystem::get()->addBlobFile(savepath.c_str());
	image->save(savepath.c_str());
	m_probe->setTexturePath(savepath.c_str());
	m_probe->setDynamic(0);

This is with environment probe:

image.png.42afae20ddc9afebde86d5bf07b4bab6.png

 

This is without environment probe:

image.png.c941964f85b48b6c17776e1e31173716.png

Link to comment

Hello Sebastian,

There is a bug causing Alpha Blend materials to be lit by ambient lightning from Environment Probe even if it's turned off. When you turn on Ambient in light environment probe both deffered and alpha blended materials should be lit with the same intensity. 

I've added this issue to our internal bugtracker with highest priority, it should be fixed in upcoming release

Sorry for the inconvenience caused

Link to comment

Is this code correct? Because I don't see any changes when enabling ambient.

We are using OpenGL.

m_probe->setAmbientEnabled(true);

 

Note: The asphalt is alpha blended material, the grass and buildings are deferred material.

Edited by sebastian.vesenmayer
Link to comment

Hello Sebastian,

Environment probe with box projection rendering on Alpha blended materials could rely on position of Environment probe center. You can try setting GI parameter to zero. Other way to get rid of this effect is to use spherical projection.
If it won't help, please let is know

Thanks

Link to comment
×
×
  • Create New...