Closed HaiyiMei closed 3 years ago
Hey, this looks very much like a 'gamma' value issue. I assume you do have 'eye adaption' enabled in your camera? - I typically disabled it via an unbound post-process volume and set a exposure bias of 0.0f. I suppose that is how I overcame this issue, because I definitely had these very result myself.
The better fix might be to switch from
renderTarget2D->TargetGamma = 1.2f;
to
renderTarget2D->TargetGamma = GEngine->GetDisplayGamma();
and move this also into the capture function call, such that the render target's gamma is updated for every frame according to the current display gamma. That would be this line:
void ACaptureManager::CaptureColorNonBlocking(...){
// Re-read the display for the render-target
CaptureComponent->GetCaptureComponent2D()->TextureTarget->TargetGamma = GEngine->GetDisplayGamma();
// Get RenderConterxt
....
}
@TimmHess Precisely! You solved my problem. Thanks for your quick and detailed reply! You are the best 🥇
Awesome! Glad it worked :)
Hi @TimmHess, thanks for this repo. I am having similar issues. Would you be able to help me with it? I tried what you suggested above (the GEngine->GetDisplayGamma()
part) but they change very little. Right now, I have:
Editor:
Saved Image:
I am using jpegs to save by the way - I changed the ERGB format on CameraCaptureManager.cpp Tick() to RGBA. Also changed the pixel format on SetupCameraComponent to PF_R8G8B8A8 to match it.
Thanks a lot for your help!
Hi, It's me again :) I have one problem. When rendering pictures by code, I got weird camera exposure and color issues. The detail can be seen in the following, the first is the preview screen when hit the play button in the ue4 editor, and the second is rendered by code.
I'm running the rendering code as you are, including the config of the
UTextureRenderTarget2D
. I think the problem comes from the config ofUTextureRenderTarget2D
and I don't know how to modify the config. Am I right or do you know the reason? Thanks a lot~