POV-Ray : Newsgroups : povray.advanced-users : Facebook 3D posts : Re: Facebook 3D posts Server Time
28 Sep 2021 16:08:45 EDT (-0400)
  Re: Facebook 3D posts  
From: Mike Horvath
Date: 18 Jun 2021 01:35:20
Message: <60cc3098$1@news.povray.org>
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 my_gradient = function(x, y, z, gradx, grady, gradz)
{
	atan(x * gradx + y * grady + z * gradz)/(pi/2)
}

#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


Post a reply to this message

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