mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:18:05 +02:00
And cleaning again hopping to have the pr build
This commit is contained in:
commit
07c630bcda
6 changed files with 36 additions and 17 deletions
|
@ -52,7 +52,7 @@ var overlaysCounter = new CounterWidget(panel, "Overlays", Render.overlay3D);
|
||||||
|
|
||||||
var resizing = false;
|
var resizing = false;
|
||||||
var previousMode = Settings.getValue(SETTINGS_KEY, -1);
|
var previousMode = Settings.getValue(SETTINGS_KEY, -1);
|
||||||
previousMode = -1;
|
previousMode = 8;
|
||||||
Menu.addActionGroup(MENU, ACTIONS, ACTIONS[previousMode + 1]);
|
Menu.addActionGroup(MENU, ACTIONS, ACTIONS[previousMode + 1]);
|
||||||
Render.deferredDebugMode = previousMode;
|
Render.deferredDebugMode = previousMode;
|
||||||
Render.deferredDebugSize = { x: 0.0, y: -1.0, z: 1.0, w: 1.0 }; // Reset to default size
|
Render.deferredDebugSize = { x: 0.0, y: -1.0, z: 1.0, w: 1.0 }; // Reset to default size
|
||||||
|
|
|
@ -227,7 +227,7 @@ void AmbientOcclusionEffect::setRadius(float radius) {
|
||||||
auto& current = _parametersBuffer.edit<Parameters>()._radiusInfo;
|
auto& current = _parametersBuffer.edit<Parameters>()._radiusInfo;
|
||||||
current.x = radius;
|
current.x = radius;
|
||||||
current.y = radius * radius;
|
current.y = radius * radius;
|
||||||
current.z = 1.0f / pow((double)radius, 6.0);
|
current.z = (float)(1.0 / pow((double)radius, 6.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,20 +391,22 @@ void AmbientOcclusionEffect::run(const render::SceneContextPointer& sceneContext
|
||||||
batch.setPipeline(occlusionPipeline);
|
batch.setPipeline(occlusionPipeline);
|
||||||
batch.setResourceTexture(AmbientOcclusionEffect_PyramidMapSlot, pyramidFBO->getRenderBuffer(0));
|
batch.setResourceTexture(AmbientOcclusionEffect_PyramidMapSlot, pyramidFBO->getRenderBuffer(0));
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
batch.setResourceTexture(AmbientOcclusionEffect_PyramidMapSlot + 1, gpu::TexturePointer());
|
|
||||||
|
|
||||||
// Blur 1st pass
|
if (getBlurRadius() > 0) {
|
||||||
batch.setFramebuffer(occlusionBlurredFBO);
|
// Blur 1st pass
|
||||||
batch.setPipeline(firstHBlurPipeline);
|
batch.setFramebuffer(occlusionBlurredFBO);
|
||||||
batch.setResourceTexture(AmbientOcclusionEffect_OcclusionMapSlot, occlusionFBO->getRenderBuffer(0));
|
batch.setPipeline(firstHBlurPipeline);
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.setResourceTexture(AmbientOcclusionEffect_OcclusionMapSlot, occlusionFBO->getRenderBuffer(0));
|
||||||
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
// Blur 2nd pass
|
|
||||||
batch.setFramebuffer(occlusionFBO);
|
|
||||||
batch.setPipeline(lastVBlurPipeline);
|
|
||||||
batch.setResourceTexture(AmbientOcclusionEffect_OcclusionMapSlot, occlusionBlurredFBO->getRenderBuffer(0));
|
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
|
||||||
|
|
||||||
|
// Blur 2nd pass
|
||||||
|
batch.setFramebuffer(occlusionFBO);
|
||||||
|
batch.setPipeline(lastVBlurPipeline);
|
||||||
|
batch.setResourceTexture(AmbientOcclusionEffect_OcclusionMapSlot, occlusionBlurredFBO->getRenderBuffer(0));
|
||||||
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
|
}
|
||||||
|
|
||||||
_gpuTimer.end(batch);
|
_gpuTimer.end(batch);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ static const std::string DEFAULT_ROUGHNESS_SHADER {
|
||||||
};
|
};
|
||||||
static const std::string DEFAULT_NORMAL_SHADER {
|
static const std::string DEFAULT_NORMAL_SHADER {
|
||||||
"vec4 getFragmentColor() {"
|
"vec4 getFragmentColor() {"
|
||||||
" return vec4(normalize(texture(normalMap, uv).xyz), 1.0);"
|
" return vec4(normalize(texture(normalMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);"
|
||||||
" }"
|
" }"
|
||||||
};
|
};
|
||||||
static const std::string DEFAULT_DEPTH_SHADER {
|
static const std::string DEFAULT_DEPTH_SHADER {
|
||||||
|
@ -89,6 +89,8 @@ static const std::string DEFAULT_PYRAMID_DEPTH_SHADER {
|
||||||
static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
|
static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
|
||||||
"vec4 getFragmentColor() {"
|
"vec4 getFragmentColor() {"
|
||||||
" return vec4(vec3(texture(occlusionMap, uv).x), 1.0);"
|
" return vec4(vec3(texture(occlusionMap, uv).x), 1.0);"
|
||||||
|
// When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);"
|
||||||
|
// when drawing normal " return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);"
|
||||||
" }"
|
" }"
|
||||||
};
|
};
|
||||||
static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{
|
static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{
|
||||||
|
|
|
@ -187,6 +187,8 @@ void DeferredLightingEffect::render(const render::RenderContextPointer& renderCo
|
||||||
batch.setResourceTexture(DEFERRED_BUFFER_NORMAL_UNIT, framebufferCache->getDeferredNormalTexture());
|
batch.setResourceTexture(DEFERRED_BUFFER_NORMAL_UNIT, framebufferCache->getDeferredNormalTexture());
|
||||||
batch.setResourceTexture(DEFERRED_BUFFER_EMISSIVE_UNIT, framebufferCache->getDeferredSpecularTexture());
|
batch.setResourceTexture(DEFERRED_BUFFER_EMISSIVE_UNIT, framebufferCache->getDeferredSpecularTexture());
|
||||||
batch.setResourceTexture(DEFERRED_BUFFER_DEPTH_UNIT, framebufferCache->getPrimaryDepthTexture());
|
batch.setResourceTexture(DEFERRED_BUFFER_DEPTH_UNIT, framebufferCache->getPrimaryDepthTexture());
|
||||||
|
|
||||||
|
// need to assign the white texture if ao is off
|
||||||
if (renderContext->getOcclusionStatus()) {
|
if (renderContext->getOcclusionStatus()) {
|
||||||
batch.setResourceTexture(DEFERRED_BUFFER_OBSCURANCE_UNIT, framebufferCache->getOcclusionTexture());
|
batch.setResourceTexture(DEFERRED_BUFFER_OBSCURANCE_UNIT, framebufferCache->getOcclusionTexture());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -105,7 +105,8 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
|
|
||||||
|
|
||||||
// For AO:
|
// For AO:
|
||||||
_depthPyramidTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), width, height, smoothSampler));
|
auto pointMipSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_POINT);
|
||||||
|
_depthPyramidTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RGB), width, height, pointMipSampler));
|
||||||
_depthPyramidFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_depthPyramidFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
_depthPyramidFramebuffer->setRenderBuffer(0, _depthPyramidTexture);
|
_depthPyramidFramebuffer->setRenderBuffer(0, _depthPyramidTexture);
|
||||||
_depthPyramidFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
_depthPyramidFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
||||||
|
|
|
@ -64,7 +64,6 @@ vec3 getOffsetPosition(ivec2 side, ivec2 ssC, vec2 unitOffset, float ssR) {
|
||||||
// Manually clamp to the texture size because texelFetch bypasses the texture unit
|
// Manually clamp to the texture size because texelFetch bypasses the texture unit
|
||||||
ivec2 mipP = clamp(ssPFull >> mipLevel, ivec2(0), textureSize(pyramidMap, getResolutionLevel() + mipLevel) - ivec2(1));
|
ivec2 mipP = clamp(ssPFull >> mipLevel, ivec2(0), textureSize(pyramidMap, getResolutionLevel() + mipLevel) - ivec2(1));
|
||||||
P.z = -texelFetch(pyramidMap, mipP, getResolutionLevel() + mipLevel).r;
|
P.z = -texelFetch(pyramidMap, mipP, getResolutionLevel() + mipLevel).r;
|
||||||
// P.z = -texelFetch(pyramidMap, ssPFull, 0).r;
|
|
||||||
|
|
||||||
// Offset to pixel center
|
// Offset to pixel center
|
||||||
vec2 tapUV = (vec2(ssP) + vec2(0.5)) / getStereoSideWidth();
|
vec2 tapUV = (vec2(ssP) + vec2(0.5)) / getStereoSideWidth();
|
||||||
|
@ -137,4 +136,17 @@ void main(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
outFragColor = vec4(packOcclusionDepth(A, CSZToDephtKey(Cp.z)), 1.0);
|
outFragColor = vec4(packOcclusionDepth(A, CSZToDephtKey(Cp.z)), 1.0);
|
||||||
|
|
||||||
|
<! // KEEP IT for Debugging
|
||||||
|
// Debug Normal: outFragColor = vec4((Cn + vec3(1.0))* 0.5, 1.0);
|
||||||
|
// Debug Radius outFragColor = vec4(vec3(ssDiskRadius / 100.0), 1.0);
|
||||||
|
// Debug MaxMiplevel outFragColor = vec4(1.0 - vec3(float(clamp(findMSB(int(ssDiskRadius)) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL))/ float(MAX_MIP_LEVEL)), 1.0);
|
||||||
|
// Debug OffsetPosition
|
||||||
|
float ssR;
|
||||||
|
vec2 unitOffset = tapLocation(int(getNumSamples() - 1), 0, ssR);
|
||||||
|
vec3 Q = getOffsetPosition(side, ssC, unitOffset, ssR * ssDiskRadius);
|
||||||
|
//outFragColor = vec4(vec3(Q.x / 10.0, Q.y / 2.0, -Q.z/ 3.0), 1.0);
|
||||||
|
vec3 v = normalize(Q - Cp);
|
||||||
|
outFragColor = vec4((v + vec3(1.0))* 0.5, 1.0);
|
||||||
|
!>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue