POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Attached to Project: POV-Ray
Opened by Tim Attwood - 2009-05-10
Last edited by Christoph Lipka - 2010-06-19

FS#19 - AOI pattern

Adding an AOI pattern is asked for fairly frequently.

Closed by  Christoph Lipka
Saturday, 19 June 2010, 01:01 GMT
Reason for closing:  Implemented
Additional comments about closing:  

No beta tester feedback for way over a month now; I consider that good news.

Grimbert Jérôme commented on Thursday, 18 March 2010, 21:15 GMT

Greetings,

Here a suggestion of code (based on beta 35 a) which provide two new patterns:
aoi (angle of incidence, based on the ray and the perturbed normal)
aim (based on the perturbed normal and a unit vector)

Illustrating scenes are provided in additional tarball.
Source tar ball is "modified full files" (patch file available on request, but I seems to have read that full files are prefered)

How it works ?

The normal (as a unit vector) and either the ray direction (aoi) or the unit vector (aim) are used to compute the Dot.product,
then absolute value is kept.
So actually the resulting value is more (abs(cos(angle)) than the actual angle;
But as we need a number between 0 and 1, I found that:
- it is ok
- it is quick (no point in computing the arcos then dividing)
- it give the same result whatever the sens of the Normal
- if you really want a linear map rendering, you can adjust map with the cosine value as index

Caveat

The code might be unprotected when the pattern is used in media, it might be wise to check Null Intersection and Null Ray in aim_pattern() and aoi_pattern() (or sooner in the eval switch ?) to avoid Null pointer issue

Grimbert Jérôme commented on Sunday, 21 March 2010, 13:07 GMT

I added some protections regarding the pointers.
Attached is the delta (for patch or other diff) from Beta35a

patterns:
aoi = angle of incidence (normal vs ray)
aim <3D vector> = normal vs direction
facing <3D vector> = normal vs (intersection to fixed point)

Admin
Christoph Lipka commented on Sunday, 28 March 2010, 16:11 GMT

Thanks to Grimbert for his work!

I'd suggest some changes though:

* Drop the "aim" pattern, as the functionality is already available with the "slope" pattern.
* Not introduce yet another keyword for the "facing" functionality; I think a good option would be to allow for an optional location vector parameter to the "aoi" keyword, i.e. "pigment { aoi <X,Y,Z> }" (as it happens this coincides with MegaPOV's syntax).
* Do compute the actual angle instead of just the dot product, returning a value from 0.0 (facing away from the ray origin or reference point) to 1.0 (facing towards the ray origin or ref point), to be consistent with the implementation of the "slope" pattern.

An alternative would be to include all the functionality into the "slope" pattern, though this raises a few questions:

* How should the syntax look like? One possibility would be to allow for the keywords "camera" or "point_at VECTOR", respectively, instead of the direction vector, i.e. "pigment { slope { camera [, Lo_slope, Hi_slope ] } }" and "pigment { slope { point_at <X,Y,Z> [, Lo_slope, Hi_slope ] } }", respectively.
* How would the "altitude" parameters be interpreted? An easy way out would be to disallow the "altitude" keyword in conjunction with the "camera" or "point_at" keywords.

After some consideration, I personally favor using the "aoi" keyword for the real angle-of-incidence pattern only, while using the "slope { point_at ... }" syntax for what your proposal implements as "facing ...".

Christian Froeschlin commented on Sunday, 28 March 2010, 22:33 GMT

Oops. I probably should have added a comment here that
I had already ported the AOI pattern from MegaPOV over
to 3.7b and sent the modified files to Chris Cason. That
was a just before the bugtracker went online, though.

Well, main thing is we'll have AOI in 3.7 ;)

Admin
Christoph Lipka commented on Monday, 29 March 2010, 01:50 GMT

Implemented with change #4935; syntax may still need some updating depending on feedback

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing