Description

Encode71 and Decode71 in DeferredShadingCommon.ush are functions that convert 8-bit values ​​to 7-bit values ​​and mask values, and licensees have reported that the accuracy is insufficient when using the Decode71 function.

According to licensees, correct results can be obtained by changing the return part of Decode71() to the same processing as Encode() as shown below.

// return (Scalar - 0.5f * Mask) * 2.0f;
return (Scalar - (128.0f / 255.0f) * Mask) * (255.0f / 127.0f); 

 

Results
Input scalar: 0.7777, mask: 0
Output scalar: 0.7777, mask: 0
[Image Removed]

Input scalar: 0.7777, mask: 1
Input scalar: 0.7777, mask: 1

Steps to Reproduce
  1. Open the attached sample project
    [Link Removed]
  2. Open the M_Decode71 material and change the scalar and mask values

Results
Input scalar: 0.7777, mask: 0
Output scalar: 0.7746, mask: 0
[Image Removed]
Input scalar: 0.7777, mask: 1
Output scalar: 0.7785, mask: 1
[Image Removed]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-294750 in the post.

0
Login to Vote

Unresolved
CreatedJun 5, 2025
UpdatedJun 6, 2025
View Jira Issue