Hallo
I am getting there with producing output from VRAYSDK - one question. The output from renderer.vfb.saveImage looks much darker than the display in vfb. The documentation says that the channels are baked into the output, yet this does not appear to be so. How do I achieve the same output as per vfb?
// Start rendering.
renderer()->startSync();
// Wait for rendering to end.
renderer()->waitForRenderEnd();
renderer()->vfb.saveImage(“c:\\docs\\vray_test_render.png”) ;
The image you see is darker probably due to Display Correction not being applied. When Using VFB::saveImage, you need to specify that you want corrections to be applied.
We usually recommend to get the final rendered image using VRayRenderer::getImage and then save it using VRayImage::save. This workflow will apply the Display Correction automatically.
If you have any changes in the VFB Layers and you want them applied to the output image, then you will have to specify that as well.
Your code would become something similar to:
// Start rendering.
renderer()->startSync();
// Wait for rendering to end.
renderer()->waitForRenderEnd();
// Using LocalVRayImage will free the memory automatically in the destructor
// Use GetImageOptions to apply the color corrections from the VFB (e.g. you added a Color Balance layer)
// If you haven't changed anything in the VFB, you can use getImage() without arguments directly
GetImageOptions gio;
gio.doColorCorrect = true;
LocalVRayImage output = renderer()->getImage(gio);
output.saveToPng("c:\\docs\\vray_test_render.png");
The VFB::saveImage method executes the File->Save… actions from the VFB. If you still want to use that, you can look at ImageWriterOptions.
A simple setup might look something like this:
ImageWriterOptions iwo;
iwo.flags.singleChannel = true;
iwo.flags.applyColorCorrections = true;
renderer()->vfb.saveImage("c:\\docs\\vray_test_render.png", iwo);
```