mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:17:02 +02:00
Merge pull request #6033 from samcake/hobbes
FIxing the backgroung leaking in the rear view mirror and moving from Float32 to 24 bits Depth buffer
This commit is contained in:
commit
e2e086ef55
10 changed files with 44 additions and 58 deletions
|
@ -205,6 +205,13 @@ void Batch::setViewportTransform(const Vec4i& viewport) {
|
||||||
_params.push_back(cacheData(sizeof(Vec4i), &viewport));
|
_params.push_back(cacheData(sizeof(Vec4i), &viewport));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Batch::setDepthRangeTransform(float nearDepth, float farDepth) {
|
||||||
|
ADD_COMMAND(setDepthRangeTransform);
|
||||||
|
|
||||||
|
_params.push_back(farDepth);
|
||||||
|
_params.push_back(nearDepth);
|
||||||
|
}
|
||||||
|
|
||||||
void Batch::setPipeline(const PipelinePointer& pipeline) {
|
void Batch::setPipeline(const PipelinePointer& pipeline) {
|
||||||
ADD_COMMAND(setPipeline);
|
ADD_COMMAND(setPipeline);
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,7 @@ public:
|
||||||
void setProjectionTransform(const Mat4& proj);
|
void setProjectionTransform(const Mat4& proj);
|
||||||
// Viewport is xy = low left corner in framebuffer, zw = width height of the viewport, expressed in pixels
|
// Viewport is xy = low left corner in framebuffer, zw = width height of the viewport, expressed in pixels
|
||||||
void setViewportTransform(const Vec4i& viewport);
|
void setViewportTransform(const Vec4i& viewport);
|
||||||
|
void setDepthRangeTransform(float nearDepth, float farDepth);
|
||||||
|
|
||||||
// Pipeline Stage
|
// Pipeline Stage
|
||||||
void setPipeline(const PipelinePointer& pipeline);
|
void setPipeline(const PipelinePointer& pipeline);
|
||||||
|
@ -285,6 +286,7 @@ public:
|
||||||
COMMAND_setViewTransform,
|
COMMAND_setViewTransform,
|
||||||
COMMAND_setProjectionTransform,
|
COMMAND_setProjectionTransform,
|
||||||
COMMAND_setViewportTransform,
|
COMMAND_setViewportTransform,
|
||||||
|
COMMAND_setDepthRangeTransform,
|
||||||
|
|
||||||
COMMAND_setPipeline,
|
COMMAND_setPipeline,
|
||||||
COMMAND_setStateBlendFactor,
|
COMMAND_setStateBlendFactor,
|
||||||
|
|
|
@ -14,11 +14,12 @@
|
||||||
out vec2 varTexCoord0;
|
out vec2 varTexCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
const float depth = 1.0;
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
vec4(-1.0, -1.0, depth, 1.0),
|
||||||
vec4(1.0, -1.0, 0.0, 1.0),
|
vec4(1.0, -1.0, depth, 1.0),
|
||||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
vec4(-1.0, 1.0, depth, 1.0),
|
||||||
vec4(1.0, 1.0, 0.0, 1.0)
|
vec4(1.0, 1.0, depth, 1.0)
|
||||||
);
|
);
|
||||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
||||||
(&::gpu::GLBackend::do_setViewTransform),
|
(&::gpu::GLBackend::do_setViewTransform),
|
||||||
(&::gpu::GLBackend::do_setProjectionTransform),
|
(&::gpu::GLBackend::do_setProjectionTransform),
|
||||||
(&::gpu::GLBackend::do_setViewportTransform),
|
(&::gpu::GLBackend::do_setViewportTransform),
|
||||||
|
(&::gpu::GLBackend::do_setDepthRangeTransform),
|
||||||
|
|
||||||
(&::gpu::GLBackend::do_setPipeline),
|
(&::gpu::GLBackend::do_setPipeline),
|
||||||
(&::gpu::GLBackend::do_setStateBlendFactor),
|
(&::gpu::GLBackend::do_setStateBlendFactor),
|
||||||
|
|
|
@ -314,6 +314,7 @@ protected:
|
||||||
void do_setViewTransform(Batch& batch, uint32 paramOffset);
|
void do_setViewTransform(Batch& batch, uint32 paramOffset);
|
||||||
void do_setProjectionTransform(Batch& batch, uint32 paramOffset);
|
void do_setProjectionTransform(Batch& batch, uint32 paramOffset);
|
||||||
void do_setViewportTransform(Batch& batch, uint32 paramOffset);
|
void do_setViewportTransform(Batch& batch, uint32 paramOffset);
|
||||||
|
void do_setDepthRangeTransform(Batch& batch, uint32 paramOffset);
|
||||||
|
|
||||||
void initTransform();
|
void initTransform();
|
||||||
void killTransform();
|
void killTransform();
|
||||||
|
@ -339,6 +340,7 @@ protected:
|
||||||
Transform _view;
|
Transform _view;
|
||||||
Mat4 _projection;
|
Mat4 _projection;
|
||||||
Vec4i _viewport{ 0, 0, 1, 1 };
|
Vec4i _viewport{ 0, 0, 1, 1 };
|
||||||
|
Vec2 _depthRange{ 0.0f, 1.0f };
|
||||||
bool _invalidModel{true};
|
bool _invalidModel{true};
|
||||||
bool _invalidView{false};
|
bool _invalidView{false};
|
||||||
bool _invalidProj{false};
|
bool _invalidProj{false};
|
||||||
|
|
|
@ -45,10 +45,21 @@ void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
|
||||||
|
|
||||||
glViewport(vp.x, vp.y, vp.z, vp.w);
|
glViewport(vp.x, vp.y, vp.z, vp.w);
|
||||||
|
|
||||||
// The Viewport is tagged invalid because the CameraTransformUBO is not up to date and willl need update on next drawcall
|
// The Viewport is tagged invalid because the CameraTransformUBO is not up to date and will need update on next drawcall
|
||||||
_transform._invalidViewport = true;
|
_transform._invalidViewport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLBackend::do_setDepthRangeTransform(Batch& batch, uint32 paramOffset) {
|
||||||
|
|
||||||
|
Vec2 depthRange(batch._params[paramOffset + 0]._float, batch._params[paramOffset + 1]._float);
|
||||||
|
|
||||||
|
if ((depthRange.x != _transform._depthRange.x) || (depthRange.y != _transform._depthRange.y)) {
|
||||||
|
_transform._depthRange = depthRange;
|
||||||
|
|
||||||
|
glDepthRangef(depthRange.x, depthRange.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLBackend::initTransform() {
|
void GLBackend::initTransform() {
|
||||||
glGenBuffers(1, &_transform._objectBuffer);
|
glGenBuffers(1, &_transform._objectBuffer);
|
||||||
glGenBuffers(1, &_transform._cameraBuffer);
|
glGenBuffers(1, &_transform._cameraBuffer);
|
||||||
|
@ -75,6 +86,8 @@ void GLBackend::syncTransformStateCache() {
|
||||||
|
|
||||||
glGetIntegerv(GL_VIEWPORT, (GLint*) &_transform._viewport);
|
glGetIntegerv(GL_VIEWPORT, (GLint*) &_transform._viewport);
|
||||||
|
|
||||||
|
glGetFloatv(GL_DEPTH_RANGE, (GLfloat*)&_transform._depthRange);
|
||||||
|
|
||||||
Mat4 modelView;
|
Mat4 modelView;
|
||||||
auto modelViewInv = glm::inverse(modelView);
|
auto modelViewInv = glm::inverse(modelView);
|
||||||
_transform._view.evalFromRawMatrix(modelViewInv);
|
_transform._view.evalFromRawMatrix(modelViewInv);
|
||||||
|
|
|
@ -35,9 +35,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) {
|
||||||
_frameBufferSize = frameBufferSize;
|
_frameBufferSize = frameBufferSize;
|
||||||
_primaryFramebufferFull.reset();
|
_primaryFramebufferFull.reset();
|
||||||
_primaryFramebufferDepthColor.reset();
|
_primaryFramebufferDepthColor.reset();
|
||||||
_primaryFramebufferStencilColor.reset();
|
|
||||||
_primaryDepthTexture.reset();
|
_primaryDepthTexture.reset();
|
||||||
_primaryStencilTexture.reset();
|
|
||||||
_primaryColorTexture.reset();
|
_primaryColorTexture.reset();
|
||||||
_primaryNormalTexture.reset();
|
_primaryNormalTexture.reset();
|
||||||
_primarySpecularTexture.reset();
|
_primarySpecularTexture.reset();
|
||||||
|
@ -49,7 +47,6 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) {
|
||||||
void FramebufferCache::createPrimaryFramebuffer() {
|
void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
_primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
_primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
_primaryFramebufferStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
|
||||||
|
|
||||||
auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
|
||||||
auto width = _frameBufferSize.width();
|
auto width = _frameBufferSize.width();
|
||||||
|
@ -66,20 +63,14 @@ void FramebufferCache::createPrimaryFramebuffer() {
|
||||||
|
|
||||||
_primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture);
|
_primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture);
|
||||||
|
|
||||||
_primaryFramebufferStencilColor->setRenderBuffer(0, _primaryColorTexture);
|
// auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);
|
||||||
|
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
||||||
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);
|
|
||||||
_primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
|
_primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
|
||||||
|
|
||||||
auto stencilFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
|
|
||||||
_primaryStencilTexture = gpu::TexturePointer(gpu::Texture::create2D(stencilFormat, width, height, defaultSampler));
|
|
||||||
|
|
||||||
_primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
_primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
||||||
|
|
||||||
_primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
_primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
|
||||||
|
|
||||||
_primaryFramebufferStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat);
|
|
||||||
|
|
||||||
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
_selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
|
||||||
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
|
||||||
_selfieFramebuffer->setRenderBuffer(0, tex);
|
_selfieFramebuffer->setRenderBuffer(0, tex);
|
||||||
|
@ -99,13 +90,6 @@ gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthColor() {
|
||||||
return _primaryFramebufferDepthColor;
|
return _primaryFramebufferDepthColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferStencilColor() {
|
|
||||||
if (!_primaryFramebufferStencilColor) {
|
|
||||||
createPrimaryFramebuffer();
|
|
||||||
}
|
|
||||||
return _primaryFramebufferStencilColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {
|
gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {
|
||||||
if (!_primaryDepthTexture) {
|
if (!_primaryDepthTexture) {
|
||||||
createPrimaryFramebuffer();
|
createPrimaryFramebuffer();
|
||||||
|
@ -113,13 +97,6 @@ gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {
|
||||||
return _primaryDepthTexture;
|
return _primaryDepthTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::TexturePointer FramebufferCache::getPrimaryStencilTexture() {
|
|
||||||
if (!_primaryStencilTexture) {
|
|
||||||
createPrimaryFramebuffer();
|
|
||||||
}
|
|
||||||
return _primaryStencilTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() {
|
gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() {
|
||||||
if (!_primaryColorTexture) {
|
if (!_primaryColorTexture) {
|
||||||
createPrimaryFramebuffer();
|
createPrimaryFramebuffer();
|
||||||
|
|
|
@ -31,10 +31,8 @@ public:
|
||||||
/// used for scene rendering.
|
/// used for scene rendering.
|
||||||
gpu::FramebufferPointer getPrimaryFramebuffer();
|
gpu::FramebufferPointer getPrimaryFramebuffer();
|
||||||
gpu::FramebufferPointer getPrimaryFramebufferDepthColor();
|
gpu::FramebufferPointer getPrimaryFramebufferDepthColor();
|
||||||
gpu::FramebufferPointer getPrimaryFramebufferStencilColor();
|
|
||||||
|
|
||||||
gpu::TexturePointer getPrimaryDepthTexture();
|
gpu::TexturePointer getPrimaryDepthTexture();
|
||||||
gpu::TexturePointer getPrimaryStencilTexture();
|
|
||||||
gpu::TexturePointer getPrimaryColorTexture();
|
gpu::TexturePointer getPrimaryColorTexture();
|
||||||
gpu::TexturePointer getPrimaryNormalTexture();
|
gpu::TexturePointer getPrimaryNormalTexture();
|
||||||
gpu::TexturePointer getPrimarySpecularTexture();
|
gpu::TexturePointer getPrimarySpecularTexture();
|
||||||
|
@ -60,9 +58,8 @@ private:
|
||||||
|
|
||||||
gpu::FramebufferPointer _primaryFramebufferFull;
|
gpu::FramebufferPointer _primaryFramebufferFull;
|
||||||
gpu::FramebufferPointer _primaryFramebufferDepthColor;
|
gpu::FramebufferPointer _primaryFramebufferDepthColor;
|
||||||
gpu::FramebufferPointer _primaryFramebufferStencilColor;
|
|
||||||
gpu::TexturePointer _primaryDepthTexture;
|
gpu::TexturePointer _primaryDepthTexture;
|
||||||
gpu::TexturePointer _primaryStencilTexture;
|
|
||||||
gpu::TexturePointer _primaryColorTexture;
|
gpu::TexturePointer _primaryColorTexture;
|
||||||
gpu::TexturePointer _primaryNormalTexture;
|
gpu::TexturePointer _primaryNormalTexture;
|
||||||
gpu::TexturePointer _primarySpecularTexture;
|
gpu::TexturePointer _primarySpecularTexture;
|
||||||
|
|
|
@ -37,22 +37,17 @@ void SetupDeferred::run(const SceneContextPointer& sceneContext, const RenderCon
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
|
|
||||||
auto primaryFboStencil = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferStencilColor();
|
|
||||||
auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor();
|
auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor();
|
||||||
|
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
batch.setViewportTransform(args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
batch.setStateScissorRect(args->_viewport);
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
|
||||||
batch.setFramebuffer(primaryFboStencil);
|
|
||||||
batch.clearFramebuffer(
|
|
||||||
gpu::Framebuffer::BUFFER_STENCIL,
|
|
||||||
vec4(vec3(0), 1), 1.0, 0.0, true);
|
|
||||||
|
|
||||||
batch.setFramebuffer(primaryFbo);
|
batch.setFramebuffer(primaryFbo);
|
||||||
batch.clearFramebuffer(
|
batch.clearFramebuffer(
|
||||||
gpu::Framebuffer::BUFFER_COLOR0 |
|
gpu::Framebuffer::BUFFER_COLOR0 |
|
||||||
gpu::Framebuffer::BUFFER_DEPTH,
|
gpu::Framebuffer::BUFFER_DEPTH |
|
||||||
|
gpu::Framebuffer::BUFFER_STENCIL,
|
||||||
vec4(vec3(0), 1), 1.0, 0.0, true);
|
vec4(vec3(0), 1), 1.0, 0.0, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -313,7 +308,8 @@ const gpu::PipelinePointer& DrawStencilDeferred::getOpaquePipeline() {
|
||||||
gpu::Shader::makeProgram((*program));
|
gpu::Shader::makeProgram((*program));
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(STENCIL_OPAQUE, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_REPLACE));
|
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||||
|
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(STENCIL_OPAQUE, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_REPLACE));
|
||||||
state->setColorWriteMask(0);
|
state->setColorWriteMask(0);
|
||||||
|
|
||||||
_opaquePipeline.reset(gpu::Pipeline::create(program, state));
|
_opaquePipeline.reset(gpu::Pipeline::create(program, state));
|
||||||
|
@ -330,9 +326,8 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren
|
||||||
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
|
|
||||||
auto primaryFboColorDepthStencil = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferStencilColor();
|
auto primaryFboColorDepthStencil = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor();
|
||||||
auto primaryDepth = DependencyManager::get<FramebufferCache>()->getPrimaryDepthTexture();
|
|
||||||
|
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
|
|
||||||
batch.setFramebuffer(primaryFboColorDepthStencil);
|
batch.setFramebuffer(primaryFboColorDepthStencil);
|
||||||
|
@ -340,7 +335,6 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren
|
||||||
batch.setStateScissorRect(args->_viewport);
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
|
||||||
batch.setPipeline(getOpaquePipeline());
|
batch.setPipeline(getOpaquePipeline());
|
||||||
batch.setResourceTexture(0, primaryDepth);
|
|
||||||
|
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
batch.setResourceTexture(0, nullptr);
|
batch.setResourceTexture(0, nullptr);
|
||||||
|
@ -367,12 +361,12 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
||||||
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
|
|
||||||
auto primaryFboColorStencil = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferStencilColor();
|
auto primaryFboColorDepthStencil = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor();
|
||||||
auto primaryFboFull = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer();
|
auto primaryFboFull = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer();
|
||||||
|
|
||||||
batch.enableSkybox(true);
|
batch.enableSkybox(true);
|
||||||
|
|
||||||
batch.setFramebuffer(primaryFboColorStencil);
|
batch.setFramebuffer(primaryFboColorDepthStencil);
|
||||||
|
|
||||||
batch.setViewportTransform(args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
batch.setStateScissorRect(args->_viewport);
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
|
|
@ -12,13 +12,5 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
in vec2 varTexCoord0;
|
|
||||||
|
|
||||||
uniform sampler2D depthTexture;
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
float depth = texture(depthTexture, varTexCoord0.xy).r;
|
|
||||||
if (depth >= 1.0) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue