POV-Ray : Newsgroups : povray.newusers : <no subject> Server Time
23 Nov 2024 06:39:17 EST (-0500)
  <no subject> (Message 1 to 8 of 8)  
From: yesbird
Subject: <no subject>
Date: 18 Feb 2023 15:25:00
Message: <web.63f131bec23a6d9b3a8a2ec10800fb2@news.povray.org>
Hi,

Can anybody explain me, please, how 'isosurface' works ?
I am trying to render:

V = cos(x) + cos(y) + cos(z); // Attached

but see nothing, except the axis. At the same time function from tutorial works
fine (see code below).

Thanks in advance,
--
YB

#version 3.8;
global_settings { assumed_gamma 1 }

#include "functions.inc"

//
// Axis textures
//
#declare fin_axis = finish { phong 1 reflection {0.10 metallic 0.4 }}
#declare tex_axis_common = texture {
           pigment { rgb <0.70, 0.70, 0.70> }
           finish  { fin_axis }}
#declare tex_axis_x = texture { pigment { rgb x} finish { fin_axis }}
#declare tex_axis_y = texture { pigment { rgb y} finish { fin_axis }}
#declare tex_axis_z = texture { pigment { rgb z} finish { fin_axis }}


//
// Axis
//
#macro axis_base( len, rad, tex_odd, tex_even )
union{
    cylinder { <0, -len, 0>,<0, len, 0>, rad
               texture{ checker texture{ tex_odd } texture{ tex_even }
               translate <0.1, 0, 0.1> }}

    cone{<0, len, 0>, rad * 2, <0, len + rad * 7, 0>, 0 texture{tex_even} }}
#end

#macro axis_xyz( len_x, len_y, len_z, rad, tex_common, tex_x, tex_y, tex_z)
union{
    #if (len_x != 0) object { axis_base(len_x, rad, tex_common, tex_x) rotate<
0, 0,-90>} #end
    #if (len_y != 0) object { axis_base(len_y, rad, tex_common, tex_y) rotate<
0, 0,  0>} #end
    #if (len_z != 0) object { axis_base(len_z, rad, tex_common, tex_z) rotate<
90, 0,  0>} #end }
#end

#macro axis(len_x, len_y, len_z, rad)
    axis_xyz( len_x, len_y, len_z, rad, tex_axis_common, tex_axis_x, tex_axis_y,
tex_axis_z)
#end


//
// Perspective camera
//
#macro camp (_x, _y, _z, _lx, _ly, _lz, _ang)
camera
  { perspective
    location < _x,  _y,  _z>
    look_at  <_lx, _ly, _lz>
    angle _ang
  }
#end

//
// Lights
//
#declare luminosity = 1.7;
light_source {<0,  10, 0>, rgb <1,1,1> * luminosity }
light_source {<0, -10, 0>, rgb <1,1,1> * luminosity }

light_source {< 10, 0, 0>, rgb <1,1,1> * luminosity }
light_source {<-10, 0, 0>, rgb <1,1,1> * luminosity }

light_source {<0, 0,  10>, rgb <1,1,1> * luminosity }
light_source {<0, 0, -10>, rgb <1,1,1> * luminosity }


axis (3,3,3,0.02)
camp (5,5,5, 0,0.3,0, 55)


//-------------  Objects --------------------------------------------

//
// FUnction
//
// #declare f = function { f_sphere(x,y,z,0.8) - pow(f_noise3d(x,y,z),2) } // Ok
#declare f = function { cos(x) + cos(y) + cos(z) } // Not displayed (?)

//
// Surface
//
isosurface {
  function { f(x,y,z) }

  pigment { rgbft <0,0.5,0,0.6,0>
            scale 2
            translate 1}

  scale 1.5 }
//-------------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'iso.png' (95 KB)

Preview of image 'iso.png'
iso.png


 

From: Bald Eagle
Subject: Re: <no subject>
Date: 18 Feb 2023 16:15:00
Message: <web.63f13fc06f92e8561f9dae3025979125@news.povray.org>
"yesbird" <nomail@nomail> wrote:
> Hi,
>
> Can anybody explain me, please, how 'isosurface' works ?
> I am trying to render:
>
> V = cos(x) + cos(y) + cos(z); // Attached

So, IIRC that's like a gyroid or something...

If you email me, I can can send you a PDF copy of Mike Williams' Isosurface
Tutorial.

But the key idea is that it's an ISOsurface.

Very often what you need to do is subtract your function result from a space
coordinate so that when the function's surface point is AT that space point, the
result is zero - or whatever you set your threshold to.

After a few quick experiments, I established that you like want to "check" the
distance of your curve from a sphere, so I used that.  You can probably use the
in-built f_sphere as well.


So try:

camp (7,0,-7, 0,0.3,0, 55)


//-------------  Objects --------------------------------------------

//
// FUnction
//
// #declare f = function { f_sphere(x,y,z,0.8) - pow(f_noise3d(x,y,z),2) } // Ok
#declare f = function { cos(x) + cos(y) + cos(z) } // Not displayed (?)

//
// Surface
//
#declare R = 1;
isosurface {
  function { sqrt (x*x+y*y+z*z)/8 - f(x, y, z)}

   threshold 0
 accuracy 0.0001
 max_gradient 1.6
 open
 contained_by {box {-4, +4}}

  pigment { rgbft <0,0.5,0,0.6,0>
            scale 2
            translate 1}

}


Post a reply to this message


Attachments:
Download 'isosurfacetest1.png' (64 KB)

Preview of image 'isosurfacetest1.png'
isosurfacetest1.png


 

From: Bald Eagle
Subject: Re: <no subject>
Date: 18 Feb 2023 16:20:00
Message: <web.63f1401f6f92e8561f9dae3025979125@news.povray.org>
It's also easier to test your code if you attach the .pov file to the post
instead of pasting the code.

If you want to post both the image and the .pov file, you can do that with a
newsreader like Thunderbird.


Post a reply to this message

From: yesbird
Subject: Re: <no subject>
Date: 18 Feb 2023 16:45:00
Message: <web.63f1466c6f92e856b3a8a2ec10800fb2@news.povray.org>
Thanks a lot, it works, but I still don't know how :)

> If you email me, I can can send you a PDF copy of Mike Williams' Isosurface
> Tutorial.

I would like to, because  really need to know more about IS, but can't find
your email. As to posts and attachments, I will take it into account, and
install old-good Thunderbird now.
--
YB
 


Post a reply to this message

From: Bald Eagle
Subject: Re: <no subject>
Date: 18 Feb 2023 17:15:00
Message: <web.63f14dcb6f92e8561f9dae3025979125@news.povray.org>
"yesbird" <nomail@nomail> wrote:
> Thanks a lot, it works, but I still don't know how :)

* it's a "netscape" email address

As a first approximation, consider what you'd need to get a zero result for
every point along the parabola y = f(x) = pow(x,2).

It's y-f(x), which is y-y.

but you're doing that in 3D, which means you need the distance from the origin,
not the distance along any single axis.   Therefore the distance formula, since
for whatever reason, we can't use vlength() in functions.


* on the ".net"

> > If you email me, I can can send you a PDF copy of Mike Williams' Isosurface
> > Tutorial.
>

> your email. As to posts and attachments, I will take it into account, and
> install old-good Thunderbird now.


* and you can reach me @ there as "creativechemist"

Or hit reply to one of my posts and it should quote my email at the top.  ;)

- BW


Post a reply to this message

From: Kenneth
Subject: Re: <no subject>
Date: 19 Feb 2023 12:35:00
Message: <web.63f25cfd6f92e8569b4924336e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> It's also easier to test your code if you attach the .pov file to the post
> instead of pasting the code.
>

Hmm. I have the opposite opinion-- IF the code example is not too lengthy, of
course. I'm using the web portal though.

Posting the code in the body of the message works for me, because I can see it
immediately, in relation to the question posed. THEN, if the answer is a bit
mysterious, I'll just cut-and-paste the example into a new scene file to run (or
even some handy old scene file temporarily, if I'm in a hurry.)

Naturally, this assumes that I make no cut-and-paste errors during the process--
which has been known to happen. ;-)


Post a reply to this message

From: Kenneth
Subject: Re: <no subject>
Date: 19 Feb 2023 13:35:00
Message: <web.63f26ad06f92e8569b4924336e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > It's also easier to test your code if you attach the .pov file to the post
> > instead of pasting the code.
> >
>
> Hmm. I have the opposite opinion-- IF the code example is not too lengthy, of
> course. I'm using the web portal though...

I just noticed something peculiar when looking for this previous post in
'message digest'-- it shows up as <no subject> there (using the web portal)
instead of with the name of the OP's main-post as the subject.  I haven't seen
that happen before. I'm pretty sure that I replied and posted in my usual
manner.

I wonder if Thunderbird users see the same  <no subject> ?


Post a reply to this message

From: Kenneth
Subject: Re: <no subject>
Date: 19 Feb 2023 13:40:00
Message: <web.63f26c886f92e8569b4924336e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> I just noticed something peculiar when looking for this previous post in
> 'message digest'-- it shows up as <no subject> there

Oh, never mind. The OP's original subject header was <no subject>.


Post a reply to this message

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