How to capture motion blur image at runtime?
if (player == null)
{
Unigine.Console.OnscreenMessageLine(vec4.RED, "No active camera.");
return;
}
viewport.Mode = Render.ViewportMode;
// We temporarily set exposure adaptation time to 0, otherwise the image may be too dark
float exposureAdaptation = Render.ExposureAdaptation;
Render.ExposureAdaptation =0f;
// We render with velocity buffer turned off to avoid temporal effects artifacts
viewport.AppendSkipFlags(Viewport.SKIP_VELOCITY_BUFFER);
viewport.RenderImage2D(player.Camera, image, width, height);
viewport.RemoveSkipFlags(Viewport.SKIP_VELOCITY_BUFFER);
Render.ExposureAdaptation = exposureAdaptation;
if (!alphaChannel || format == Format.jpg)
{
if (image.Format == Image.FORMAT_RGBA8)
{
image.ConvertToFormat(Image.FORMAT_RGB8);
}
else if (image.Format == Image.FORMAT_RGBA16F)
{
image.ConvertToFormat(Image.FORMAT_RGB16F);
}
}
image.Save(fullName_yuan, 1);
In this way, the images are clear,Motion blur effect cannot be intercepted。