POV-Ray : Newsgroups : povray.newusers : shape generation (functions and more) Server Time
30 Jul 2024 18:13:40 EDT (-0400)
  shape generation (functions and more) (Message 2 to 11 of 11)  
<<< Previous 1 Messages Goto Initial 10 Messages
From: Hughes, B 
Subject: Re: shape generation (functions and more)
Date: 16 Feb 2004 20:21:16
Message: <40316c8c$1@news.povray.org>
"lars petter" <lar### [at] higno> wrote in message
news:4030e7fc$1@news.povray.org...
> I'll try again.. (sorry for any inclarities, i dont exactly know what i'm
> asking for :) )

I've seen your original message post at the programming group.

> The view in the tool will be in the x,y plane, viewed from top.. in the
> "drawing board" they will place differented shapes suchs as bezier curves,
> parabolas, circles (closed, open), ellipes (closed, open), and so on.
these
> shapes will have user-specific properties regarding to absorption,
> diffusion, width, and color. After placing a light source, we want to
render
> the scene in povray. The main point is to illustrate the caustics
generated
> by the system of mirrors in the scene..

So you'll be using photons, no doubt.

> Anyway, we've looked at the documentation, and tested a little "coding",
and
> concluded with that we probably should use the prism object to generate
the
> pov-ray figures, at least the bezier shapes.

You could be right about that. Not real sure myself.

> We've also looked at the various internal/math/whatever-functions in the
> .inc files, but we really cant understand how we actually use these to get
> shapes into the scene.. i'm looking at:
> Quartic_Paraboloid
> Quartic parabola - a 4th degree polynomial (has two bumps at the bottom)
> that has been swept around the z axis. The equation is:
> 0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
>
> how do i use this?
>
> all in all, we do have the mathematical parametres from the 2d-plane, and
> what we're looking for is some easy way to apply these to generate the 3d
> figures..

Isosurfaces seem the most plausible thing to me, since you'll be working
with equations anyhow. I've taken the example for f_quartic_paraboloid()
from the scenes\incdemo\i_internal.inc to make:

camera {
  location  <0.0, 0.0, -5.0>
  look_at   <0.0, 0.0, 0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0 rgb <0.9,0.9,0.9>]
      [1 rgb <0.3,0.3,0.3>]
    }
  }
}

light_source {
 -100*z,
 color rgb <1, 1, 1>
  rotate <15, 15, 0>
}

// ----------------------------------------

#include "functions.inc"

#declare IsoQP=
isosurface {
 function  {
  // f_quartic_paraboloid(x,y,z, -0.01)
  0-(0.5*x*x*x*x-x*x-y*y-z*z+0.5)
 }
 // contained_by {box { <-1.45, -0.1, -1.45>, <1.45, 2.5, 1.45> }}
 max_gradient 2.5
 all_intersections
}

difference {
object { // outside
    IsoQP
    material {
     texture {
      pigment {color rgb 0.75}
      finish {reflection {0.3,0.9}}
     }
    }
}
object { // inside
    IsoQP
    scale <0.95,0.95,0.95>
    translate y/6
    material {
     texture {
      pigment {color rgb 0.25}
      finish {reflection {0.1,0.3}}
     }
    }
}
// rotate -90*x // turn to look into parabloid
}

Maybe you can figure something out from this and by reading up on isosurface
functions. I'm not very good at the math, and you should be warned that the
carat (^) sign is not used in POV-Ray. If you'll be needing semitransparent
materials, the above texturing won't suffice to blend from one side to the
other.

Bob H.


Post a reply to this message

From: lars petter
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 07:57:30
Message: <40320fba$1@news.povray.org>
thanks, we've gotten some basic knowledge on the isosurfaces now.
    the problem is, they're only surfaces, not solid figures with a certain
width, so we're wondering if there is a way to, e.g., extrude a parabola 2
units, making it solid? that would've been smooth, he he. or do you see some
other way?

(sorry about the double posting with binary attached, first, i was about to
post in a .binaries group, but i found out that i
didnt need the image, so i posted here instead. however, i forgot to remove
the image. sheesh. =) )

- lars petter

"Hughes, B." <omn### [at] charternet> wrote in message
news:40316c8c$1@news.povray.org...
> "lars petter" <lar### [at] higno> wrote in message
> news:4030e7fc$1@news.povray.org...
> > I'll try again.. (sorry for any inclarities, i dont exactly know what
i'm
> > asking for :) )
>
> I've seen your original message post at the programming group.
>
> > The view in the tool will be in the x,y plane, viewed from top.. in the
> > "drawing board" they will place differented shapes suchs as bezier
curves,
> > parabolas, circles (closed, open), ellipes (closed, open), and so on.
> these
> > shapes will have user-specific properties regarding to absorption,
> > diffusion, width, and color. After placing a light source, we want to
> render
> > the scene in povray. The main point is to illustrate the caustics
> generated
> > by the system of mirrors in the scene..
>
> So you'll be using photons, no doubt.
>
> > Anyway, we've looked at the documentation, and tested a little "coding",
> and
> > concluded with that we probably should use the prism object to generate
> the
> > pov-ray figures, at least the bezier shapes.
>
> You could be right about that. Not real sure myself.
>
> > We've also looked at the various internal/math/whatever-functions in the
> > .inc files, but we really cant understand how we actually use these to
get
> > shapes into the scene.. i'm looking at:
> > Quartic_Paraboloid
> > Quartic parabola - a 4th degree polynomial (has two bumps at the bottom)
> > that has been swept around the z axis. The equation is:
> > 0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
> >
> > how do i use this?
> >
> > all in all, we do have the mathematical parametres from the 2d-plane,
and
> > what we're looking for is some easy way to apply these to generate the
3d
> > figures..
>
> Isosurfaces seem the most plausible thing to me, since you'll be working
> with equations anyhow. I've taken the example for f_quartic_paraboloid()
> from the scenes\incdemo\i_internal.inc to make:
>
> camera {
>   location  <0.0, 0.0, -5.0>
>   look_at   <0.0, 0.0, 0.0>
> }
>
> sky_sphere {
>   pigment {
>     gradient y
>     color_map {
>       [0 rgb <0.9,0.9,0.9>]
>       [1 rgb <0.3,0.3,0.3>]
>     }
>   }
> }
>
> light_source {
>  -100*z,
>  color rgb <1, 1, 1>
>   rotate <15, 15, 0>
> }
>
> // ----------------------------------------
>
> #include "functions.inc"
>
> #declare IsoQP=
> isosurface {
>  function  {
>   // f_quartic_paraboloid(x,y,z, -0.01)
>   0-(0.5*x*x*x*x-x*x-y*y-z*z+0.5)
>  }
>  // contained_by {box { <-1.45, -0.1, -1.45>, <1.45, 2.5, 1.45> }}
>  max_gradient 2.5
>  all_intersections
> }
>
> difference {
> object { // outside
>     IsoQP
>     material {
>      texture {
>       pigment {color rgb 0.75}
>       finish {reflection {0.3,0.9}}
>      }
>     }
> }
> object { // inside
>     IsoQP
>     scale <0.95,0.95,0.95>
>     translate y/6
>     material {
>      texture {
>       pigment {color rgb 0.25}
>       finish {reflection {0.1,0.3}}
>      }
>     }
> }
> // rotate -90*x // turn to look into parabloid
> }
>
> Maybe you can figure something out from this and by reading up on
isosurface
> functions. I'm not very good at the math, and you should be warned that
the
> carat (^) sign is not used in POV-Ray. If you'll be needing
semitransparent
> materials, the above texturing won't suffice to blend from one side to the
> other.
>
> Bob H.
>
>


Post a reply to this message

From: Tom Melly
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 09:12:15
Message: <4032213f$1@news.povray.org>
"lars petter" <lar### [at] higno> wrote in message
news:40320fba$1@news.povray.org...
> thanks, we've gotten some basic knowledge on the isosurfaces now.
>     the problem is, they're only surfaces, not solid figures with a certain
> width, so we're wondering if there is a way to, e.g., extrude a parabola 2
> units, making it solid? that would've been smooth, he he. or do you see some
> other way?
>

? do you mean you only want surfaces, or that isosurfaces are only surfaces? If
the latter, you need to revise your understanding of iso-surfaces.... (and
possibly take a look at some of the iso keywords, such as all_intersections ?).

> (sorry about the double posting with binary attached, first, i was about to
> post in a .binaries group, but i found out that i
> didnt need the image, so i posted here instead. however, i forgot to remove
> the image. sheesh. =) )
>

s*** happens.... ;)


Post a reply to this message

From: Tom Melly
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 10:08:21
Message: <40322e65$1@news.povray.org>
"lars petter" <lar### [at] higno> wrote in message
news:40320fba$1@news.povray.org...
> thanks, we've gotten some basic knowledge on the isosurfaces now.
>     the problem is, they're only surfaces, not solid figures with a certain
> width, so we're wondering if there is a way to, e.g., extrude a parabola 2
> units, making it solid? that would've been smooth, he he. or do you see some
> other way?

Here's an iso-surface w/ photons etc. for a shape based on sin(x).

I've given it some thickness by differencing the function from an off-set copy
of itself (otherwise the shape would be infinitely thick). I've slightly
coloured the glass to make the shape show up a little more clearly than would
otherwise be the case. Adjust spacing to meet your requirements/patience...

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 10
  photons {
    spacing 0.005 //smaller = better but slower
  }
}

camera {
  location  <0,5,-5>
  look_at   0
}


light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>

}


#declare fn_X = function(x,y,z){y-sin(x)}

isosurface {
  function { max(fn_X(x, y, z), - fn_X(x,y+0.5,z)) }
  contained_by { box {<-2,-10,-1>,<2,10,1> } }
  accuracy 0.001
  max_gradient 4
  all_intersections

  pigment{rgbf<0.9,0.9,1.0,1.0>}
  finish{reflection{fresnel}}
  interior{ior 1.5}

  photons{
    target 1
    refraction on
    reflection on
    collect off
  }
}

plane{y,-2 pigment{White}}


Post a reply to this message

From: Tom Melly
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 12:36:55
Message: <40325137@news.povray.org>
"lars petter" <lar### [at] higno> wrote in message
news:4030e7fc$1@news.povray.org...

> Quartic parabola - a 4th degree polynomial (has two bumps at the bottom)
> that has been swept around the z axis. The equation is:
> 0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
>
> how do i use this?
>

No idea - but this is weird looking if nothing else.... (I've put the abs bit in
since you specified =0 rather than <=0 )

#declare fn_Xb = function(x,y,z){0.1*pow(x,4) - x*x - y*y - z*z + 0.9}

isosurface {
  function { abs(fn_Xb(x, y, z)) - 0.1}
  contained_by { box {-10,10 } }
  accuracy 0.001
  max_gradient 250  // Eeeek!!!
  all_intersections
  pigment{Red}
}


Post a reply to this message

From: Mike Williams
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 13:51:35
Message: <X7A9iJAx5lMAFwrB@econym.demon.co.uk>
Wasn't it lars petter who wrote:
>thanks, we've gotten some basic knowledge on the isosurfaces now.
>    the problem is, they're only surfaces, not solid figures with a certain
>width, so we're wondering if there is a way to, e.g., extrude a parabola 2
>units, making it solid? that would've been smooth, he he. or do you see some
>other way?

I'm not sure if this is what you want, but there's a trick for creating
"thick" isosurfaces in my isosurface tutorial

<http://www.econym.demon.co.uk/isotut/substitute.htm#thick>

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Hughes, B 
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 16:15:38
Message: <4032847a$1@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:40325137@news.povray.org...
> "lars petter" <lar### [at] higno> wrote in message
> news:4030e7fc$1@news.povray.org...
>
> > Quartic parabola - a 4th degree polynomial (has two bumps at the bottom)
> > that has been swept around the z axis. The equation is:
> > 0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
> >
> > how do i use this?
>
> No idea - but this is weird looking if nothing else.... (I've put the abs
bit in
> since you specified =0 rather than <=0 )
>
> #declare fn_Xb = function(x,y,z){0.1*pow(x,4) - x*x - y*y - z*z + 0.9}
>
> isosurface {
>   function { abs(fn_Xb(x, y, z)) - 0.1}
>   contained_by { box {-10,10 } }
>   accuracy 0.001
>   max_gradient 250  // Eeeek!!!
>   all_intersections
>   pigment{Red}
> }

Hey, what's with that huge container Tom?? I managed to get a much faster
render by lowering it to a -1,1 size! Heh-heh. Curious shape, I don't know
what it is either mainly because I don't know how much of it is visible.

I figured a way to get just a surface sheet. Maybe compatible with Mike
Williams' iso-thickener? Probably not, I haven't checked. I should have
realized this before, but these function things will always be new to me. I
took Tom's iso and simply removed the y parameter from the function itself.
Here is a whole scene showing it in action, with a tiny difference in the
equation. And although I had used pow(x,4) before, too, I was unsure about
it causing any changes the original equation. I still don't know why I was
subtracting it from zero in the isosurface in my other reply! Something I
picked up from other people, I think.  :-D

global_settings {
  assumed_gamma 1.0
  photons {
   spacing 0.02
  }
}

camera {
  location  <1, 2, -3>
  look_at   <0, -0.25, 0>
}

light_source {
 -100*z,
 1
  rotate <10, 0, 0> // move above y plane
  photons {reflection on}
}

plane {
 y,0
 pigment {color rgb 1}
 finish {diffuse 1}
photons {
 collect on
}
}

#declare fn_Xb = function (x,z){0.5*pow(x,4) - x*x - y*y - z*z + 0.9}

isosurface {
  function { (fn_Xb(x,z))-0.1}
  contained_by { box {<-1,0,-1>,<1,0.5,0>} } // get half z, quarter y
  accuracy 0.001
  max_gradient 2
  all_intersections
  open
  pigment{color rgb 0}
  finish {reflection {0.99}}
  photons {target 1 reflection on collect on}
}


This could be considered the blind leading the blind, eh?

-- 
Bob H.
http://www.3digitaleyes.com


Post a reply to this message

From: Tom Melly
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 19:30:58
Message: <4032b242@news.povray.org>
Hughes, B. wrote:
> 
> Hey, what's with that huge container Tom?? I managed to get a much faster
> render by lowering it to a -1,1 size! Heh-heh. Curious shape, I don't know
> what it is either mainly because I don't know how much of it is visible.
> 

-0.1, 0.1 renders even faster! ;)

Like you, I don't know how much of the shape is of interest - I just 
kept bumping up the container until I got bored with the 
render-speed/max_gradient (I have a vague theory that as long as the mg 
keeps increasing, you haven't reached the de facto boundary of the 
shape's interest - but this based on intuition rather than knowledge).

> This could be considered the blind leading the blind, eh?

As you say - it's hard to know what shape is expected....


Post a reply to this message

From: Hughes, B 
Subject: Re: shape generation (functions and more)
Date: 17 Feb 2004 19:40:39
Message: <4032b487$1@news.povray.org>
"Tom Melly" <pov### [at] tomandlucouk> wrote in message
news:4032b242@news.povray.org...
>
> -0.1, 0.1 renders even faster! ;)

I bet it does.  LOL  Don't raise that max_gradient to 1000, too, though.


Post a reply to this message

From: Hughes, B 
Subject: Re: shape generation (functions and more)
Date: 21 Feb 2004 00:56:24
Message: <4036f308@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:X7A### [at] econymdemoncouk...
> "thick" isosurfaces in my isosurface tutorial
>
> http://www.econym.demon.co.uk/isotut/substitute.htm#thick

I'm replying back here because I lost track of where I had said a certain
isosurface I was suggesting to someone might not work with this particular
trick. Well, I was wrong. Mike William's has a great resource there, as many
of you already know. I ought to use it more.

Bob H.


Post a reply to this message

<<< Previous 1 Messages Goto Initial 10 Messages

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