POV-Ray : Newsgroups : povray.general : Offset surface : Re: Offset surface Server Time
25 Apr 2024 21:03:41 EDT (-0400)
  Re: Offset surface  
From: Mike Horvath
Date: 21 Jul 2018 02:22:15
Message: <5b52d117$1@news.povray.org>
On 7/20/2018 10:02 AM, And wrote:
> Many years ago I ever do something for the same goal.
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5264d1b954cff585cc1fd1150%40news.povray.org%3E/?ttop=423056
> &toff=750
> 
> But not the same, I used the math formula, not parametric formula. And just suit
> for a small offset(a thin shell)
> Because it is just an approximation.
> 
> 
> 

Very nice, thanks!

I did a test, but there are graphical artifacts related to max_gradient 
I think. The docs say a warning should appear if max_gradient is too far 
off, but I don't see such a warning.

#############################################

#version 3.8;
global_settings {assumed_gamma 1.0}

#declare Zoom = 128;

camera
{
	orthographic
	location	-z * 128		// position & direction of view
	direction	+z
	right		x*image_width/Zoom	// horizontal size of view
	up			y*image_height/Zoom	// vertical size of view
	rotate x * 15
	rotate y * 45
}

/*
camera
{
	location <0, 0, -4>    // position & direction of view
	look_at  <0, 0, 0>
	right x*image_width/image_height         // horizontal size of view
	up y // vertical size of view
	rotate x * 15
	rotate y * 15
}
*/

sky_sphere {pigment {rgb <0.5, 0.5, 1>}}
plane {y, -3 pigment {checker}}
light_source {<30, 30, -30> color rgb 1 parallel point_at 0}


#declare surf_thick = 0.1;

#declare f_spheroid = function(var1,var2,var3, a,b) 
{var1*var1/a/a+var2*var2/a/a+var3*var3/b/b-1}

#declare f_spheroid_normalized = function(var1,var2,var3, a,b) 
{f_spheroid(var1,var2,var3, 
a,b)/sqrt(4*(var1*var1+var2*var2)/pow(a,4)+4*var3*var3/pow(b,4))}


//than difference these two isosurfaces
difference
{
	isosurface
	{
		function {f_spheroid_normalized(x,y,z,1,2)-surf_thick}
//		accuracy		0.001
		max_gradient	4
		//evaluate P0, P1, min (P2, 1)
		contained_by {sphere {0, 4}}
	}
	isosurface
	{
		function {f_spheroid(x,y,z,1,2)}
//		accuracy		0.001
		max_gradient	4
		//evaluate P0, P1, min (P2, 1)
		contained_by {sphere {0, 4}}
	}
	plane {-y, 0}
	pigment {color rgbt <1,1,1,1/4>}
}


Post a reply to this message

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