Announcement

Collapse
No announcement yet.

[BUG] Material translator does not handle material parameter collections correctly.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [RENDERING] [BUG] Material translator does not handle material parameter collections correctly.

    Apparently UE4's material translator does not fold uniform expressions within material parameter collections in them. It had been true for at least 4.19-4.22 span. Since new bug reporting form greatly improved quality of bug reports, I'll leave this here too, just in case it might be useful to someone.
    Code:
       
    /// HLSL code with material parameter collection in the network. Whole network should be folded, but it is not.
        MaterialFloat4 Local0 = MaterialCollection0.Vectors[0];
        MaterialFloat Local1 = (Local0.b / 360.00000000);
        MaterialFloat Local2 = (Local1 * 6.28318548);
        MaterialFloat Local3 = sin(Local2);
        MaterialFloat Local4 = (Local1 * 6.28318548);
        MaterialFloat Local5 = cos(Local4);
        MaterialFloat Local6 = dot(MaterialFloat3(MaterialFloat2(Local3,Local5),0.00000000), MaterialFloat3(MaterialFloat2(Local3,Local5),0.00000000));
        MaterialFloat Local7 = sqrt(Local6);
        MaterialFloat3 Local8 = (MaterialFloat3(MaterialFloat2(Local3,Local5),0.00000000) / Local7);
        MaterialFloat3 Local9 = (Local8 + Material.VectorExpressions[1].rgb);
    Code:
    /// HLSL code of the same network with scalar parameter instead of material parameter collection. Notice unnecessary addition operator.    
        MaterialFloat3 Local0 = (Material.VectorExpressions[3].rgb + Material.VectorExpressions[4].rgb);
    
        PixelMaterialInputs.EmissiveColor = Local0;
    Then there is this extra addition, that makes no sense and should not be there.

    #2
    Do you have tried to track down the bug? Any potential leads?

    Comment


      #3
      Originally posted by Kalle_H View Post
      Do you have tried to track down the bug? Any potential leads?
      Nope, apart from few glances. Regarding collections,likely was never intended all along, assuming how they are done.

      Comment

      Working...
      X