Customer Translate

Selasa, 28 Januari 2014

Irradiance map modes: Rendering a static scene from multiple views

Irradiance map modes: Rendering a static scene from multiple views
Search Keywords: IR, Irradiance map, GI
In this tutorial we will examine ways to efficiently render a static scene from multiple views.
This is the scene we will use for the tutorial:
We want to efficiently render several views of this scene, using the irradiance map.
The different irradiance map modes will help us in this task.
First open the starting scene.
By default the irradiance map mode is set to Single frame. This allows us to render the scene from any view, but every time the irradiance map will be computed from scratch. There are two cameras in the scene. Render each of them:
We could render a single view, save the irradiance map, and tell V-Ray to use that map, instead of computing a new one the next time. Since the irradiance map from the last rendering is still in memory (we have the Don't delete option in the On render end group set), all we have to do is open the Advanced irradiance map parameters rollout and click the Save to file button. Choose a file name, for example "test", and save the irradiance map.
Now that we have map saved to disk, we have to tell V-Ray to use that map. Change the irradiance map mode to From file, click the Browse button and select the file we just saved. Re-render the image. Notice that now V-Ray does not calculate an irradiance map, but skips directly ahead to the rendering.
Since no irradiance map is computed, the rendering is very fast. What if we want to render the first view at this moment? This is what happens:
Clearly this is not what we want, but why does it happen? The irradiance map is only partially view-independent - meaning that a single sample in the irradiance map is valid for any view, but the samples for a given view are optimally generated for that view only. V-Ray will not calculate the irradiance map for parts of the scene that are out of view. If you check the Show samples option in the Indirect illumination rollout and render the scene, you can see where the actual samples are:
Is it possible to render this new view using the old samples and add new ones only where it is necessary? The answer is "yes". Just set the irradiance map mode to Incremental add to current map. Remember that the current irradiance map is still in memory. Render the view:
V-Ray has added more samples to the irradiance map. Here is a comparison of the old map (green samples) and the new map (red samples):
Now, let us see what the scene looks like with the this map. Save the irradiance map to the same file, set the mode to From file, turn off Show samples and render:
In fact it is not necessary to go through the whole save/load procedure every time. Set the mode again to Incremental add to current map. Change the current view to perspective view and render some more random views - simply change the view and render. Do this several times. Here are the views I rendered: (click an image for a larger rendering):
After you render some views, save the irradiance map to a file by clicking the Save to file button. Save it to the same file as before. We are going to need this map in a moment.
As a comparison, here is the last of these images, re-rendered with the irradiance map mode set to Single frame (which means that a completely new irradiance map was generated):
Notice the increased render time - generating a new map is more costly than using the one already in memory as a basis.
Let's go back to the saved irradiance map. Now it contains information for quite a large portion of our scene. We can use that to render other views without adding any more irradiance samples. Set the mode to From file. Choose a view that is roughly similar to a view you have rendered before and render:
Note that we did not do any irradiance calculations for this image! We used only the irradiance map that we have computed so far. This is possible because the irradiance map already contained enough information to render this view, even though we have not rendered it before.
If the irradiance map did not contain enough information, we would get artifacts as before, and would have to use the Incremental add to current map mode to fill in the missing information.
As a conclusion, here is a basic workflow that can be used to render a static scene from multiple views:
  • First prepare the scene (geometry, materials, lighting etc)
  • Adjust the irradiance map settings for the required level of detail (e.g. chose a suitable preset) and tune the other render parameters.
  • Clear any previous irradiance map from memory in order to avoid weird results
  • Set the irradiance map mode to Incremental add to current map
  • Render as many views as you need. The first one will be slow, since a full irradiance map will be computed. Each of the next views will be faster depending on how relevant the memory irradiance map is to that view.
  • You can save the accumulated irradiance map to a file. That map can be used to render quickly other views of the scene, if required later on. To load the saved map, you need to set the mode to From file, enter the correct file name and render any image. You can then set the mode back to Incremental add to current map and continue rendering other views. If you are sure the map already contains enough information, you can simply leave the mode to From file.
Note that if you make any changes in the scene (e.g. add/delete objects, change materials or lights etc) the irradiance map that is in memory will no longer be relevant to the scene and you will need to reset the irradiance map and start all over again.
 
Chrome Pointer