diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 3a02861ab3..19191e3e06 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -17,6 +17,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Improve performance of texture load and store operations * Fix crashes with pbuffers on Intel cards on Windows * Support for Autodesk Maya 2016.5 +* Add shadow-depth-bits config var to control shadow map depth ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 0d219273e5..255a2cd482 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -445,6 +445,12 @@ ConfigVariableDouble pixel_zoom ("pixel-zoom", 1.0, PRC_DESC("The default pixel_zoom factor for new windows.")); +ConfigVariableInt shadow_depth_bits +("shadow-depth-bits", 1, + PRC_DESC("The minimum number of depth buffer bits requested when rendering " + "shadow maps. Set this to 32 for more depth resolution in shadow " + "maps.")); + ConfigVariableColor background_color ("background-color", "0.41 0.41 0.41 0.0", PRC_DESC("Specifies the rgb(a) value of the default background color for a " diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index be71d0b63d..23afbf578f 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -102,6 +102,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableInt stencil_bits; extern EXPCL_PANDA_DISPLAY ConfigVariableInt accum_bits; extern EXPCL_PANDA_DISPLAY ConfigVariableInt multisamples; extern EXPCL_PANDA_DISPLAY ConfigVariableInt back_buffers; +extern EXPCL_PANDA_DISPLAY ConfigVariableInt shadow_depth_bits; extern EXPCL_PANDA_DISPLAY ConfigVariableDouble pixel_zoom; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 5faf282e53..22a2caf498 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -3176,13 +3176,17 @@ make_shadow_buffer(const NodePath &light_np, GraphicsOutputBase *host) { nassertr(light->_sbuffers.count(this) == 0, NULL); - display_cat.debug() << "Constructing shadow buffer for light '" << light->get_name() - << "', size=" << light->_sb_xsize << "x" << light->_sb_ysize - << ", sort=" << light->_sb_sort << "\n"; + if (display_cat.is_debug()) { + display_cat.debug() + << "Constructing shadow buffer for light '" << light->get_name() + << "', size=" << light->_sb_xsize << "x" << light->_sb_ysize + << ", sort=" << light->_sb_sort << "\n"; + } - // Setup some flags and properties + // Determine the properties for creating the depth buffer. FrameBufferProperties fbp; - fbp.set_depth_bits(1); // We only need depth + fbp.set_depth_bits(shadow_depth_bits); + WindowProperties props = WindowProperties::size(light->_sb_xsize, light->_sb_ysize); int flags = GraphicsPipe::BF_refuse_window; if (is_point) {