Fix: Overlay-Next: Broken light cone display
The depth test was not set correctly for the front pass. The shader was writting to the antialiasing buffer. Using a dedicated shader avoid breaking the renderpass to bind another framebuffer.
This commit is contained in:
@@ -165,9 +165,10 @@ class Lights {
|
||||
|
||||
{
|
||||
PassSimple::Sub &sub_pass = ps_.sub("spot_cone_front");
|
||||
sub_pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_CULL_FRONT,
|
||||
sub_pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA |
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_FRONT,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.shader_set(res.shaders.light_spot_cone.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.spot_cone_front_buf.end_sync(sub_pass, shapes.light_spot_volume.get());
|
||||
}
|
||||
@@ -176,7 +177,7 @@ class Lights {
|
||||
sub_pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA |
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.shader_set(res.shaders.light_spot_cone.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.spot_cone_back_buf.end_sync(sub_pass, shapes.light_spot_volume.get());
|
||||
}
|
||||
|
||||
@@ -297,6 +297,7 @@ class ShaderModule {
|
||||
ShaderPtr image_plane_depth_bias;
|
||||
ShaderPtr lattice_points;
|
||||
ShaderPtr lattice_wire;
|
||||
ShaderPtr light_spot_cone;
|
||||
ShaderPtr particle_dot;
|
||||
ShaderPtr particle_shape;
|
||||
ShaderPtr particle_hair;
|
||||
|
||||
@@ -582,6 +582,15 @@ ShaderModule::ShaderModule(const SelectionType selection_type, const bool clippi
|
||||
info.push_constant(gpu::shader::Type::MAT4, "depth_bias_winmat");
|
||||
});
|
||||
|
||||
light_spot_cone = shader("overlay_extra", [](gpu::shader::ShaderCreateInfo &info) {
|
||||
info.storage_buf(0, Qualifier::READ, "ExtraInstanceData", "data_buf[]");
|
||||
info.define("color", "data_buf[gl_InstanceID].color_");
|
||||
info.define("inst_obmat", "data_buf[gl_InstanceID].object_to_world_");
|
||||
info.vertex_inputs_.pop_last();
|
||||
info.vertex_inputs_.pop_last();
|
||||
info.define("IS_SPOT_CONE");
|
||||
});
|
||||
|
||||
particle_dot = selectable_shader("overlay_particle_dot",
|
||||
[](gpu::shader::ShaderCreateInfo &info) {
|
||||
info.additional_infos_.clear();
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
void main()
|
||||
{
|
||||
fragColor = finalColor;
|
||||
#ifdef IS_SPOT_CONE
|
||||
lineOutput = vec4(0.0);
|
||||
#else
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
|
||||
|
||||
select_id_output(select_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user