mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-08 11:47:12 +02:00
Tried to limit banding effect
This commit is contained in:
parent
454531e3c3
commit
6420d96149
3 changed files with 7 additions and 7 deletions
|
@ -477,7 +477,6 @@ int AmbientOcclusionEffect::getDepthResolutionLevel() const {
|
|||
}
|
||||
|
||||
void AmbientOcclusionEffect::updateJitterSamples() {
|
||||
const int SSAO_RANDOM_SAMPLE_COUNT = int(_randomSamples.size() / (SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT));
|
||||
for (int splitId = 0; splitId < SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT; splitId++) {
|
||||
auto& sample = _aoFrameParametersBuffer[splitId].edit();
|
||||
sample._angleInfo.x = _randomSamples[splitId + SSAO_RANDOM_SAMPLE_COUNT * _frameId];
|
||||
|
@ -547,9 +546,8 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
|||
|
||||
// Update sample rotation
|
||||
if (_isJitterEnabled) {
|
||||
const int SSAO_RANDOM_SAMPLE_COUNT = int(_randomSamples.size() / (SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT));
|
||||
updateJitterSamples();
|
||||
_frameId = (_frameId + 1) % SSAO_RANDOM_SAMPLE_COUNT;
|
||||
_frameId = (_frameId + 1) % (SSAO_RANDOM_SAMPLE_COUNT);
|
||||
}
|
||||
|
||||
gpu::doInBatch("AmbientOcclusionEffect::run", args->_context, [=](gpu::Batch& batch) {
|
||||
|
|
|
@ -130,6 +130,8 @@ signals:
|
|||
void dirty();
|
||||
};
|
||||
|
||||
#define SSAO_RANDOM_SAMPLE_COUNT 16
|
||||
|
||||
class AmbientOcclusionEffect {
|
||||
public:
|
||||
using Inputs = render::VaryingSet3<DeferredFrameTransformPointer, DeferredFramebufferPointer, LinearDepthFramebufferPointer>;
|
||||
|
@ -205,7 +207,7 @@ private:
|
|||
static gpu::PipelinePointer _buildNormalsPipeline;
|
||||
|
||||
AmbientOcclusionFramebufferPointer _framebuffer;
|
||||
std::array<float, 8 * SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT> _randomSamples;
|
||||
std::array<float, SSAO_RANDOM_SAMPLE_COUNT * SSAO_SPLIT_COUNT*SSAO_SPLIT_COUNT> _randomSamples;
|
||||
int _frameId{ 0 };
|
||||
bool _isJitterEnabled{ true };
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ vec3 getNormalEyeAtPixel(ivec2 pixel, int level) {
|
|||
}
|
||||
|
||||
int evalMipFromRadius(float radius) {
|
||||
const int LOG_MAX_OFFSET = 1;
|
||||
const int LOG_MAX_OFFSET = 2;
|
||||
const int MAX_MIP_LEVEL = 5;
|
||||
return clamp(findMSB(int(radius)) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL);
|
||||
}
|
||||
|
@ -433,11 +433,11 @@ float computeWeightedHorizon(float horizonLimit, float distanceSquared) {
|
|||
if (tapHorizonLimit > horizonLimit) {
|
||||
occlusion += weight * (tapHorizonLimit - horizonLimit);
|
||||
horizonLimit = tapHorizonLimit;
|
||||
} else if (dot(deltaVec, fragFrameES.tangent) < 0.0) {
|
||||
} /*else if (dot(deltaVec, fragFrameES.tangent) < 0.0) {
|
||||
// This is a hack to try to handle the case where the occlusion angle is
|
||||
// greater than 90°
|
||||
occlusion = mix(occlusion, (occlusion+1.0) * 0.5, weight);
|
||||
}
|
||||
}*/
|
||||
#else
|
||||
if (tapHorizonLimit < horizonLimit) {
|
||||
tapHorizonLimit = computeWeightedHorizon(tapHorizonLimit, distanceSquared);
|
||||
|
|
Loading…
Reference in a new issue