POV-Ray : Newsgroups : povray.binaries.images : Isosurface woes Server Time
2 Aug 2024 14:14:13 EDT (-0400)
  Isosurface woes (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: s day
Subject: Re: Isosurface woes
Date: 12 Jul 2013 17:25:02
Message: <web.51e073eeb644a79d5bfe13270@news.povray.org>
"jceddy" <jce### [at] gmailcom> wrote:

> Any ideas?
>

I adjusted the crackle function (reversed the colours) then subtracted this from
the cylinder instead of adding it (see below) does the attached look like what
you were after?

Sean

#declare fn_CracklePigment = function {
    pigment {
        crackle
        pigment_map {
          [0.1 color rgb 0]
          [0.2 color rgb 1]
        }
    }
}

#declare fn_Cylinder = function(_x, _y, _z, _rad, _len) {
  max(sqrt(pow(_x,2) + pow(_z,2)) - _rad, f_rounded_box(_x, _y, _z, 0, _rad,
_len/2, _rad))
}

#macro RoundCylinder(inner, outer, length)
  #if(use_iso)
    isosurface {
      function {
        min(
          min(
            f_torus(x, y - (length/2-outer), z, inner-outer, outer),
            fn_Cylinder(x, y, z, inner, length-2*outer)
          ),
          min(
            fn_Cylinder(x, y, z, inner-outer, length),
            f_torus(x, y + (length/2-outer), z, inner-outer, outer)
          )
        ) - fn_CracklePigment(x, y, z).gray/10
      }
      contained_by { box { <-10, -length/2, -10>, <10, length/2, 10> } }
//container shape
      accuracy 0.001                      // accuracy of calculation [0.001]
      max_gradient 4                      // maximum gradient the function
canhave [1.1]

      texture {
        crackle
        texture_map {
          [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
          [0.2 pigment { color rgb <0, 0, 0> } ]
        }
      }
    }
  #else
    union {
      torus { inner-outer, outer translate <0, length/2-outer, 0> }
      cylinder { <0, -length/2+outer, 0>, <0, length/2-outer, 0>, inner }
      cylinder { <0, -length/2, 0>, <0, length/2, 0>, inner-outer }
      torus { inner-outer, outer translate <0, -(length/2)+outer, 0> }

      texture {
        crackle
        texture_map {
          [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
          [0.2 pigment { color rgb <0, 1, 0> } finish { ambient 1 }]
        }
      }
    }
  #end
#end

object { RoundCylinder(3, 0.2, 5) }


Post a reply to this message


Attachments:
Download 'c.png' (36 KB)

Preview of image 'c.png'
c.png


 

From: William F Pokorny
Subject: Re: Isosurface woes
Date: 13 Jul 2013 08:27:03
Message: <51e14797$1@news.povray.org>
On 07/12/2013 09:18 AM, jceddy wrote:
>........

Where you are intersecting the infinite cylinder function with the built 
in rounded box function, I would recommend avoiding 0 rounding for the 
corners. In my experience f_rounded_box performance is an order of 
magnitude or more faster when even a little (0.02) rounding is specified.

You'd need to adjust the intersection f_rounded_box x and z scaling by 
adding the rounding used else the rounded corners show up in the 
resulting shape.

max(sqrt(pow(_x,2) + pow(_z,2)) - _rad, \
     f_rounded_box(_x, _y, _z, 0, _rad+rd,_len/2, _rad+rd))

Thinking aloud: I'm guessing others responding recommended subtracting 
the crackle function instead of adding because in subtracting any 
function returning values >=0, the shape is made larger. In other words, 
using subtraction here removes any chance the addition of the crackle 
shrinks the shape, or parts of it, to nothing.

Bill P.


Post a reply to this message

From: Alain
Subject: Re: Isosurface woes
Date: 13 Jul 2013 16:34:24
Message: <51e1b9d0$1@news.povray.org>

> So, I have the following macro that generates a rounded cylinder isosurface with
> a noise/pigment subtracted from it:
>
> #declare fn_CracklePigment = function {
>      pigment {
>          crackle
>          pigment_map {
>            [0.1 color rgb 1]
>            [0.2 color rgb 0]
>          }
>      }
> }
>
> #declare fn_Cylinder = function(_x, _y, _z, _rad, _len) {
>    max(sqrt(pow(_x,2) + pow(_z,2)) - _rad, f_rounded_box(_x, _y, _z, 0, _rad,
> _len/2, _rad))
> }
>
> #macro RoundCylinder(inner, outer, length)
>    #if(use_iso)
>      isosurface {
>        function {
>          min(
>            min(
>              f_torus(x, y - (length/2-outer), z, inner-outer, outer),
>              fn_Cylinder(x, y, z, inner, length-2*outer)
>            ),
>            min(
>              fn_Cylinder(x, y, z, inner-outer, length),
>              f_torus(x, y + (length/2-outer), z, inner-outer, outer)
>            )
>          ) + fn_CracklePigment(x, y, z).gray/10
>        }
>        contained_by { box { <-10, -length/2, -10>, <10, length/2, 10> } }  //
> container shape
>        accuracy 0.001                      // accuracy of calculation [0.001]
>        max_gradient 4                      // maximum gradient the function can
> have [1.1]
>
>        texture {
>          crackle
>          texture_map {
>            [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
>            [0.2 pigment { color rgb <0, 0, 0> } ]
>          }
>        }
>      }
>    #else
>      union {
>        torus { inner-outer, outer translate <0, length/2-outer, 0> }
>        cylinder { <0, -length/2+outer, 0>, <0, length/2-outer, 0>, inner }
>        cylinder { <0, -length/2, 0>, <0, length/2, 0>, inner-outer }
>        torus { inner-outer, outer translate <0, -(length/2)+outer, 0> }
>
>        texture {
>          crackle
>          texture_map {
>            [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
>            [0.2 pigment { color rgb <0, 0, 0> } ]
>          }
>        }
>      }
>    #end
> #end
>

Check the messages, paying attention to the max_gradient found. Your 
max_gradient may be to low.

As have been said, try with a larger rounding radius.

Performance whise, as your crackle function is created in shades of 
gray, going from rgb 0 to rgb 1, you can safely use .red, .green or 
.blue and get exactly the same result, but get it faster.

.red, .green and .blue simply return the value of a single channel. In 
your case, they are all the same.
.gray evaluate all 3 colour channels and perform a ponderated average. 
As the 3 channels are the same, that average is exactly the value of any 
one channels.

For your base cylinder, you can:
#include "functions.inc"
Then, use:
function { -f_superellipsoid(x,y,z, 0.1, 1) + fn_CracklePigment(x, y, 
z).red/10 }

With this function, setting the last parameter to 1 gives a rounded 
cylinder.

Or make your actual function a little simpler:
     isosurface {
       function {
         min(
             f_torus(x, y - (length/2-outer), z, inner-outer, outer),
             fn_Cylinder(x, y, z, inner, length-2*outer)
             fn_Cylinder(x, y, z, inner-outer, length),
             f_torus(x, y + (length/2-outer), z, inner-outer, outer)
         ) + fn_CracklePigment(x, y, z).red/10
       }


min and max are not limited to only 2 parameters.
The are described as max(A,B,...) and min(A,B,...) meaning they can take 
an arbitrary number of parameters larger than 1.



Alain


Post a reply to this message

From: jceddy
Subject: Re: Isosurface woes
Date: 15 Jul 2013 16:35:00
Message: <web.51e45beab644a79d314aa6840@news.povray.org>
Thanks for the help, guys.

I changed the component from .gray to .red. I also found that I was able to
decrease the max_gradient a bit, and now the image renders in about half the
time it was previously.

Also simplified the max() to take 4 args instead of nesting.

I modified the iso to subtract the inverse of the crackle pigment, as well...I
realized belatedly that this actually works better for when I'm composing it
into the object it fits into, since I know the result takes up *at least* the
space that the original rounded cylinder did. I did have to increase the size of
the bounding box a bit so stuff sticking out on the ends of the cylinder don't
get cut off.

I avoided using fn_superellipsoid because it didn't give me quite the control I
wanted.

I attached an image of the working cylinder.

I'll try to remember to post an image (at least a rough draft) of the thing I'm
working on that will use it.

I think this could be pretty cool in an image using radiosity to make the red
really glow, but haven't had the patience to do any kind of test render yet.


Post a reply to this message


Attachments:
Download 'golem01.jpg' (62 KB)

Preview of image 'golem01.jpg'
golem01.jpg


 

From: jceddy
Subject: Re: Isosurface woes
Date: 15 Jul 2013 17:55:01
Message: <web.51e46e96b644a79d314aa6840@news.povray.org>
I've been using the robot from Cod3Monk3y's POV Planet for testing various
materials.  Here's an image incorporating the lava-rock cylinder (the big
spheres are still just plain textured spheres). The metal part is a copper with
patina I've been working on, but is still too shiny on the clean parts.

Here's the test image.


Post a reply to this message


Attachments:
Download 'golem01.jpg' (85 KB)

Preview of image 'golem01.jpg'
golem01.jpg


 

From: jceddy
Subject: Re: Isosurface woes
Date: 15 Jul 2013 17:55:01
Message: <web.51e46ec1b644a79d314aa6840@news.povray.org>
Oops, meant to put a link to the robot's web site:

http://www.c0d3m0nk3y.com/gallery/robot.html


Post a reply to this message

From: jceddy
Subject: Re: Isosurface woes
Date: 16 Jul 2013 09:15:01
Message: <web.51e54633b644a79d314aa6840@news.povray.org>
And here's a higher resolution render (so far).

I realized I need to randomize the crackle to keep creation of the same object
from resulting in an exact duplicate.


Post a reply to this message


Attachments:
Download 'golem01.jpg' (250 KB)

Preview of image 'golem01.jpg'
golem01.jpg


 

From: Cousin Ricky
Subject: Re: Isosurface woes
Date: 16 Jul 2013 23:30:00
Message: <web.51e60eefb644a79d540235480@news.povray.org>
"jceddy" <jce### [at] gmailcom> wrote:
> I think this could be pretty cool in an image using radiosity to make the red
> really glow, but haven't had the patience to do any kind of test render yet.

That would be really cool.  Here is an image that uses glowing media with
radiosity.  (I will be releasing the source into the Object Collection under the
CC-LGPL licence within the next few days.)


Post a reply to this message


Attachments:
Download 'spheresweep_lanes.jpg' (46 KB)

Preview of image 'spheresweep_lanes.jpg'
spheresweep_lanes.jpg


 

From: Alain
Subject: Re: Isosurface woes
Date: 17 Jul 2013 14:21:33
Message: <51e6e0ad$1@news.povray.org>

> Thanks for the help, guys.
>
> I changed the component from .gray to .red. I also found that I was able to
> decrease the max_gradient a bit, and now the image renders in about half the
> time it was previously.
>
> Also simplified the max() to take 4 args instead of nesting.
>
> I modified the iso to subtract the inverse of the crackle pigment, as well...I
> realized belatedly that this actually works better for when I'm composing it
> into the object it fits into, since I know the result takes up *at least* the
> space that the original rounded cylinder did. I did have to increase the size of
> the bounding box a bit so stuff sticking out on the ends of the cylinder don't
> get cut off.
>
> I avoided using fn_superellipsoid because it didn't give me quite the control I
> wanted.
This was only an option. It's obvious to me that it don't fit in all 
situations.

>
> I attached an image of the working cylinder.
>
> I'll try to remember to post an image (at least a rough draft) of the thing I'm
> working on that will use it.
>
> I think this could be pretty cool in an image using radiosity to make the red
> really glow, but haven't had the patience to do any kind of test render yet.
>

In version 3.7, use emission in the finish for the places that are 
suposed to glow.
That way, they will provide some lighting to the rest of the scene.

For your first tests, only use this radiosity block in your 
global_settings block:

radiosity{}

Now, reduce the intencity of your lightsource and go play with radiosity 
a bit...


Post a reply to this message

From: Alain
Subject: Re: Isosurface woes
Date: 17 Jul 2013 14:23:56
Message: <51e6e13c@news.povray.org>

> And here's a higher resolution render (so far).
>
> I realized I need to randomize the crackle to keep creation of the same object
> from resulting in an exact duplicate.
>
For that, you can use a macro and a random stream.


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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