POV-Ray : Newsgroups : povray.binaries.images : adding a 'normal' to a camera-- some notes : Re: adding a 'normal' to a camera-- some notes Server Time
18 Apr 2024 00:43:04 EDT (-0400)
  Re: adding a 'normal' to a camera-- some notes  
From: Kenneth
Date: 11 Feb 2022 14:45:00
Message: <web.6206bb0dac36aa6b4cef624e6e066e29@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
>
> I'm not an official developer, but I did look some at the camera normal
> mechanism while implementing a 'micro' normal block pattern in my povr
> branch...
>
> [snip]
>
> I think the code is more or less working as intended - but it can
> certainly get complicated depending on what you want to do.
>

Sorry for the long delay, I needed to wrap my mind around your very useful
comments and to run some more tests.

This camera-normal stuff is indeed weird, and certainly not as simple to fix as
I thought. In my earlier 16:9 images using a gradient x+y normal, I did not
immediately grasp that the scale 'fix' only worked for the normal pattern
itself, not for its 'effect': the normal is correct at 45-deg, but the 'smeared
out' effect is still 'stretched' and not at 45-deg. And I  happened to have my
camera aimed exactly into +z -- which is another factor that affected the result
(the only partially 'correct' result, actually).

I've posted another series of tests here. In all cases, the 'fix' of
            scale <image_height/image_width, 1 1>
has been applied, and the camera is always looking directly into +z (unless
otherwise noted) at an ambient 1.0 sphere at location <0,0,0>. The sphere itself
is always centered in the renders. No light_sources. The radial and gradient x+y
patterns are simple 2-D, although they extend infinitely into z; the spherical
pattern is the only 3-D one I used.  With a *fully* 3-D pattern like bumps, the
visual result is just too difficult to figure out.

Some interesting observations:

In image A3 -- using the gradient x+y pattern and where the camera has been
rotated 75*y--there is a strange perspective effect of the normal! That's...odd,
because the sphere itself is still centered in the image. The other patterns
show this effect as well, more or less.  The camera's 'angle' setting seems to
be the cause; it exaggerates this perspective at higher values ('wide-angle').

In image C1 using a spherical pattern, I would have expected the effect's
'lobes' to all look equally extended and angled (perhaps at 45-deg multiples?).
But that's not the case. It seems that the pattern produces 'preferential' lobe
directions and lobe extent.

Purely from visual tests, I have come up with some ad hoc 'rules' to help when
applying a normal to a camera-- although I cannot say that these rules apply in
*all* cases:

1)  When using  the 'scale fix', the pattern itself always looks correct no
matter what the camera position or look_at point is. In other words, the pattern
is always centered and correctly 'stuck to the camera lens', and with its own
correct aspect ratio. *That's* good, at least. But this does not correct the
'effect' of the normal.

2) My guess at the moment is that the used normal pattern is taken from an
infinitely thin x/y 'slice', perhaps at the origin(?)-- based on an animation
test of the spherical pattern (using frequency 36) and translating it in z. The
resulting 'slice' moves in space as the pattern moves. BTW, I *think* this
pattern is centered on the camera by default.

3) Changing the camera's 'angle' value does not affect the size of the pattern
itself-- which is interesting!-- but instead changes the bump_size effect. In
other words, given an angle of 67 and bump_size of 0.5, when the angle is
reduced ('zooming in'), the given bump_size needs to be reduced as well, to
produce  what looks like the same effect or nearly so.  Unfortunately, the two
values do not have a strictly linear relationship.

4) The only way to get a truly undistorted/expected result from a camera normal
is to render a *square* 1:1 image, AND to aim the camera exactly into +z. It
does not matter where the camera is in space, just so it always points in +z.
Obviously, this is not an ideal situation when constructing a scene, or when you
want to use a different aspect ratio-- but the idea would be to simply crop the
square render later, to whatever aspect ratio you want.

BTW, I tried another test with the gradient x+y normal:
rotating the camera by 75*y, but also pre-rotating the normal itself by the same
amount to possibly 'align' both things, to see if that would correct everything.
Unfortunately, no; it screws-up the 45-angle of the normal, whether or not the
'scale fix' is used.


Post a reply to this message


Attachments:
Download 'camera_normal_problem_comp_2_kenw.png' (462 KB)

Preview of image 'camera_normal_problem_comp_2_kenw.png'
camera_normal_problem_comp_2_kenw.png


 

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