POV-Ray : Newsgroups : povray.programming : Using POV for computing environment maps & background cubes : Using POV for computing environment maps & background cubes Server Time
28 Jul 2024 10:17:58 EDT (-0400)
  Using POV for computing environment maps & background cubes  
From: Nigel Stewart
Date: 5 Jun 2002 21:03:51
Message: <3CFEB431.8030008@nigels.com>
Hello,

I've come across an issue in POV 3.1g recently,
but I've been away from the POV newsgroups and
community for a while.  So, I understand there
is 3.5 in the pipeline, but no source as yet.

I'm tinkering with using POV to capture environment
maps suitable for use in OpenGL.  The basic idea is
to choose a position in the scene and render six
pinhole cameras with 90 degree field of view:
front, right, back, left, top, bottom.

This works reasonably well overall, but I'm observing
some discontinuity along the edges of the top and bottom
images, where they meet front, right, back and left.

Looking at the POV source, it seems that the grid
of rays traced is not centered on the pixel, they are
on the top-left (or bottom-left) corner.  So, it seems
that simply shifting these by half a pixel should solve
the problem:

In create_ray (render.c)

     case PERSPECTIVE_CAMERA:
       x0 = x / (DBL)Frame.Screen_Width - 0.5;
       y0 = ((DBL)(Frame.Screen_Height - 1) - y)
	/ (DBL)Frame.Screen_Height - 0.5;

...should become...

     case PERSPECTIVE_CAMERA:
       x0 = (x+0.5) / (DBL)Frame.Screen_Width - 0.5;
       y0 = ((DBL)(Frame.Screen_Height - 0.5) - y)
	/ (DBL)Frame.Screen_Height - 0.5;

I'm going to actually test this for corectness when I get
some time, but in the meantime, interested in your
impressions.

Regards,

Nigel Stewart

http://www.cs.rmit.edu.au/~nigels


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.