Rendering of normal map

Dear Radiance community,

I wish to use Radiance to render a normal map of a scene. By normal map
I mean a floating point RGB image, where the RGB values of each pixel
correspond to the xyz coordinates of the surface normal in scene
coordinates. More precisely, for example for the red channel:

     R = (Nx + 1)/2

where Nx is the surface normal (in scene coordinates, not camera
coordinates) of the primary ray intersection point for a given ray. With
the expression given above the resulting pixel values should be in the
range from 0 to 1.

I have been working with making my own normal.cal function, since Nx,
Ny, and Nz are available in rayinit.cal, so it should be dead easy, I
just can't figure out how to return the offset/scaled N values as RGB
values directly, so as to completely bypass any lighting computations.

Best,
Claus

Hi!

I wish to use Radiance to render a normal map of a scene. By normal map
I mean a floating point RGB image, where the RGB values of each pixel
correspond to the xyz coordinates of the surface normal in scene
coordinates. More precisely, for example for the red channel:

    R = (Nx + 1)/2

I think I'd use rtace with -oN, pipe the result to rtrace to calculate your channel value, and convert the output into a radiance hdr format using pvalue.

I guess that, if you want to do all this with rpict and render the surfaces "in your scene", you could try the glow modifier as a material to modify. Just as a starting point.

CU Lars.

Hi Lars,

your little hint concerning glow was the final push I needed to crack the nut. It turned out to be even easier than I expected. Here is my material specification (glow, modified by colorfunc, which calls a normalshader.cal function file that I wrote, listed further down):

···

----------------------------------------------------------------

# Materials

void glow normalglow
0
4 1.0 1.0 1.0 -1

normalglow colorfunc normalshadermaterial
4 red green blue normalshader.cal
0

------------------------------------------

The normalshader.cal looks like this (thanks to Greg for making function files so easy to use and versatile):

{
  normalshader.cal

  Look in RADIANCE/lib/rayinit.cal for more info on builtin funcs and vars
}

red = (Nx + 1)/2;
green = (Ny + 1)/2;
blue = (Nz + 1)/2;

-------------------------------------------------------------------------

A example normal map is attached. It looks a little ugly because it is a triangle mesh constructed from a stereo camera scan of an outdoor scene (color image attached, too).

Best,

Claus

Lars O. Grobe wrote:

Hi!

I wish to use Radiance to render a normal map of a scene. By normal map
I mean a floating point RGB image, where the RGB values of each pixel
correspond to the xyz coordinates of the surface normal in scene
coordinates. More precisely, for example for the red channel:

    R = (Nx + 1)/2

I think I'd use rtace with -oN, pipe the result to rtrace to calculate your channel value, and convert the output into a radiance hdr format using pvalue.

I guess that, if you want to do all this with rpict and render the surfaces "in your scene", you could try the glow modifier as a material to modify. Just as a starting point.

CU Lars.
_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general