Anti-Aliasing with rtrace 360° stereo views

Hello, I’m rendering 360° stereo views with file. To create equirectangular projection Dion Moult work with “rtrace”: $ X=2048; Y=2048; cnt $Y $X | rcalc -f cal/ -e “XD=$X;YD=$Y;X=0;Y=0;Z=0;IPD=0.06;EX=0;EZ=0” | rtrace -n NCORES -x $X -y $Y -fac @saved.opt scene.oct > out.hdr. I render image but it have diagonal edges are like staircases. I read that rpict with have a parameter (-pj) for this but in “rtrace” it generate command line error. Are you know any solution for this? Thank you.

Juan Manuel

Hi Juan Manuel, the easiest is probably to render with e.g. twice the resolution and downsample with a Gaussian filter by pfilt -x /2 -y /2 -r .7 out.hdr > outNoSteps.hdr to get the desired effect.
Best, Lars.

1 Like

Hi Juan,

Lars’ suggestion is a good one, but you can also try modifying “” as follows to add some pixel sample jitter. The original code reads:

{ Direction of the current pixel (both angles in radians) }
px = (XD-1)/2 - $2;
py = YD-.5 - $1;

You can try modifying it to:

{ Direction of the current pixel (both angles in radians) }
px = (XD-1)/2 - $2 + 0.6*(1-2*rand(3.5381*recno+17.385));
py = YD-.5 - $1 + 0.6*(1-2*rand(-1.568*recno+4.2874));

The rand(seed) function returns a psuedo-random number based on seed, so we supply a different seed to each call computed from recno, the count of pixels that have been computed. If you don’t want to modify “”, you can instead modify your command, using:

cnt $Y $X | rcalc -e '$1=$1+0.6*(1-2*rand(-1.568*recno+4.2874))' -e '$2=$2+0.6*(1-2*rand(3.5381*recno+17.385))' | rcalc -f ...

I hope this helps!

1 Like

Hi Greg, thank you very much. I will try with both solution. And I let you know the results.

Hi Lars, thank you very much. I will try with this solution too.

Combining the two suggestions (over-sampling and filtering with pfilt plus jittered sampling) will look best.