POV-Ray : Newsgroups : povray.general : Offset surface Server Time
29 Mar 2024 06:16:34 EDT (-0400)
  Offset surface (Message 14 to 23 of 33)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: Re: Offset surface
Date: 20 Jul 2018 23:32:56
Message: <5b52a968$1@news.povray.org>
Just to be clear, the offset surface of a perfect sphere should be 
another perfect sphere.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Offset surface
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

From: Mike Horvath
Subject: Re: Offset surface
Date: 21 Jul 2018 03:15:28
Message: <5b52dd90@news.povray.org>
It's all working now, thanks to you all!

I've attached the latest test code and render.


Mike


Post a reply to this message


Attachments:
Download 'and_test.pov.txt' (2 KB) Download 'and_test.png' (40 KB)

Preview of image 'and_test.png'
and_test.png


 

From: clipka
Subject: Re: Offset surface
Date: 21 Jul 2018 04:57:53
Message: <5b52f591$1@news.povray.org>
Am 21.07.2018 um 04:46 schrieb Mike Horvath:
> Wow, thanks!!
> 
> I haven't tested it yet, but I saw your note about performance. Do you
> think the parametric object is slower than an isosurface? I prefer the
> parametric, since all the "sketches" I've been doing in GeoGebra so far
> have been with parametric formulas, and in general I find them easier to
> understand. Isosurfaces always make my brain freeze.

My gut feeling is that for any given task there's nothing slower than
isosurfaces. After all, isosurfaces are pretty much the pinnacle of
flexibility, so they also provide the least potential for optimization.


Post a reply to this message

From: Kenneth
Subject: Re: Offset surface
Date: 24 Jul 2018 18:20:00
Message: <web.5b57a510a78a3750a47873e10@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> It's all working now, thanks to you all!
>
> I've attached the latest test code and render.
>

That's some really nice math work and problem-solving. I played around with the
bowl thickness and object scaling in your code, just to test the 'uniform wall
thickness' idea-- which works well!

You might try scaling the final bounded_by object to more closely fit the
resulting isosurface (for the sole purpose of making the scene render a bit
faster.) Even though the initial two isosurfaces' contained_by spheres can't be
scaled (that is, *non-uniformly* scaled), the final bounded_by sphere can. For
my render, I used <2.0,0.8,0.7> in the two initial functions...
         function {f_spheroid(x,y,z,2.0,0.8,0.7)}
             and
         function {f_spheroid_normalized(x,y,z,2.0,0.8,0.7)+surf_thick}

.... with surf_thick = 0.4, and bounded_by{sphere{0,1 scale <2.0, 0.8, 0.7>}}

This works well; I even tested the resulting (hidden) 'bounding box' shape with
min_extent/max_extent, to make sure of the close fit.

Of course. maybe a scaled BOX for the bounded_by shape could be an even closer
fit (to coincide with the differenced PLANE object in your code.)

I did notice some artifacts, in the self-shadowing area of the bowl. From
testing various things, it seems to be solely due to the isosurface 'accuracy'
value. I changed that from 0.001 to 0.000001, which appears to eliminate the
Moire patterns there. (I actually don't know how *small* a value that accuracy
can be, before it has no further effect.)

I was going to attach an image here of my tests, but I can't (using the web
interface, anyway.) I'll post it to the images section instead.


Post a reply to this message

From: Mike Horvath
Subject: Re: Offset surface
Date: 24 Jul 2018 18:36:48
Message: <5b57aa00$1@news.povray.org>
On 7/24/2018 6:15 PM, Kenneth wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> It's all working now, thanks to you all!
>>
>> I've attached the latest test code and render.
>>
> 
> That's some really nice math work and problem-solving. I played around with the
> bowl thickness and object scaling in your code, just to test the 'uniform wall
> thickness' idea-- which works well!
> 

Thanks!


> You might try scaling the final bounded_by object to more closely fit the
> resulting isosurface (for the sole purpose of making the scene render a bit
> faster.) Even though the initial two isosurfaces' contained_by spheres can't be
> scaled (that is, *non-uniformly* scaled), the final bounded_by sphere can. For
> my render, I used <2.0,0.8,0.7> in the two initial functions...
>           function {f_spheroid(x,y,z,2.0,0.8,0.7)}
>               and
>           function {f_spheroid_normalized(x,y,z,2.0,0.8,0.7)+surf_thick}
> 
> .... with surf_thick = 0.4, and bounded_by{sphere{0,1 scale <2.0, 0.8, 0.7>}}
> 
> This works well; I even tested the resulting (hidden) 'bounding box' shape with
> min_extent/max_extent, to make sure of the close fit.
> 
> Of course. maybe a scaled BOX for the bounded_by shape could be an even closer
> fit (to coincide with the differenced PLANE object in your code.)
> 
> I did notice some artifacts, in the self-shadowing area of the bowl. From
> testing various things, it seems to be solely due to the isosurface 'accuracy'
> value. I changed that from 0.001 to 0.000001, which appears to eliminate the
> Moire patterns there. (I actually don't know how *small* a value that accuracy
> can be, before it has no further effect.)
> 
> I was going to attach an image here of my tests, but I can't (using the web
> interface, anyway.) I'll post it to the images section instead.
> 
> 
> 

I'm not too worried about the artifacts, since 99% of the shape is 
hidden behind another texture. Only the edges are important to me. (See 
globe render in p.b.i.)


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Offset surface
Date: 24 Jul 2018 18:38:30
Message: <5b57aa66$1@news.povray.org>
On 7/24/2018 6:36 PM, Mike Horvath wrote:
> I'm not too worried about the artifacts, since 99% of the shape is 
> hidden behind another texture. Only the edges are important to me. (See 
> globe render in p.b.i.)
> 
> 
> Mike

p.b.a rather


Post a reply to this message

From: Alain
Subject: Re: Offset surface
Date: 26 Jul 2018 14:26:29
Message: <5b5a1255$1@news.povray.org>
Le 18-07-20 à 12:09, Bald Eagle a écrit :
> clipka <ano### [at] anonymousorg> wrote:
> 
>> You /could/ just pretend that the parallel curve to an ellipsis is also
>> an ellipsis. AFAIK that's not true, but it could be sufficiently close
>> for your purposes.
> 
> I was initially under the impression that he could do this, but they're similar
> shapes, and therefore proportional - not constant distance.
> 
> I just took a scaled torus and then made a scaled copy - it's definitely not
> good.
> 
> I'm assuming Mike wants to make an atmosphere for the globe or something
> similar.
> 
>> In that case, all you'd have to do would be to scale the ellipsoid.
> I already suggested this, and was properly shot down.
> 
> 
> 
> 

If you want the atmosphere for an oblate, rotating, planet, then, it 
will be thicker over the equator and thinner at the poles.
So, a scalled up version of the original ellipsoid should be a prety 
good approximation.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Offset surface
Date: 28 Jul 2018 23:35:01
Message: <web.5b5d34ada78a37509cbeb2fe0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
>...
> Perhaps someone better versed in the parametric object can determine why I can't
> get it to render the full surface, since the exact same equations are used in
> the nested loop of spheres to correctly approximate the surface.
>...

>...
> // --------------------------------------- parametric surface --------------
> #declare Parallel = parametric {
>  function {EllipseX (u, v)}
>  function {EllipseY (u, v)}
>  function {EllipseZ (v)}
>  <0, pi>, <0, 2*pi>  // start, end (u,v)
>  contained_by {sphere {0, R}}
>  max_gradient 50
>  accuracy 0.005
>  precompute 5 x,y,z
>  texture {pigment{ color rgb <0, 1, 0>}}
> }
>
> //object {Parallel}

Try this:

parametric {
    function { a*cos(u)*cos(v) }
    function { b*cos(u)*sin(v) }
    function { c*sin(u) }
    <0, 0>, <2*pi, pi>
    contained_by {
        sphere { <0, 0, 0>, max(a, b, c) }
    }
    max_gradient max(a, b, c)
    accuracy 1e-6
    precompute 10 x, y, z
    pigment { color Green }
}

The main problem was your boundaries for u and v.

--
Tor Olav
http://subcube.com


Post a reply to this message

From: Bald Eagle
Subject: Re: Offset surface
Date: 29 Jul 2018 14:30:01
Message: <web.5b5e0776a78a3750458c7afe0@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> >...
> > Perhaps someone better versed in the parametric object can determine why I can't
> > get it to render the full surface, since the exact same equations are used in
> > the nested loop of spheres to correctly approximate the surface.


> The main problem was your boundaries for u and v.

Ah yes. that.   And my failure to see the obvious mistake.   :|

Some days.....

There's something that's a candidate for a parser warning.

Thanks - that's one less thing on my "I really need to go back and look at...."
list.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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