From 5ced451549e2238bb1195d03419437a395b9afec Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 25 Jan 2022 19:56:39 +0200 Subject: [PATCH] Use a dummy transmittance lookup texture to render the lookup in Sky Ideally the compiler should optimize the shader so the texture isn't used, but that'll take some extra effort to implement. --- source/effects/sky.cpp | 2 ++ source/effects/sky.h | 1 + 2 files changed, 3 insertions(+) diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index eef6a58c..2732b7ad 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -25,6 +25,7 @@ Sky::Sky(Renderable &c, DirectionalLight &s): backdrop_shprog(Resources::get_global().get("_sky_backdrop.glsl.shader")), sampler(Resources::get_global().get("_linear_clamp.samp")), wrap_sampler(Resources::get_global().get("_linear_clamp_v.samp")), + dummy_texture(Resources::get_global().get("_placeholder.png")), rendered(false) { shdata.uniform("n_steps", 50); @@ -112,6 +113,7 @@ void Sky::setup_frame(Renderer &renderer) renderer.set_pipeline_key(this); renderer.set_framebuffer(&transmittance_lookup.get_framebuffer()); renderer.set_shader_program(&transmittance_shprog); + renderer.set_texture("transmittance_lookup", &dummy_texture, &sampler); fullscreen_mesh.draw(renderer); } diff --git a/source/effects/sky.h b/source/effects/sky.h index 7d8933d4..cb8403e7 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -74,6 +74,7 @@ private: const Program &backdrop_shprog; const Sampler &sampler; const Sampler &wrap_sampler; + const Texture &dummy_texture; mutable ProgramData shdata; float view_height; bool rendered; -- 2.45.2