Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloom #12791

Merged
merged 25 commits into from
Sep 29, 2022
Merged

Bloom #12791

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
698f4b2
Introduce technical texture names
x2048 Aug 31, 2022
b9eddf5
Add uniform for texture0 texel size
x2048 Aug 31, 2022
2c37ee3
Add multiple texture support to TextureBufferOutput
x2048 Sep 17, 2022
f74b08a
Add box blur shaders
x2048 Aug 31, 2022
830bbed
Add bloom effect
x2048 Aug 31, 2022
b3429ee
TextureBuffer is no longer a RenderTarget
x2048 Sep 17, 2022
254db1b
Use linear color values for all calculations
x2048 Sep 19, 2022
abe8a9d
Apply exposure factor before extracting bloom
x2048 Sep 11, 2022
0cf4e9f
Use downscaled textures for bloom
x2048 Sep 17, 2022
fd8f9f7
Add user configuration for exposure
x2048 Sep 18, 2022
348afac
Add parameter to control bloom effect
x2048 Sep 18, 2022
236700e
Add parameters for bloom threshold and boost
x2048 Sep 19, 2022
d1ba786
Replace bloom boost with bloom intensity parameter
x2048 Sep 19, 2022
5c4b14e
Add a parameter for bloom radius
x2048 Sep 19, 2022
0a8c9b6
Change blur equation for more realistic bloom at large kernels
x2048 Sep 19, 2022
bd4405b
Implement physically based bloom
x2048 Sep 20, 2022
9f87010
Compensate exposure when tonemapping is off
x2048 Sep 20, 2022
9aa1cbe
Use fixed value for exposure compensation
x2048 Sep 20, 2022
31d88fa
Fix documentation for bloom parameters
x2048 Sep 21, 2022
9989516
Clamp color values before applying gamma
x2048 Sep 22, 2022
a9fbc73
Add bloom debugging setting
x2048 Sep 24, 2022
56e9f3d
Use medium precision in blur shaders
x2048 Sep 24, 2022
082dfd4
Add flag to use dedicated texture in bloom
x2048 Sep 24, 2022
cc46fab
Document correct default value for bloom_intensity
x2048 Sep 25, 2022
133f102
Align style of doxygen comments
x2048 Sep 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add multiple texture support to TextureBufferOutput
  • Loading branch information
x2048 committed Sep 19, 2022
commit 2c37ee3fe60076259f4415137aebc22910e3b536
43 changes: 38 additions & 5 deletions src/client/render/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,48 @@ bool TextureBuffer::ensureTexture(video::ITexture **texture, const TextureDefini
}

TextureBufferOutput::TextureBufferOutput(TextureBuffer *_buffer, u8 _texture_index)
: buffer(_buffer), texture_index(_texture_index)
: buffer(_buffer), texture_map({_texture_index})
{}

TextureBufferOutput::TextureBufferOutput(TextureBuffer *_buffer, const std::vector<u8> &_texture_map)
: buffer(_buffer), texture_map(_texture_map)
{}

TextureBufferOutput::TextureBufferOutput(TextureBuffer *_buffer, const std::vector<u8> &_texture_map, u8 _depth_stencil)
: buffer(_buffer), texture_map(_texture_map), depth_stencil(_depth_stencil)
{}

TextureBufferOutput::~TextureBufferOutput()
{
if (render_target && driver)
driver->removeRenderTarget(render_target);
}

void TextureBufferOutput::activate(PipelineContext &context)
{
auto texture = buffer->getTexture(texture_index);
auto driver = context.device->getVideoDriver();
driver->setRenderTarget(texture, m_clear, m_clear, context.clear_color);
driver->OnResize(texture->getSize());
if (!driver)
driver = context.device->getVideoDriver();

if (!render_target)
render_target = driver->addRenderTarget();

core::array<video::ITexture *> textures;
core::dimension2du size(0, 0);
for (size_t i = 0; i < texture_map.size(); i++) {
video::ITexture *texture = buffer->getTexture(texture_map[i]);
textures.push_back(texture);
if (texture && size.Width == 0)
size = texture->getSize();
}

video::ITexture *depth_texture = nullptr;
if (depth_stencil != NO_DEPTH_TEXTURE)
depth_texture = buffer->getTexture(depth_stencil);

render_target->setTexture(textures, depth_texture);

driver->setRenderTargetEx(render_target, m_clear ? video::ECBF_ALL : video::ECBF_NONE, context.clear_color);
driver->OnResize(size);

RenderTarget::activate(context);
}
Expand Down
10 changes: 9 additions & 1 deletion src/client/render/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,18 @@ class TextureBufferOutput : public RenderTarget
{
public:
TextureBufferOutput(TextureBuffer *buffer, u8 texture_index);
TextureBufferOutput(TextureBuffer *buffer, const std::vector<u8> &texture_map);
TextureBufferOutput(TextureBuffer *buffer, const std::vector<u8> &texture_map, u8 depth_stencil);
virtual ~TextureBufferOutput() override;
void activate(PipelineContext &context) override;
private:
static const u8 NO_DEPTH_TEXTURE = 255;

TextureBuffer *buffer;
u8 texture_index;
std::vector<u8> texture_map;
u8 depth_stencil { NO_DEPTH_TEXTURE };
video::IRenderTarget* render_target { nullptr };
video::IVideoDriver* driver { nullptr };
};

/**
Expand Down