From b2b89d7294ebb0824ce85b8bad59357caf5ec14f Mon Sep 17 00:00:00 2001 From: clayjohn Date: Fri, 2 Dec 2022 15:39:20 -0800 Subject: Properly remap roughness when reading from radiance map This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3 --- servers/rendering/renderer_rd/effects/copy_effects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'servers/rendering/renderer_rd/effects') diff --git a/servers/rendering/renderer_rd/effects/copy_effects.cpp b/servers/rendering/renderer_rd/effects/copy_effects.cpp index a05db8c563..f94abd66d7 100644 --- a/servers/rendering/renderer_rd/effects/copy_effects.cpp +++ b/servers/rendering/renderer_rd/effects/copy_effects.cpp @@ -1153,7 +1153,8 @@ void CopyEffects::cubemap_roughness(RID p_source_rd_texture, RID p_dest_texture, memset(&roughness.push_constant, 0, sizeof(CubemapRoughnessPushConstant)); roughness.push_constant.face_id = p_face_id > 9 ? 0 : p_face_id; - roughness.push_constant.roughness = p_roughness * p_roughness; // Shader expects roughness, not perceptual roughness, so multiply before passing in. + // Remap to perceptual-roughness^2 to create more detail in lower mips and match the mapping of cubemap_filter. + roughness.push_constant.roughness = p_roughness * p_roughness; roughness.push_constant.sample_count = p_sample_count; roughness.push_constant.use_direct_write = p_roughness == 0.0; roughness.push_constant.face_size = p_size; -- cgit v1.2.3