Feedback

What's your question?

By: Asked

How do I render a panoramic environment map in renderman?

How do you create a lat long environment map with a single render in renderman?

  • 3

dan bethell [ Editor ]

Check out section 16.2.3 of Advanced RenderMan.

It explains how you can implement alternate camera models (in any RenderMan renderer that supports the trace() shadeop) using a clip plane shader. Essentially, this involves shading a geometry patch located just beyond the near clip plane. The book has an example panorama shader which can render a scene 360' around the y-axis.

Here is a lat-long shader based on that idea:

surface latlong()
{
    // our ndc-space point
    point _Pndc = transform( "NDC", P );

    // our parametric coordinates
    float _u = xcomp( _Pndc );
    float _v = ycomp( _Pndc );

    // our vector components
    float rayx = -cos( _u * PI * 2 ) * sin( _v * PI );
    float rayy = cos( _v * PI );
    float rayz = sin( _u * PI * 2 ) * sin( _v * PI );

    // our trace point/vector
    point _Pt = point "object" ( 0, 0, 0 );
    vector _It = vector "world" ( rayx, rayy, rayz );

    // trace a colour
    Ci = trace( _Pt, _It );
    Oi = Os;
    Ci *= Oi;
}

This particular shader uses the transform of the shaded object (presumably the clip plane geometry) to set the center of the projection. If you decide to use this method, be sure to set the trace visibility of objects so everything is visible to the trace() call.

A test scene with a pink dot marking the center of environment:

a scenethe clip plane

The rendered latlong map and a quick test using it as a reflection map:

the latlong maptesting the result

or Cancel