RPIECE Code Modificaiton

Dear Group

As I have mentioned before, I am attempting to rewrite code for rpiece to allow for me to improve specular sampling of metal and metal2 reflections. I do have some questions that I hope that someone can answer. To give you a basic idea of the concept, see the following link:


What I wish to do is to render within the highlighted window within a specified view. I have gone the some of the rpiece source code so I do think that I understand how it basically works. My first question deals with the derivation of of pview horizontal and vertical view parameters. In the source code it is given as:

pview.horiz = 2.*180./PI*atan(tan(PI/180./2.*ourview.horiz)/hmult );
pview.vert = 2.*180./PI*atan(tan(PI/180./2.*ourview.vert)/vmult );

In my modified version of rpiece, instead of dividing by hmult/vmult at the end, I multiply times a fraction of the rendered scene. In other words, if the render window is a 100 x 250 portion of a 500 x 500 view, I will multiply times 0.2 and 0.5 to each of the respective equations in lieu of dividing by hmult and vmult. One thing that helps with this approach is that horiz and vert members of the VIEW type are all declared as double such that I should not have any issues with precision when using pcompos to merge the image (I hope). My question is if there anyone here who can explain the background/derivation of these equations and does anyone know whether they will be applicable to my approach? Also in the program, I modified the equations for hoff and voff to correspondto the lower left corner of the render window (see example picture). Once again this is expressed as a fraction of the entire image. For example, if the lower left corner of the render window correnspond to point (229,125), hoff and voff are 0.458 and 0.25 respectively. Similar to vert and horiz, hoff and voff are declared as double such that precision should not present any problems.

Taking this approach has not produced the view that I was expecting to render. For starters, if the overall view is 500 x 500 (the entire image is not rendered in the program, only the portion specified by the user) and I wish to render a 99 x 155 portion, the rendered view comes out as a 99 x 99 piece. Also, the view that is rendered isn't where I have theorized it will be based on my assumption of how the horizontal and vertical offsets interact with the program. Any help and/or insight to how I can accomplish my objectives would be very appreciated.



Set yourself up for fun at home! Get tips on home entertainment equipment, video game reviews, and more here. http://special.msn.com/home/homeent.armx