diff --git a/panda/src/pgraphnodes/lightLensNode.cxx b/panda/src/pgraphnodes/lightLensNode.cxx index 0aabcb07b4..cb84c28dfb 100644 --- a/panda/src/pgraphnodes/lightLensNode.cxx +++ b/panda/src/pgraphnodes/lightLensNode.cxx @@ -19,6 +19,7 @@ #include "renderState.h" #include "cullFaceAttrib.h" #include "colorWriteAttrib.h" +#include "lightAttrib.h" #include "graphicsStateGuardianBase.h" TypeHandle LightLensNode::_type_handle; @@ -37,10 +38,14 @@ LightLensNode(const std::string &name, Lens *lens) : _shadow_caster = false; _sb_size.set(512, 512); _sb_sort = -10; - // set_initial_state(RenderState::make(ShaderAttrib::make_off(), 1000)); + // Backface culling helps eliminating artifacts. - set_initial_state(RenderState::make(CullFaceAttrib::make_reverse(), - ColorWriteAttrib::make(ColorWriteAttrib::C_off))); + static CPT(RenderState) default_initial_state = + RenderState::make( + CullFaceAttrib::make_reverse(), + ColorWriteAttrib::make(ColorWriteAttrib::C_off) + )->set_attrib(LightAttrib::make_all_off(), RenderState::get_max_priority()); + set_initial_state(default_initial_state); } /**