How many times I change the gamma value in RenderTarget. But the result is not any change. I just want to know if this value is really work.
Does not work for me in UE5.2 either.
You need to set your scene capture to final color. IIRC, you need Final Color for the gamma on the render target to be applied since that’s the “Output Device” stage of the post-process pipeline.
Thanks for the suggestion. This is the issue I have.
- I am developing a tool that exports scene capture 2Ds from the editor to PNGs.
- When I use Capture Every Frame, everything looks correct in the render target, but the exported PNG is empty.
- When I disable Capture Every Frame and call CaptureScene in C++, the shadow in the render target is very darker than in the viewport. However, I can export to PNG using this method.
- I use Final Color (with tone curve) for the scene captures and use RGBA8_sRGB for the render target. I also tried Final Color (LDR) with both RGBA8 and RGBA8_sRGB but I still have the same issue.
I’m not sure off hand. Could it be Lumen? Have you enabled it in your scene capture?
Yes, I enabled and it looked correct when Capture Every Frame is enabled.
I think this is the problem.
The engine makes the view state null when Capture Every Frame turned off.
https://github.com/EpicGames/UnrealEngine/blob/02dc8dbdd89f749cd5500376e9bb87271bf64848/Engine/Source/Runtime/Engine/Private/Components/SceneCaptureComponent.cpp#L390-L394
And the engine only adds lumen data to scene capture rendering when the view state is not null with other conditions.
https://github.com/EpicGames/UnrealEngine/blob/02dc8dbdd89f749cd5500376e9bb87271bf64848/Engine/Source/Runtime/Renderer/Private/SceneCaptureRendering.cpp#L866-L876
This explains why I only have correct shadows when enabling Capture Every Frame. But doing so prevent me from exporting the PNG properly.
The alpha when Capture Every Frame is enabled is none.
Edit: My workaround is adding alpha in C++ before saving. The PNG now looks correct when Always Persist Rendering State or Capture Every Frame is enabled.
if (format == ETextureRenderTargetFormat::RTF_RGBA8 || format == ETextureRenderTargetFormat::RTF_RGBA8_SRGB)
{
const auto colors{ reinterpret_cast<FColor*>(image.RawData.GetData()) };
if (colors)
{
for (int64 index{ 0 }; index < image.GetNumPixels(); index++)
{
colors[index].A = 255u;
}
}
}
Edit: not really, it only works at day time. Morning time is still very dark
Edit: I think the UDS is messing with the post process of the scene and the scene capture will have to adapt to it.