mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merged from orgin taa
This commit is contained in:
commit
9cfe53be3e
17 changed files with 45 additions and 21 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -78,6 +78,8 @@ TAGS
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
|
# ignore qmlc files generated from qml as cache
|
||||||
|
*.qmlc
|
||||||
# Android studio files
|
# Android studio files
|
||||||
*___jb_old___
|
*___jb_old___
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ void Application::runRenderFrame(RenderArgs* renderArgs) {
|
||||||
|
|
||||||
// Make sure the WorldBox is in the scene
|
// Make sure the WorldBox is in the scene
|
||||||
// For the record, this one RenderItem is the first one we created and added to the scene.
|
// For the record, this one RenderItem is the first one we created and added to the scene.
|
||||||
// We could meoee that code elsewhere but you know...
|
// We could move that code elsewhere but you know...
|
||||||
if (!render::Item::isValidID(WorldBoxRenderData::_item)) {
|
if (!render::Item::isValidID(WorldBoxRenderData::_item)) {
|
||||||
auto worldBoxRenderData = std::make_shared<WorldBoxRenderData>();
|
auto worldBoxRenderData = std::make_shared<WorldBoxRenderData>();
|
||||||
auto worldBoxRenderPayload = std::make_shared<WorldBoxRenderData::Payload>(worldBoxRenderData);
|
auto worldBoxRenderPayload = std::make_shared<WorldBoxRenderData::Payload>(worldBoxRenderData);
|
||||||
|
|
|
@ -65,6 +65,10 @@ bool DebugHmdDisplayPlugin::internalActivate() {
|
||||||
//_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]);
|
//_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]);
|
||||||
_eyeOffsets[0][3] = vec4{ -0.0327499993, 0.0, 0.0149999997, 1.0 };
|
_eyeOffsets[0][3] = vec4{ -0.0327499993, 0.0, 0.0149999997, 1.0 };
|
||||||
_eyeOffsets[1][3] = vec4{ 0.0327499993, 0.0, 0.0149999997, 1.0 };
|
_eyeOffsets[1][3] = vec4{ 0.0327499993, 0.0, 0.0149999997, 1.0 };
|
||||||
|
_eyeInverseProjections[0] = glm::inverse(_eyeProjections[0]);
|
||||||
|
_eyeInverseProjections[1] = glm::inverse(_eyeProjections[1]);
|
||||||
|
_eyeOffsets[0][3] = vec4{ -0.0327499993, 0.0, -0.0149999997, 1.0 };
|
||||||
|
_eyeOffsets[1][3] = vec4{ 0.0327499993, 0.0, -0.0149999997, 1.0 };
|
||||||
_renderTargetSize = { 3024, 1680 };
|
_renderTargetSize = { 3024, 1680 };
|
||||||
_cullingProjection = _eyeProjections[0];
|
_cullingProjection = _eyeProjections[0];
|
||||||
// This must come after the initialization, so that the values calculated
|
// This must come after the initialization, so that the values calculated
|
||||||
|
@ -74,6 +78,7 @@ bool DebugHmdDisplayPlugin::internalActivate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugHmdDisplayPlugin::updatePresentPose() {
|
void DebugHmdDisplayPlugin::updatePresentPose() {
|
||||||
|
Parent::updatePresentPose();
|
||||||
if (_isAutoRotateEnabled) {
|
if (_isAutoRotateEnabled) {
|
||||||
float yaw = sinf(secTimestampNow()) * 0.25f;
|
float yaw = sinf(secTimestampNow()) * 0.25f;
|
||||||
float pitch = cosf(secTimestampNow()) * 0.25f;
|
float pitch = cosf(secTimestampNow()) * 0.25f;
|
||||||
|
|
|
@ -101,3 +101,4 @@ void StereoDisplayPlugin::internalDeactivate() {
|
||||||
float StereoDisplayPlugin::getRecommendedAspectRatio() const {
|
float StereoDisplayPlugin::getRecommendedAspectRatio() const {
|
||||||
return aspect(Parent::getRecommendedRenderSize());
|
return aspect(Parent::getRecommendedRenderSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
// the IPD at the Application level, the way we now allow with HMDs.
|
// the IPD at the Application level, the way we now allow with HMDs.
|
||||||
// If that becomes an issue then we'll need to break up the functionality similar
|
// If that becomes an issue then we'll need to break up the functionality similar
|
||||||
// to the HMD plugins.
|
// to the HMD plugins.
|
||||||
// virtual glm::mat4 getEyeToHeadTransform(Eye eye) const override;
|
//virtual glm::mat4 getEyeToHeadTransform(Eye eye) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool internalActivate() override;
|
virtual bool internalActivate() override;
|
||||||
|
|
|
@ -98,8 +98,8 @@ Buffer::Update::Update(const Buffer& parent) : buffer(parent) {
|
||||||
|
|
||||||
void Buffer::Update::apply() const {
|
void Buffer::Update::apply() const {
|
||||||
// Make sure we're loaded in order
|
// Make sure we're loaded in order
|
||||||
++buffer._applyUpdateCount;
|
auto applyUpdateCount = ++buffer._applyUpdateCount;
|
||||||
assert(buffer._applyUpdateCount.load() == updateNumber);
|
assert(applyUpdateCount == updateNumber);
|
||||||
const auto pageSize = buffer._pages._pageSize;
|
const auto pageSize = buffer._pages._pageSize;
|
||||||
buffer._renderSysmem.resize(size);
|
buffer._renderSysmem.resize(size);
|
||||||
buffer._renderPages.accommodate(size);
|
buffer._renderPages.accommodate(size);
|
||||||
|
|
|
@ -43,3 +43,8 @@ std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> Displa
|
||||||
}
|
}
|
||||||
return hudOperator;
|
return hudOperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::mat4 HmdDisplay::getEyeToHeadTransform(Eye eye) const {
|
||||||
|
static const glm::mat4 xform;
|
||||||
|
return xform;
|
||||||
|
}
|
||||||
|
|
|
@ -93,9 +93,7 @@ class HmdDisplay : public StereoDisplay {
|
||||||
public:
|
public:
|
||||||
// HMD specific methods
|
// HMD specific methods
|
||||||
// TODO move these into another class?
|
// TODO move these into another class?
|
||||||
virtual glm::mat4 getEyeToHeadTransform(Eye eye) const {
|
virtual glm::mat4 getEyeToHeadTransform(Eye eye) const;
|
||||||
static const glm::mat4 transform; return transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns a copy of the most recent head pose, computed via updateHeadPose
|
// returns a copy of the most recent head pose, computed via updateHeadPose
|
||||||
virtual glm::mat4 getHeadPose() const {
|
virtual glm::mat4 getHeadPose() const {
|
||||||
|
|
|
@ -106,12 +106,12 @@ class AntialiasingConfig : public render::Job::Config {
|
||||||
public:
|
public:
|
||||||
AntialiasingConfig() : render::Job::Config(true) {}
|
AntialiasingConfig() : render::Job::Config(true) {}
|
||||||
|
|
||||||
float blend{ 0.1f };
|
float blend{ 0.075f };
|
||||||
|
|
||||||
|
|
||||||
bool constrainColor{ true };
|
bool constrainColor{ true };
|
||||||
bool covarianceClipColor{ true };
|
bool covarianceClipColor{ true };
|
||||||
float covarianceGamma{ 1.0f };
|
float covarianceGamma{ 0.9f };
|
||||||
bool clipExactColor{ false };
|
bool clipExactColor{ false };
|
||||||
bool feedbackColor{ false };
|
bool feedbackColor{ false };
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ void DeferredFrameTransform::update(RenderArgs* args) {
|
||||||
frameTransformBuffer.projection[0] = frameTransformBuffer.projectionMono;
|
frameTransformBuffer.projection[0] = frameTransformBuffer.projectionMono;
|
||||||
frameTransformBuffer.stereoInfo = glm::vec4(0.0f, (float)args->_viewport.z, 0.0f, 0.0f);
|
frameTransformBuffer.stereoInfo = glm::vec4(0.0f, (float)args->_viewport.z, 0.0f, 0.0f);
|
||||||
frameTransformBuffer.invpixelInfo = glm::vec4(1.0f / args->_viewport.z, 1.0f / args->_viewport.w, 0.0f, 0.0f);
|
frameTransformBuffer.invpixelInfo = glm::vec4(1.0f / args->_viewport.z, 1.0f / args->_viewport.w, 0.0f, 0.0f);
|
||||||
|
frameTransformBuffer.invProjection[0] = glm::inverse(frameTransformBuffer.projection[0]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mat4 projMats[2];
|
mat4 projMats[2];
|
||||||
|
@ -59,6 +60,7 @@ void DeferredFrameTransform::update(RenderArgs* args) {
|
||||||
// Compose the mono Eye space to Stereo clip space Projection Matrix
|
// Compose the mono Eye space to Stereo clip space Projection Matrix
|
||||||
auto sideViewMat = projMats[i] * eyeViews[i];
|
auto sideViewMat = projMats[i] * eyeViews[i];
|
||||||
frameTransformBuffer.projection[i] = sideViewMat;
|
frameTransformBuffer.projection[i] = sideViewMat;
|
||||||
|
frameTransformBuffer.invProjection[i] = glm::inverse(sideViewMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
frameTransformBuffer.stereoInfo = glm::vec4(1.0f, (float)(args->_viewport.z >> 1), 0.0f, 1.0f);
|
frameTransformBuffer.stereoInfo = glm::vec4(1.0f, (float)(args->_viewport.z >> 1), 0.0f, 1.0f);
|
||||||
|
|
|
@ -45,6 +45,8 @@ protected:
|
||||||
glm::vec4 stereoInfo{ 0.0 };
|
glm::vec4 stereoInfo{ 0.0 };
|
||||||
// Mono proj matrix or Left and Right proj matrix going from Mono Eye space to side clip space
|
// Mono proj matrix or Left and Right proj matrix going from Mono Eye space to side clip space
|
||||||
glm::mat4 projection[2];
|
glm::mat4 projection[2];
|
||||||
|
// Inverse proj matrix or Left and Right proj matrix going from Mono Eye space to side clip space
|
||||||
|
glm::mat4 invProjection[2];
|
||||||
// THe mono projection for sure
|
// THe mono projection for sure
|
||||||
glm::mat4 projectionMono;
|
glm::mat4 projectionMono;
|
||||||
// Inv View matrix from eye space (mono) to world space
|
// Inv View matrix from eye space (mono) to world space
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct DeferredFrameTransform {
|
||||||
vec4 _depthInfo;
|
vec4 _depthInfo;
|
||||||
vec4 _stereoInfo;
|
vec4 _stereoInfo;
|
||||||
mat4 _projection[2];
|
mat4 _projection[2];
|
||||||
|
mat4 _invProjection[2];
|
||||||
mat4 _projectionMono;
|
mat4 _projectionMono;
|
||||||
mat4 _viewInverse;
|
mat4 _viewInverse;
|
||||||
mat4 _view;
|
mat4 _view;
|
||||||
|
@ -128,6 +129,14 @@ vec3 evalEyePositionFromZeye(int side, float Zeye, vec2 texcoord) {
|
||||||
return vec3(Xe, Ye, Zeye);
|
return vec3(Xe, Ye, Zeye);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 evalEyePositionFromZdb(int side, float Zdb, vec2 texcoord) {
|
||||||
|
// compute the view space position using the depth
|
||||||
|
vec3 clipPos;
|
||||||
|
clipPos.xyz = vec3(texcoord.xy, Zdb) * 2.0 - 1.0;
|
||||||
|
vec4 eyePos = frameTransform._invProjection[side] * vec4(clipPos.xyz, 1.0);
|
||||||
|
return eyePos.xyz / eyePos.w;
|
||||||
|
}
|
||||||
|
|
||||||
ivec2 getPixelPosTexcoordPosAndSide(in vec2 glFragCoord, out ivec2 pixelPos, out vec2 texcoordPos, out ivec4 stereoSide) {
|
ivec2 getPixelPosTexcoordPosAndSide(in vec2 glFragCoord, out ivec2 pixelPos, out vec2 texcoordPos, out ivec4 stereoSide) {
|
||||||
ivec2 fragPos = ivec2(glFragCoord.xy);
|
ivec2 fragPos = ivec2(glFragCoord.xy);
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@ extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest
|
||||||
|
|
||||||
void BeginGPURangeTimer::run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) {
|
void BeginGPURangeTimer::run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) {
|
||||||
timer = _gpuTimer;
|
timer = _gpuTimer;
|
||||||
gpu::doInBatch("BeginGPURangeTimer::run", renderContext->args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("BeginGPURangeTimer", renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||||
_gpuTimer->begin(batch);
|
_gpuTimer->begin(batch);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndGPURangeTimer::run(const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer) {
|
void EndGPURangeTimer::run(const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer) {
|
||||||
gpu::doInBatch("EndGPURangeTimer::run", renderContext->args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("EndGPURangeTimer", renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||||
timer->end(batch);
|
timer->end(batch);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs&
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the items
|
// Render the items
|
||||||
gpu::doInBatch("DrawOverlay3D::run", args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("DrawOverlay3D::main", args->_context, [&](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
batch.setViewportTransform(args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
batch.setStateScissorRect(args->_viewport);
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
@ -97,7 +97,7 @@ void CompositeHUD::run(const RenderContextPointer& renderContext) {
|
||||||
|
|
||||||
// Grab the HUD texture
|
// Grab the HUD texture
|
||||||
#if !defined(DISABLE_QML)
|
#if !defined(DISABLE_QML)
|
||||||
gpu::doInBatch("CompositeHUD::run", renderContext->args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("CompositeHUD", renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||||
if (renderContext->args->_hudOperator) {
|
if (renderContext->args->_hudOperator) {
|
||||||
renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE);
|
renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ void Blit::run(const RenderContextPointer& renderContext, const gpu::Framebuffer
|
||||||
// Blit primary to blit FBO
|
// Blit primary to blit FBO
|
||||||
auto primaryFbo = srcFramebuffer;
|
auto primaryFbo = srcFramebuffer;
|
||||||
|
|
||||||
gpu::doInBatch("Blit::run", renderArgs->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("Blit", renderArgs->_context, [&](gpu::Batch& batch) {
|
||||||
batch.setFramebuffer(blitFbo);
|
batch.setFramebuffer(blitFbo);
|
||||||
|
|
||||||
if (renderArgs->_renderMode == RenderArgs::MIRROR_RENDER_MODE) {
|
if (renderArgs->_renderMode == RenderArgs::MIRROR_RENDER_MODE) {
|
||||||
|
|
|
@ -420,4 +420,3 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const
|
||||||
|
|
||||||
config->setNumDrawn((int)inItems.size());
|
config->setNumDrawn((int)inItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ mat3 taa_evalNeighbourColorVariance(vec3 sourceColor, vec2 fragUV, vec2 fragVelo
|
||||||
|
|
||||||
|
|
||||||
vec3 mu = sumSamples / vec3(9.0);
|
vec3 mu = sumSamples / vec3(9.0);
|
||||||
vec3 sigma = sqrt(max(sumSamples2 / vec3(9.0) - mu * mu, vec3(0)));
|
vec3 sigma = sqrt(max(sumSamples2 / vec3(9.0) - mu * mu, vec3(0.0)));
|
||||||
|
|
||||||
float gamma = params.covarianceGamma;
|
float gamma = params.covarianceGamma;
|
||||||
vec3 cmin = mu - gamma * sigma;
|
vec3 cmin = mu - gamma * sigma;
|
||||||
|
|
|
@ -26,14 +26,14 @@ void main(void) {
|
||||||
ivec2 framePixelPos = getPixelPosTexcoordPosAndSide(gl_FragCoord.xy, pixelPos, texcoordPos, stereoSide);
|
ivec2 framePixelPos = getPixelPosTexcoordPosAndSide(gl_FragCoord.xy, pixelPos, texcoordPos, stereoSide);
|
||||||
|
|
||||||
float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;
|
float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;
|
||||||
float Zeye = evalZeyeFromZdb(Zdb);
|
/* float Zeye = evalZeyeFromZdb(Zdb);
|
||||||
/* if (Zeye <= -getPosLinearDepthFar()) {
|
if (Zeye <= -getPosLinearDepthFar()) {
|
||||||
outFragColor = vec4(0.5, 0.5, 0.0, 0.0);
|
outFragColor = vec4(0.5, 0.5, 0.0, 0.0);
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// The position of the pixel fragment in Eye space then in world space
|
// The position of the pixel fragment in Eye space then in world space
|
||||||
vec3 eyePos = evalEyePositionFromZeye(stereoSide.x, Zeye, texcoordPos);
|
vec3 eyePos = evalEyePositionFromZdb(stereoSide.x, Zdb, texcoordPos);
|
||||||
vec3 worldPos = (frameTransform._viewInverse * cameraCorrection._correction * vec4(eyePos, 1.0)).xyz;
|
vec3 worldPos = (frameTransform._viewInverse * cameraCorrection._correction * vec4(eyePos, 1.0)).xyz;
|
||||||
|
|
||||||
vec3 prevEyePos = (cameraCorrection._prevCorrectionInverse * frameTransform._prevView * vec4(worldPos, 1.0)).xyz;
|
vec3 prevEyePos = (cameraCorrection._prevCorrectionInverse * frameTransform._prevView * vec4(worldPos, 1.0)).xyz;
|
||||||
|
|
|
@ -200,6 +200,7 @@ Rectangle {
|
||||||
ListElement { text: "Debug Scattering"; color: "White" }
|
ListElement { text: "Debug Scattering"; color: "White" }
|
||||||
ListElement { text: "Ambient Occlusion"; color: "White" }
|
ListElement { text: "Ambient Occlusion"; color: "White" }
|
||||||
ListElement { text: "Ambient Occlusion Blurred"; color: "White" }
|
ListElement { text: "Ambient Occlusion Blurred"; color: "White" }
|
||||||
|
ListElement { text: "Velocity"; color: "White" }
|
||||||
ListElement { text: "Custom"; color: "White" }
|
ListElement { text: "Custom"; color: "White" }
|
||||||
}
|
}
|
||||||
width: 200
|
width: 200
|
||||||
|
|
Loading…
Reference in a new issue