GI generation modes

REDsdk provides several GI cache generation modes for more flexibility. This enables you to render still images, spherical panoramas as well as full scene animations.

Note:

GI caches can be saved to .red files in order to be later reused. See Saving and loading a GI cache for details.

Camera

This is the default generation mode. The GI cache is computed for the current view and therefore, can't be used to render the scene from another viewpoint. It's the suitable mode for still images or animations with moving objects rendering (see Rendering GI with moving objects).

task

Task: Computing a view-dependent GI cache

Here is how you can build a view-dependent GI cache:


// "win" is a pointer to a RED window.
// "viewpoint" is a pointer to a scene viewpoint.
RED::IWindow* iwin = win->As< RED::IWindow >();

// Publish the latest data modifications.
RC_TEST( iresmgr->EndState() );

// Render the world GI cache.
RED::Object* gi_cache;
RED::Vector< RED::Vector3 > nofilter;
RED::Vector< RED::Object* > noexclude, noblock;
bool complete = false;

while( !complete )
{
  RC_TEST( iwin->FrameTracingGICache( complete, gi_cache, viewpoint, RED::GICM_CAMERA_VIEW, nofilter, noexclude, noblock ) );
}

Spherical

In this mode, the engine computes a 360° view-dependent GI cache usable to render panoramas.

Example of a 360° panorama with GI rendered using the Spherical mode.

task

Task: Computing a view-dependent 360° GI cache

Here is how you can build a view-dependent 360° GI cache suitable to render panoramas:


// "win" is a pointer to a RED window.
// "viewpoint" is a pointer to a scene viewpoint.
RED::IWindow* iwin = win->As< RED::IWindow >();

// Publish the latest data modifications.
RC_TEST( iresmgr->EndState() );

// Render the world GI cache.
RED::Object* gi_cache;
RED::Vector< RED::Vector3 > nofilter;
RED::Vector< RED::Object* > noexclude, noblock;
bool complete = false;

while( !complete )
{
  RC_TEST( iwin->FrameTracingGICache( complete, gi_cache, viewpoint, RED::GICM_CAMERA_SPHERICAL, nofilter, noexclude, noblock ) );
}

World

World GI caches contain information about GI everywhere in the scene. Such caches are not view-dependent any more and can be used to render moving camera animations (see Rendering GI with moving camera).

task

Task: Computing a world GI cache

Here is how you can build a world GI cache:


// "win" is a pointer to a RED window.
// "viewpoint" is a pointer to a scene viewpoint.
RED::IWindow* iwin = win->As< RED::IWindow >();

// Publish the latest data modifications.
RC_TEST( iresmgr->EndState() );

// Render the world GI cache.
RED::Object* gi_cache;
RED::Vector< RED::Vector3 > nofilter;
RED::Vector< RED::Object* > noexclude, noblock;
bool complete = false;

while( !complete )
{
  RC_TEST( iwin->FrameTracingGICache( complete, gi_cache, viewpoint, RED::GICM_WORLD, nofilter, noexclude, noblock ) );
}

Note:

The last parameter of the call to RED::IWindow::FrameTracingGICache above is an optional pointer to a list of locations in the scene from where the GI cache will be seen. It's used during the cache creation to concentrate the computation effort on visible parts of the scene and is very helpful to filter parts of the scene which are never visible. It helps producing clean GI caches containing meaningful entries. For example, In the context of computing a cache for a camera animation, this list could include the positions of the camera along the animation path.