mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 02:23:38 +02:00
Moved antialiasing before tonemapping
This commit is contained in:
parent
d3114cbc67
commit
419e064e65
4 changed files with 13 additions and 9 deletions
|
@ -41,15 +41,19 @@ vec3 color_LinearToYCoCg(vec3 rgb) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 color_YCoCgToLinear(vec3 ycocg) {
|
vec3 color_YCoCgToUnclampedLinear(vec3 ycocg) {
|
||||||
// R = Y + Co - Cg
|
// R = Y + Co - Cg
|
||||||
// G = Y + Cg
|
// G = Y + Cg
|
||||||
// B = Y - Co - Cg
|
// B = Y - Co - Cg
|
||||||
return clamp(vec3(
|
return vec3(
|
||||||
ycocg.x + ycocg.y - ycocg.z,
|
ycocg.x + ycocg.y - ycocg.z,
|
||||||
ycocg.x + ycocg.z,
|
ycocg.x + ycocg.z,
|
||||||
ycocg.x - ycocg.y - ycocg.z
|
ycocg.x - ycocg.y - ycocg.z
|
||||||
), vec3(0.0), vec3(1.0));
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 color_YCoCgToLinear(vec3 ycocg) {
|
||||||
|
return clamp(color_YCoCgToUnclampedLinear(ycocg), vec3(0.0), vec3(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
<@func declareColorWheel()@>
|
<@func declareColorWheel()@>
|
||||||
|
|
|
@ -333,7 +333,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
auto& antiAliasingBuffer = _antialiasingBuffers->edit(i);
|
auto& antiAliasingBuffer = _antialiasingBuffers->edit(i);
|
||||||
antiAliasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("antialiasing"));
|
antiAliasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("antialiasing"));
|
||||||
auto format = gpu::Element::COLOR_SRGBA_32; // DependencyManager::get<FramebufferCache>()->getLightingTexture()->getTexelFormat();
|
auto format = sourceBuffer->getRenderBuffer(0)->getTexelFormat();
|
||||||
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR);
|
||||||
_antialiasingTextures[i] = gpu::Texture::createRenderBuffer(format, width, height, gpu::Texture::SINGLE_MIP, defaultSampler);
|
_antialiasingTextures[i] = gpu::Texture::createRenderBuffer(format, width, height, gpu::Texture::SINGLE_MIP, defaultSampler);
|
||||||
antiAliasingBuffer->setRenderBuffer(0, _antialiasingTextures[i]);
|
antiAliasingBuffer->setRenderBuffer(0, _antialiasingTextures[i]);
|
||||||
|
|
|
@ -190,6 +190,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
|
|
||||||
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
||||||
|
|
||||||
|
// AA job to be revisited
|
||||||
|
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, lightingFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
|
||||||
|
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
|
||||||
|
|
||||||
// Add bloom
|
// Add bloom
|
||||||
const auto bloomInputs = Bloom::Inputs(deferredFrameTransform, lightingFramebuffer).asVarying();
|
const auto bloomInputs = Bloom::Inputs(deferredFrameTransform, lightingFramebuffer).asVarying();
|
||||||
task.addJob<Bloom>("Bloom", bloomInputs);
|
task.addJob<Bloom>("Bloom", bloomInputs);
|
||||||
|
@ -246,10 +250,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<DrawBounds>("DrawOverlayInFrontTransparentBounds", overlaysInFrontTransparent);
|
task.addJob<DrawBounds>("DrawOverlayInFrontTransparentBounds", overlaysInFrontTransparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AA job to be revisited
|
|
||||||
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, primaryFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
|
|
||||||
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
|
|
||||||
|
|
||||||
// Debugging stages
|
// Debugging stages
|
||||||
{
|
{
|
||||||
// Debugging Deferred buffer job
|
// Debugging Deferred buffer job
|
||||||
|
|
|
@ -94,7 +94,7 @@ vec4 taa_fetchColor(sampler2D map, vec2 uv) {
|
||||||
|
|
||||||
vec3 taa_resolveColor(vec3 color) {
|
vec3 taa_resolveColor(vec3 color) {
|
||||||
#if USE_YCOCG
|
#if USE_YCOCG
|
||||||
return color_YCoCgToLinear(color);
|
return max(vec3(0), color_YCoCgToUnclampedLinear(color));
|
||||||
#else
|
#else
|
||||||
return color;
|
return color;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue