POV-Ray : Newsgroups : povray.binaries.images : Just in time for Christmas, Hopefully Server Time
2 Aug 2024 06:20:59 EDT (-0400)
  Just in time for Christmas, Hopefully (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tim Attwood
Subject: Re: Just in time for Christmas, Hopefully
Date: 17 Dec 2007 06:13:12
Message: <476659c8$1@news.povray.org>
> I've tried everything that's been suggested, so far, but nothing - aside 
> from
> decreasing the number of control points - had any effect.  And decreasing 
> the
> number of control points messed up my uv_mapping.
>
> I'm posting the code for the bulb, if anyone can help me, I'd be grateful.

The problem is too many control points in a small space.
This is similar to other floating point accuracy issues, because
of floating point errors some of the points in your lathe are
doubling back, or coincident. A work-around is to scale up your
lathe's control points, then scale down the lathe to the desired size.

#macro ChristmasBulb(bulbMaterial, capMaterial, isMapped, Transform)

// These parameters control the size of the bulb.
// The cap translation is linked to these parameters
#local r = 125;
#local r2 = 50;
#local T = 3.125;

/* !--- DO NOT CHANGE THESE EQUATIONS. ---! */
#local h = sqrt(pow(r,2) - pow(r2,2));
#local s = degrees(atan(h/r2));

merge {
   lathe {
      linear_spline
      3338,

      #local a = 0;
      #while(a < s+90)
         #local P = vrotate(-r*y, a*z);

         <P.x, P.y>

        #local a = a + (s+90)/1500;
      #end


 #local b = s ;
 #while(b > 0)
 #local P = vrotate(-r2*x, b*z);

      <(r2+(r2*cos(radians(s))))+P.x,
       (r*sin(radians(s)))+(r2*sin(radians(s)))+P.y>

 #local b = b - s/169;
 #end
 #local c = 0;
 #while(c < s)
 #local P = vrotate(-(r2+T)*x, c*z);

  <(((r-T)*cos(radians(s)))+((r2+T)*cos(radians(s))))+P.x,
   ((r-T)*sin(radians(s)))+((r2+T)*sin(radians(s)))+P.y>

 #local c = c + s/169;
 #end
 #local d = s+90;
 #while(d > 0)
 #local P = vrotate(-(r-T)*y, d*z);

  <P.x, P.y>

 #local d = d - (s+90)/1500;
 #end
 #if(isMapped)
  uv_mapping
 #end
  }

  hollow on
  material { bulbMaterial }
   scale 1/100
   transform { Transform }
 }

// A plain, silver Bulb cap.  Not parameterized.
difference {
 union {
  cylinder { -0.15625*y, 0.0 0.25 }
  cylinder { -0.15625*y, 0.03125*y 0.21875 }
  torus { 0.21875, 0.03125 }
  torus { 0.21875, 0.03125 translate -0.15625*y }
  torus { 0.125, 0.0078125 rotate 90.0*x translate 0.109375*y }
  }
 cylinder { -0.21875*y, 0.0 0.21875 }
  material { capMaterial }
   photons { target reflection on refraction off }
   transform {
    translate ((r/100*sin(radians(s)))+(r2/100*sin(radians(s))))*y
    Transform
    }
 }

#debug concat("Max Height: " str((r*sin(radians(s)))+(r2*sin(radians(s))), 
0, 6)
"\n")

#end


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Just in time for Christmas, Hopefully
Date: 17 Dec 2007 19:30:02
Message: <web.4767136833ad2e2927b32be90@news.povray.org>
Thanks, Tim, that works a treat.

A.D.B.

"Tim Attwood" <tim### [at] comcastnet> wrote:
> The problem is too many control points in a small space.
> This is similar to other floating point accuracy issues, because
> of floating point errors some of the points in your lathe are
> doubling back, or coincident. A work-around is to scale up your
> lathe's control points, then scale down the lathe to the desired size.
> ....


Post a reply to this message


Attachments:
Download 'ornaments4.png' (467 KB)

Preview of image 'ornaments4.png'
ornaments4.png


 

From: Leef me
Subject: Re: Just in time for Christmas, Hopefully
Date: 18 Dec 2007 02:45:01
Message: <web.476779d133ad2e29892adb1d0@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> Thanks, Tim, that works a treat.
>
> A.D.B.
>
> "Tim Attwood" <tim### [at] comcastnet> wrote:
> > The problem is too many control points in a small space.
> > This is similar to other floating point accuracy issues, because
> > of floating point errors some of the points in your lathe are
> > doubling back, or coincident. A work-around is to scale up your
> > lathe's control points, then scale down the lathe to the desired size.
> > ....

Hey Anthony,

Congrat on the nice bulbs.





I tried to use an image for the bulb material, but I cannot scale it.

Here is my code, can you point out what I am doing wrong?

Thank you.

Leef_me


//start

#include "xmas_bulb.inc"


#version 3.6;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

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

camera {
  location  <0.0, 0.5, -8.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

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



#declare bulb = material {
             texture {
        pigment { image_map { jpeg "Dime_front.jpg" map_type 1
        } scale 0.01
   }
  }
}
#declare capq2 = material {
             texture {
        pigment { rgb <1,1,0>
        }
   }
}

#declare place = transform {
        translate <0,0,0>
        rotate y*360*clock
}

ChristmasBulb(bulb, capq2, 0, place)


//end


Post a reply to this message

From: Alain
Subject: Re: Just in time for Christmas, Hopefully
Date: 18 Dec 2007 11:01:50
Message: <4767eeee$1@news.povray.org>
Leef_me nous apporta ses lumieres en ce 2007/12/18 02:42:
> "Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
>> Thanks, Tim, that works a treat.
>>
>> A.D.B.
>>
>> "Tim Attwood" <tim### [at] comcastnet> wrote:
>>> The problem is too many control points in a small space.
>>> This is similar to other floating point accuracy issues, because
>>> of floating point errors some of the points in your lathe are
>>> doubling back, or coincident. A work-around is to scale up your
>>> lathe's control points, then scale down the lathe to the desired size.
>>> ....
> 
> Hey Anthony,
> 
> Congrat on the nice bulbs.
> 
> 
> 
> 
> 
> I tried to use an image for the bulb material, but I cannot scale it.
> 
> Here is my code, can you point out what I am doing wrong?
> 
> Thank you.
> 
> Leef_me
> 
> 
> //start
> 
> #include "xmas_bulb.inc"
> 
> 
> #version 3.6;
> 
> #include "colors.inc"
> 
> global_settings {
>   assumed_gamma 1.0
> }
> 
> // ----------------------------------------
> 
> camera {
>   location  <0.0, 0.5, -8.0>
>   direction 1.5*z
>   right     x*image_width/image_height
>   look_at   <0.0, 0.0,  0.0>
> }
> 
> sky_sphere {
>   pigment {
>     gradient y
>     color_map {
>       [0.0 rgb <0.6,0.7,1.0>]
>       [0.7 rgb <0.0,0.1,0.8>]
>     }
>   }
> }
> 
> light_source {
>   <0, 0, 0>            // light's position (translated below)
>   color rgb <1, 1, 1>  // light's color
>   translate <-30, 30, -30>
> }
> 
> 
> 
> #declare bulb = material {
>              texture {
>         pigment { image_map { jpeg "Dime_front.jpg" map_type 1
>         } scale 0.01
>    }
>   }
> }
> #declare capq2 = material {
>              texture {
>         pigment { rgb <1,1,0>
>         }
>    }
> }
> 
> #declare place = transform {
>         translate <0,0,0>
>         rotate y*360*clock
> }
> 
> ChristmasBulb(bulb, capq2, 0, place)
> 
> 
> //end
> 
> 
> 
When you scale a spherical pattern, all points move acording to the origin.
What you need is to use a warp{spherical} after the scaling.
Your image_map become:
#declare bulb = material {
              texture {
         pigment { image_map { jpeg "Dime_front.jpg" map_type 0
//Use a planar maping
         	scale 0.01
warp{spherical} // Wrap it around the sphere
		}
    }
   }
}
Now, your image get repeated 100 times around the circumference and 50 times 
from one pole to the other.
-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you can recite your high school 
Trig book from memory.


Post a reply to this message

From: Leef me
Subject: Re: Just in time for Christmas, Hopefully
Date: 18 Dec 2007 16:40:01
Message: <web.47683d4c33ad2e292a7b15450@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> Leef_me nous apporta ses lumieres en ce 2007/12/18 02:42:
> > "Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> >> Thanks, Tim, that works a treat.

> When you scale a spherical pattern, all points move acording to the origin.
> What you need is to use a warp{spherical} after the scaling.
> Your image_map become:
> #declare bulb = material {
>               texture {
>          pigment { image_map { jpeg "Dime_front.jpg" map_type 0
> //Use a planar maping
>           scale 0.01
> warp{spherical} // Wrap it around the sphere
>   }
>     }
>    }
> }
> Now, your image get repeated 100 times around the circumference and 50 times
> from one pole to the other.
> --
> Alain

Thanks Alain but, that doesn't compile; the following does:

#declare bulb = material {
              texture {
         pigment { image_map { jpeg "Dime_front.jpg" map_type 0
//Use a planar maping
         }
          scale 0.7
warp{spherical} // Wrap it around the sphere
}
   }
}

I didn't ask very well, but what I really wanted to do was a a single copy of an
image, scaled as desired, but still showing the 'bulb' similar to the bulb that
is closest to the camera.

Leef_me


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Just in time for Christmas, Hopefully
Date: 18 Dec 2007 19:25:00
Message: <web.4768642f33ad2e29e2b1ffa00@news.povray.org>
A little secret:

The bulb closest to the camera is clear glass.
The image is a planar mapping onto a disc_object disc { <0, 0, 0>, z, 1.234375,
0.0 } - contained within the bulb.

Regards,
A.D.B.

"Leef_me" <nomail@nomail> wrote:
> Thanks Alain but, that doesn't compile; the following does:
>
> #declare bulb = material {
>               texture {
>          pigment { image_map { jpeg "Dime_front.jpg" map_type 0
> //Use a planar maping
>          }
>           scale 0.7
> warp{spherical} // Wrap it around the sphere
> }
>    }
> }
>
> I didn't ask very well, but what I really wanted to do was a a single copy of an
> image, scaled as desired, but still showing the 'bulb' similar to the bulb that
> is closest to the camera.
>
> Leef_me


Post a reply to this message

From: Leef me
Subject: Re: Just in time for Christmas, Hopefully
Date: 18 Dec 2007 20:40:00
Message: <web.476875f833ad2e292a7b15450@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> A little secret:
>
> The bulb closest to the camera is clear glass.
> The image is a planar mapping onto a disc_object disc { <0, 0, 0>, z, 1.234375,
> 0.0 } - contained within the bulb.
>
> Regards,
> A.D.B.
>

Ahh!  Now a comprehend.

But let's keep the secret; that is you, me and the other 100's of Povray users.

Cheers. And thanks for the info.

Leef_me


Post a reply to this message

From: Alain
Subject: Re: Just in time for Christmas, Hopefully
Date: 19 Dec 2007 10:51:27
Message: <47693dff@news.povray.org>
Leef_me nous apporta ses lumieres en ce 2007/12/18 16:36:
> Alain <ele### [at] netscapenet> wrote:
>> Leef_me nous apporta ses lumieres en ce 2007/12/18 02:42:
>>> "Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
>>>> Thanks, Tim, that works a treat.
> 
>> When you scale a spherical pattern, all points move acording to the origin.
>> What you need is to use a warp{spherical} after the scaling.
>> Your image_map become:
>> #declare bulb = material {
>>               texture {
>>          pigment { image_map { jpeg "Dime_front.jpg" map_type 0
>> //Use a planar maping
>>           scale 0.01
>> warp{spherical} // Wrap it around the sphere
>>   }
>>     }
>>    }
>> }
>> Now, your image get repeated 100 times around the circumference and 50 times
>> from one pole to the other.
>> --
>> Alain
> 
> Thanks Alain but, that doesn't compile; the following does:
> 
> #declare bulb = material {
>               texture {
>          pigment { image_map { jpeg "Dime_front.jpg" map_type 0
> //Use a planar maping
>          }
>           scale 0.7
> warp{spherical} // Wrap it around the sphere
> }
>    }
> }
> 
> I didn't ask very well, but what I really wanted to do was a a single copy of an
> image, scaled as desired, but still showing the 'bulb' similar to the bulb that
> is closest to the camera.
> 
> Leef_me
> 
> 
In that case, just add "once" for the image_map. Now, you use rotate to place 
the image where you want it.

-- 
Alain
-------------------------------------------------
EVERYTHING HAS A GENDER

You may not know this but many nonliving things have a gender...

Ziploc Bags are Male, because they hold everything in, but you can see right 
through them.


Post a reply to this message

From: EagleSun
Subject: Re: Just in time for Christmas, Hopefully
Date: 20 Dec 2007 10:25:01
Message: <web.476a891533ad2e291ee33c1d0@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> I've been working on a holiday themed offering, and it was going rather well.
> But I've been having problems with a model I made, and I can't figure out why.
>
> The bulb object is made from a lathe, using a linear_spline.  There are 3600 odd
>  control points, placed with loops.  I used a debug statement to observe the uv
> coordinates around the defect, and they tell me I'm seeing things, but the
> defect remains, no matter what texture I apply.
>
> Other than that, I'll let the attached image speak for itself.
>
> Any comments or suggestions would be helpful.
>
> A.D.B

What happens when you remove the plane?


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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