POV-Ray : Newsgroups : povray.binaries.images : adding a 'normal' to a camera-- some notes : adding a 'normal' to a camera-- some notes Server Time
24 Apr 2024 17:59:10 EDT (-0400)
  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
'distorted'.

The documentation at   '3.4.2.4 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 {
  perspective
  location  <0, 0, -20>
  look_at   <0, 0,  0>
  right     x*image_width/image_height
  // direction z
  // angle 67

  normal{
  gradient x+y // a 45-degree pattern
  sine_wave
  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);
#for(i,1,100)
sphere{0,1
 pigment{rgb <.1 + .9*rand(S),.1 + .9*rand(S),.1 + .9*rand(S)>}
 translate <-15 + 30*rand(S), -10 + 20*rand(S),0>
 }
#end


Post a reply to this message


Attachments:
Download 'camera_normal_comp.jpg' (376 KB)

Preview of image 'camera_normal_comp.jpg'
camera_normal_comp.jpg


 

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