8
\$\begingroup\$

I am following this tutorial: here I am at the part where you are creating a hemicube. I have got the code to render the scene into a texture and therfore an array.

Now how can I generate a so-called "multiplier map" for use given these parameters: width, height, camera location, camera direction/normal.

I want the multiplier map to be stored in an array like this:

unsigned char* mult0 = new unsigned char[width*height];

I will have 5 of these maps for each side of the hemicube.

\$\endgroup\$

2 Answers 2

0
\$\begingroup\$
multiplier = new GLfloat[SCREEN_WIDTH*SCREEN_HEIGHT];// calc multiplier map
GLfloat* row = new GLfloat[SCREEN_WIDTH];
float factor = 90/SCREEN_WIDTH;
for (int i = 0;i < SCREEN_WIDTH;i++)
  row[i] = cos(DEG_TO_RAD(i*factor));

for (int i =0;i < SCREEN_HEIGHT;i++)
  std::copy(row, row + SCREEN_WIDTH, multiplier + (i*SCREEN_WIDTH));
delete row;

normalise(multiplier,SCREEN_WIDTH*SCREEN_HEIGHT);

Check your tutorial to normalize the map

\$\endgroup\$
0
\$\begingroup\$

I would strongly recommend against using that particular tutorial for direct implementation, from personal experience.

Rather, implement a progressive refinement approach, where in each pass you select a Shooter with highest unsent radiance (initially all lights), and compute form factors from that shooter against every other patch.

This way you will have a generic CPU solution that can be used off-line (at loading time or by other tool).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .