POV-Ray : Newsgroups : povray.binaries.images : adding a 'normal' to a camera-- some notes : adding a 'normal' to a camera-- some notes Server Time
25 Jan 2022 17:20:27 EST (-0500)
  adding a 'normal' to a camera-- some notes  
From: Kenneth
Date: 6 Jan 2022 21:50:00
Message: <web.61d7a9a92980bbd4cef624e6e066e29@news.povray.org>
I sometimes use a 'normal' block in a camera statement, for interesting and
un-planned effects.  While playing around with that, I noticed that my renders
looked... different... depending on the aspect-ratio that I chose -- like 4:3
vs. 16:9.  After eliminating other possibilities, it occurred to me that the
problem was due to the aspect ratio's scaling of the normal pattern.  The normal
itself has to  have a *reciprocal* scaling applied (in x) to account for the
aspect ratio-- even with a typical 4:3 render. Otherwise, the normal is

The documentation at   ' Camera Ray Perturbation'  does not mention this,
nor does the example scene 'camera2' that is referenced there.  I had always
thought that a  camera normal was independent of the actual IMAGE aspect ratio,
or would automatically compensate for it; but not so. I tested only the
perspective camera; I don't know what happens with the other types.

An 'un-corrected' camera normal is meant only for a *square* 1:1 rendered image.
That makes sense of course, because any normal or pattern is intrinsically 1:1:1
in 3-D space. But when used in a CAMERA, a scaling has to be added to keep the
normal's pattern correct re: a chosen aspect ratio.

This 'extra' distortion is not obvious when using, for example, a bumps pattern
for the normal. So I set up a  test scene with a strict 45-degree gradient x+y
normal, where the resulting aspect-ratio distortion is obvious. (I added the
white lines later, in an image-editing app.)

#version 3.8;
global_settings{assumed_gamma 1.0}
#default{finish{ambient .4 emission 0 diffuse 0}}

camera {
  location  <0, 0, -20>
  look_at   <0, 0,  0>
  right     x*image_width/image_height
  // direction z
  // angle 67

  gradient x+y // a 45-degree pattern
  scale .1
  bump_size .4
  / /scale <3/4,1,1> // for 4/3 render
  // OR...
  // scale <9/16,1,1> // for 16/9 render
  // -- etc. --

#declare S = seed(21);
 pigment{rgb <.1 + .9*rand(S),.1 + .9*rand(S),.1 + .9*rand(S)>}
 translate <-15 + 30*rand(S), -10 + 20*rand(S),0>

Post a reply to this message

Download 'camera_normal_comp.jpg' (376 KB)

Preview of image 'camera_normal_comp.jpg'


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