POV-Ray : Newsgroups : povray.advanced-users : Facebook 3D posts : Re: Facebook 3D posts Server Time15 Sep 2024 16:29:10 EDT (-0400)
 From: Mike Horvath Date: 18 Jun 2021 01:35:20 Message: <60cc3098\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#60cc3098%241%40news.povray.org",
"dateCreated": "2021-06-18T05:35:20+00:00",
"datePublished": "2021-06-18T05:35:20+00:00",
"author": {
"@type": "Person",
"name": "Mike Horvath"
}
}
On 6/18/2021 1:19 AM, BayashiPascal wrote:
>> Interesting. The pigment in that example is clipped and normalized,
>> however. Wouldn't it make more sense geometrically to extend the pigment
>> to infinity?
>>
>>
>> Mike
>
> Do you mean the *gradient* is clipped and normalized ? If so, it is done in
> order to use it as an entry of the color_map (which afaik only takes value in
> [0, 1]). If not, I don't understand your comment.
>
> Pascal
>
>

I mean the gradient function has a minimum and maximum range versus. It
should more realistically start at the camera and extend into infinity.
(But also be scaled somehow to the scale of the scene.)

Here is my attempt, though I don't think it is working.

///////////////////////////////////////////////////////////////////////

#declare CAMERAPOS    = <3,3,3>;
#declare CAMERALOOKAT = <0,0,0>;
#declare CAMERAFRONT  = vnormalize(CAMERALOOKAT - CAMERAPOS);
#declare CAMERAFRONTX = CAMERAFRONT.x;
#declare CAMERAFRONTY = CAMERAFRONT.y;
#declare CAMERAFRONTZ = CAMERAFRONT.z;

{
}

#declare Muns_depth_pigment = pigment
{
function
{
//		clipped_scaled_gradient(x, y, z, CAMERAFRONTX, CAMERAFRONTY,
CAMERAFRONTZ, DEPTHMIN, DEPTHMAX)
my_gradient(x, y, z, CAMERAFRONTX, CAMERAFRONTY, CAMERAFRONTZ)
}
color_map
{
[0 color rgb <1,1,1>]
[1 color rgb <0,0,0>]
}
translate CAMERAPOS
}

///////////////////////////////////////////////////////////////////////

Mike
```