HTML5 RenderTarget2D Has Different Color (Linear Color / sRGB discrepency) Than PIE/Win10 64-bit

In an HTML5 build, rendering a UTexture2D to a URenderTarget2D causes the image to lose color. I’m not familiar with linear color terminology, but it has something to do with that and sRGB. If I took that URenderTarget2D and render it to another URenderTarget2D, eventually the image will be solid black. UCanvasRenderTarget2D exhibits the same behavior as the URenderTarget2D.

In these example images, the plane on the left is the unlit image, the plane in the middle is the lit image, and the plane on the right is after rendering that image to a URenderTarget2D.

HTML5 Chrome Version 62.0.3202.75 (Official Build) (64-bit) & Firefox 56.0.2 (64-bit)

PIE/Win10 64-bit Build

Notice how the third plane has less color in the HTML5 build vs the Editor/Win64 build. I would expect them to be the same.

Steps to reproduce:

  1. Make a new project. I chose C++ Third Person with no Starter Content.
  2. Add a plane to the scene with the material that has the render target.
  3. Add a button to the HUD or some other way to trigger the render to the render target.
  4. Create a 512x512 URenderTarget2D
  5. Add the code to do the render target rendering.
  6. Package for HTML5 and try in Chrome or Firefox. Compare that to PIE/Win10 64-bit.

Code for render target rendering:

Plane3Material->GetTextureParameterValue(FName("RT"), RT);
BrushRenderMat_Dynamic = UMaterialInstanceDynamic::Create(BrushRenderMat, this);
BrushRenderMat_Dynamic->SetTextureParameterValue("Tex", TestTexture);
UKismetRenderingLibrary::DrawMaterialToRenderTarget(this, Cast<UTextureRenderTarget2D>(RT), BrushRenderMat_Dynamic);

Material on the Plane

Material for rendering to the render target

Image that I’m using

Hello DanimalsOnParade,

We are using a new bug submission form. Please navigate to the link below for more information.

Link: Unreal Engine Bug Submission Form - Announcements - Epic Developer Community Forums

Make it a great day