First draft

This commit is contained in:
Olivier Prat 2017-09-25 11:51:23 +02:00
parent cf0dd6f8c3
commit bcec3680b6
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,36 @@
//
// BloomEffect.cpp
// render-utils/src/
//
// Created by Olivier Prat on 09/25/17.
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "BloomEffect.h"
#include <render/BlurTask.h>
void BloomConfig::setMix(float value) {
}
void BloomConfig::setSize(float value) {
auto blurConfig = getConfig<render::BlurGaussian>("Blur");
assert(blurConfig);
blurConfig->setProperty("filterScale", value*10.0f);
}
Bloom::Bloom() {
}
void Bloom::configure(const Config& config) {
}
void Bloom::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
const auto& blurInput = inputs;
task.addJob<render::BlurGaussian>("Blur", blurInput);
}

View file

@ -0,0 +1,47 @@
//
// BloomEffect.h
// render-utils/src/
//
// Created by Olivier Prat on 09/25/17.
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_render_utils_BloomEffect_h
#define hifi_render_utils_BloomEffect_h
#include <render/Engine.h>
class BloomConfig : public render::Task::Config {
Q_OBJECT
Q_PROPERTY(float mix MEMBER mix WRITE setMix NOTIFY dirty)
Q_PROPERTY(float size MEMBER size WRITE setSize NOTIFY dirty)
public:
float mix{ 0.2f };
float size{ 0.1f };
void setMix(float value);
void setSize(float value);
signals:
void dirty();
};
class Bloom {
public:
using Inputs = gpu::FramebufferPointer;
using Config = BloomConfig;
using JobModel = render::Task::ModelI<Bloom, Inputs, Config>;
Bloom();
void configure(const Config& config);
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
};
#endif // hifi_render_utils_BloomEffect_h

View file

@ -41,6 +41,7 @@
#include "ToneMappingEffect.h"
#include "SubsurfaceScattering.h"
#include "OutlineEffect.h"
#include "BloomEffect.h"
#include <gpu/StandardShaderLib.h>
@ -168,6 +169,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
// Add bloom
const auto bloomInputs = lightingFramebuffer;
task.addJob<Bloom>("Bloom", bloomInputs);
// Lighting Buffer ready for tone mapping
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);