POV-Ray : Newsgroups : povray.newusers : Dodgy Wine Glass Server Time
5 Nov 2024 04:25:25 EST (-0500)
  Dodgy Wine Glass (Message 1 to 9 of 9)  
From: nzdzeni
Subject: Dodgy Wine Glass
Date: 5 Dec 2005 20:35:01
Message: <web.4394e96f76af86a5b2fe0630@news.povray.org>
Hi,

I have created a wine glass, complete with wine in it.  The problem is that
the "shadow" did not look right.  When I rotated the glass, it became clear
that there was a large amount of "noise" slicing through the glass (near
the top).

Here is a link to the picture of my "dud wine glass".
http://www.complus.co.nz/blogpics/dudglass.jpg"

The code I used is below:

---
  #include "colors.inc"
#include "glass.inc"


  camera {
    location <10, 15, -20>
    look_at <0, 0, 0>
    angle 50
  }

  background { color Silver }


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


  plane {
    <0, 1, 0>, -4
    pigment {color LightBlue }
    finish{reflection .2}
  }


#declare Wine_Glass=
//Wine Glass
sor {
    12,
    <0.0,  -0.5>,
    <2.0,   0.1>,
    <0.2,   0.15>,
    <0.2,   0.18>,
    <0.2,   1.0>,
    <0.2,   2.0>,
    <0.2,   3.0>,
    <0.2,   4.0>,
    <0.4,   4.4>,
    <2.0,   6.0>,
    <1.5,   8.5>,
    <2,   10.0>


    open
     texture {
      T_Glass3    // Pre-defined from glass.inc
      scale 3       }



  }


#declare Red_Wine=
union
{
object { Wine_Glass
        finish {reflection 0.2}
        }

intersection

{object {Wine_Glass
        scale .999
        translate <0, 0.001, 0>
        pigment {color White}
        }

difference{
        plane {y,7}
        plane {y,4.5}
           }
          }
           }


object {Red_Wine
        translate <0, -2, 0>
        rotate <30, 0, -30>

        }
---

So, where have I done wrong????  Its making me nuts.

Thanks in advance for any help.

Dzeni :)


Post a reply to this message

From: PM 2Ring
Subject: Re: Dodgy Wine Glass
Date: 5 Dec 2005 23:10:01
Message: <web.43950e5890f42f19ad93754b0@news.povray.org>
"nzdzeni" <nzd### [at] gmailcom> wrote:
> Hi,
>
> I have created a wine glass, complete with wine in it.  The problem is that
> the "shadow" did not look right.  When I rotated the glass, it became clear
> that there was a large amount of "noise" slicing through the glass (near
> the top).
>
> Here is a link to the picture of my "dud wine glass".
> http://www.complus.co.nz/blogpics/dudglass.jpg"
>
> The code I used is below:
>
> object { Wine_Glass
>         finish {reflection 0.2}
>         }
>
> intersection
>
> {object {Wine_Glass
>         scale .999
>         translate <0, 0.001, 0>
>         pigment {color White}
>         }
>


> difference{
>         plane {y,7}
>         plane {y,4.5}
>            }
>           }
>            }
>

I've just had a quick look, but I'm pretty sure that these planes are the
source of the problem. Remember that POV planes fill half the universe. You
need to have one normal pointing up, one pointing down.

See 2.2.2.4 in the 3.6 docs


Post a reply to this message

From: Warp
Subject: Re: Dodgy Wine Glass
Date: 6 Dec 2005 03:20:05
Message: <439549b5@news.povray.org>
nzdzeni <nzd### [at] gmailcom> wrote:
> When I rotated the glass, it became clear
> that there was a large amount of "noise" slicing through the glass (near
> the top).

  At least the noise goes away by adding "sturm" to the sor.

-- 
                                                          - Warp


Post a reply to this message

From: nzdzeni
Subject: Re: Dodgy Wine Glass
Date: 6 Dec 2005 04:10:00
Message: <web.4395545b90f42f19b2fe0630@news.povray.org>
Hi Warp,

Thanks for the sturm tip.  It gets rid of the noise beautifully but the
shadow of the glass is still wrong.  This bothers me a lot as the shadow
should match the image that casts it.

PM 2,

I commented out the planes to see if that would get rid of the noise and
interstingly, it didn't!  Which would imply that the planes are not the
problem.

So, that leaves me still looking for answers to the noise / dodgy shadow
problem.

Thanks for all the input so far.

G-d Bless
Dzeni :)
http://www.dzeni.blogspot.com


Post a reply to this message

From: Warp
Subject: Re: Dodgy Wine Glass
Date: 6 Dec 2005 04:48:05
Message: <43955e54@news.povray.org>
nzdzeni <nzd### [at] gmailcom> wrote:
> Thanks for the sturm tip.  It gets rid of the noise beautifully but the
> shadow of the glass is still wrong.  This bothers me a lot as the shadow
> should match the image that casts it.

  Well, that shadow isn't physically accurate anyways. If you want
something more close to reality you'll have to use photons.
  OTOH your glass isn't physically correct either (and because of this
simply adding photons won't get a correct result): It's made of
solid glass (the "open" keyword doesn't really change this). A real-life
glass has an outer and an inner surface.
  The best way to model a wineglass is using a lathe instead of a sor,
and model the inner surface too.

-- 
                                                          - Warp


Post a reply to this message

From: Chris B
Subject: Re: Dodgy Wine Glass
Date: 6 Dec 2005 07:19:07
Message: <439581bb$1@news.povray.org>
"nzdzeni" <nzd### [at] gmailcom> wrote in message 
news:web.4395545b90f42f19b2fe0630@news.povray.org...
> Hi Warp,
>
> Thanks for the sturm tip.  It gets rid of the noise beautifully but the
> shadow of the glass is still wrong.  This bothers me a lot as the shadow
> should match the image that casts it.
>
> PM 2,
>
> I commented out the planes to see if that would get rid of the noise and
> interstingly, it didn't!  Which would imply that the planes are not the
> problem.
>
> So, that leaves me still looking for answers to the noise / dodgy shadow
> problem.
>
> Thanks for all the input so far.
>
> G-d Bless
> Dzeni :)
> http://www.dzeni.blogspot.com
>
>

As well as what Warp said, there are also quite a few other things wrong 
with your SDL, some of which also distort the shadows.
Your texture and pigment definitions seem to me to be in the wrong places, 
so the texture definition of the glass is applied on top of the White 
pigment you seem to want for the content. The planes used to slice off the 
top and bottom of the content don't have any pigment, so will be black.
Also the scaling that you use for the content w.r.t. the glass is not 
centred on the origin so will move the content down a little, with the 
danger of giving you coincident or overlaping surfaces.
The message stream shows a max_trace_level reached warning and another about 
the glass texture you've chosen.

The following SDL shows where I would put the pigment and texture 
statements, and I think it probably gets over quite a few of your shadow 
problems:
Regards,
Chris B.


#include "colors.inc"
#include "glass.inc"

camera {
  location <0, 8, -20>
  look_at <0, 0, 0>
  angle 50
}

background { color Silver }

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

plane {
  <0, 1, 0>, -4
  pigment {color LightBlue }
  finish{reflection .2}
}

//Wine Glass
#declare Wine_Glass= sor {
  12,
  <0.0,  -0.5>,
  <2.0,   0.1>,
  <0.2,   0.15>,
  <0.2,   0.18>,
  <0.2,   1.0>,
  <0.2,   2.0>,
  <0.2,   3.0>,
  <0.2,   4.0>,
  <0.4,   4.4>,
  <2.0,   6.0>,
  <1.5,   8.5>,
  <2,   10.0>
  open
  sturm
}


#declare Red_Wine = intersection {
  object {Wine_Glass
    translate -7*y
    scale .9
    translate 7*y
    translate <0, 0.001, 0>
  }
  plane {-y,-4.5}
  plane { y, 0 rotate z*30 rotate -x*30 translate 7*y}  // or plane {y,7}
  pigment {color Red+0.5*t}
}

object {Red_Wine
  translate <0, -2, 0>
  rotate <30, 0, -30>
}

object {Wine_Glass
  texture {
    T_Glass3    // Pre-defined from glass.inc
    scale 3
  }
  translate <0, -2, 0>
  rotate <30, 0, -30>
}


Post a reply to this message

From: PM 2Ring
Subject: Re: Dodgy Wine Glass
Date: 8 Dec 2005 03:50:00
Message: <web.4397f33190f42f198e989a880@news.povray.org>
"nzdzeni" <nzd### [at] gmailcom> wrote:

> PM 2,
>
> I commented out the planes to see if that would get rid of the noise and
> interstingly, it didn't!  Which would imply that the planes are not the
> problem.

Sorry about that! Still, those planes did need fixing. :)

By way of apology, here is something I derived from what Chris B posted. I
hope you like it.


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

/*

Less dodgy wine glass

Derived From: Chris B
Subject: Re: Dodgy Wine Glass
Date: 6 Dec 2005 12:19:07
Message: <439581bb$1@news.povray.org>

PM 2Ring

*/

#include "colors.inc"
#include "glass.inc"

#declare Photons = 1;
#declare Area_Lights = 1;
#declare Use_Sturm = 1;

global_settings {
  assumed_gamma 2.2   //because of glass.inc
  max_trace_level 10

#if(Photons)
  photons {
    count 250000
    autostop 0
  }
#end
}

camera {
  location <0, 2, -2> * 10 * .85
  //location <0, .5, -2> * 10 * .65
  look_at 3.25*y
  angle 50
}

#if(0)
  sky_sphere{pigment{function{abs(y)}}}
#else
  background {color Silver}
#end

#declare Spot = 0.75;
light_source {
  <-5, 6, -3>*25
  //rgb 1
  rgb 640 fade_distance 6.25 fade_power 2
  spotlight point_at 8*z falloff 8*Spot radius 5*Spot tightness 0.1*Spot

  #if(Area_Lights)
    #declare AL = 5;
    #declare ASize = 2.5;
    area_light x*ASize, z*ASize, AL, AL
    adaptive 1
    jitter
    circular
    orient
  #end
}

#declare Floor =
plane {
  y, -1e-4
  texture{
    pigment {cells colour_map{[0 White][0.25 SkyBlue][1 White]}}
    //pigment {color LightBlue }
    pigment {checker SkyBlue, White}
    //pigment {checker rgb <1,.8,.9>, White}

    finish{reflection .25 diffuse 0.75 specular 0.25 roughness 1e-4}
    //finish{diffuse .9}
    //normal{quilted .25 control0 0 control1 0}
    //normal{wrinkles .15 scale 3e-5}

    translate z
    scale 10

    rotate y*45
  }
}

//Wine Glass
#declare WGS = 10;
#declare WGA = array[WGS]    //SOR points
{
  <0.0,  0.4>,
  <2.0,  1.0>,
  <0.2,  1.05>,
  <0.2,  1.08>,
  <0.2,  1.9>,
  <0.2,  4.9>,
  <0.4,  5.3>,
  <2.0,  6.9>,
  <1.5,  9.4>,
  <  2, 10.9>
}

#declare Wine_Glass_Outer = sor {
  #declare I=0;
  WGS,
  #while(I<WGS)
    WGA[I]
    #declare I=I+1;
  #end
  #if(Use_Sturm) sturm #end
  //pigment{checker}
}

#declare TH = 0.025;            //thickness (sort-of)
#declare Wine_Glass_Inner = sor {
  #declare I=5;
  WGS-I,
  #while(I<WGS)
    WGA[I] + <-TH, TH*1e-4>         //move inwards, and up a tiny bit
    #declare I=I+1;
  #end
  #if(Use_Sturm) sturm #end
  //pigment{checker Red,Yellow}finish{ambient .5}
}

#declare Wine = intersection
{
  plane {y, 8.5}
  sor {
    #declare I=5;
    WGS-I,
    #while(I<WGS)
      WGA[I] + <-TH-1e-4, TH*2e-4>         //move inwards, and up a tiny bit
more
      #declare I=I+1;
    #end
    #if(Use_Sturm) sturm #end
  }

  texture {
    pigment{Red filter .6 transmit .4}
    finish{ambient 0 diffuse 0.2 reflection {0,1 fresnel} conserve_energy}
  }
  interior{ior 1.35}

  photons {
    target
    refraction on
    reflection on
    collect off
  }
}

#declare Wine_Glass = difference {
  object{Wine_Glass_Outer}
  object{Wine_Glass_Inner}

  texture {T_Glass3}
  interior{ior 1.5}

  photons {
    target
    refraction on
    reflection on
    collect off
  }
}

//---The
scene--------------------------------------------------------------------------

union{
  object{Wine_Glass}
  object{Wine}

  translate <0, -1, 1>
  //rotate x*-45
}

object{Floor}

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


Post a reply to this message

From: nzdzeni
Subject: Re: Dodgy Wine Glass
Date: 8 Dec 2005 15:35:01
Message: <web.4398986190f42f19b2fe0630@news.povray.org>
PM2, amazing effort!!

The finished glass looks great :)

I have a long way to go before I reach your degree of sophistication but it
is great to see that such graphics are possible.

Thanks for the time and effort that you (and Chris) have put into this
problem.

G-d Bless

Jenni :)
http://www.dzeni.blogspot.com


Post a reply to this message

From: PM 2Ring
Subject: Re: Dodgy Wine Glass
Date: 9 Dec 2005 00:35:01
Message: <web.4399160290f42f19ad93754b0@news.povray.org>
"nzdzeni" <nzd### [at] gmailcom> wrote:
> PM2, amazing effort!!
>
> The finished glass looks great :)

Thanks!

> I have a long way to go before I reach your degree of sophistication but it
> is great to see that such graphics are possible.
>
> Thanks for the time and effort that you (and Chris) have put into this
> problem.

Aw shucks, t'weren't nuthin' :)

Over the weekend, I'm going to convert the glass to using a lathe instead of
sor. Differences can be *very* slow.


Post a reply to this message

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