POV-Ray : Newsgroups : povray.newusers : Problems intersecting a transparent sphere and a box with an image Server Time
2 Nov 2024 17:19:45 EDT (-0400)
  Problems intersecting a transparent sphere and a box with an image (Message 1 to 5 of 5)  
From: Laurent Duperval
Subject: Problems intersecting a transparent sphere and a box with an image
Date: 24 Dec 2003 08:00:02
Message: <web.3fe98d837589c98b7dec0c820@news.povray.org>
Hi,

In my quest to generate some decorations for a Christmas card, I want to try
to create ornaments with pictures of my kids in them. Originally, I wanted
the picture on the ornament but it doesn't look good. So now, I'm trying to
get the picture to look like it's inside the ornament. The ornament itself,
I want it to look like see-through glass. Well, it ain't working. I thought
intersection{} would give me what I want but not quite. This is what I have
so far:

#include "shapes.inc"
#include "colors.inc"

#background { color <1.000,1.000,1.000> }

camera {
    location <0, 2, -3>
    look_at  <0, 0,  0>
}
light_source { <2, 4, -3> color White}

#declare redBall =
sphere {
    <0,0,0>,1
    pigment {
        color rgbt <1,0,0,0.1>
    }
    finish{phong 1 diffuse 0 ambient 1}
}

#declare alekoFrame =
box{<-1,-1,0.01>, <1,1,.01>
    texture{
        pigment{
            image_map{
                png "aleko.png"
            }
        }
    }
    finish{diffuse 0 ambient 1}
    //scale 5
    //translate <-100,-100,250>+265*z
}


#declare alekoBall = intersection{
    object{
        alekoFrame
    }
    object {redBall}
}

object {alekoBall}


I'm seeing a few problems:

- I don't see the sphere at all (with the phong). I basically just see a
clipped circle with the picture

- My picture appears four times, I guess once for each 1x1x1 box. How do I
make it appear once, but take up all the space of the box? And I only want
it on one side of the box.

- My picture appears speckled. I'm not sure what that's all about. By
speckled, I mean that it looks like a bunch of random pixels have been
removed from the picture.

- My ball doesn't seem very 3D-ish and neither does it look very
see-through... I see that changing ambient to 0 gives a better spheric look
to the ball. But still not very see-through-ish. Maybe I need to put some
kind of textured background to get the effect I want. I'll look into that.
I see that using rgbf instead of rgbt helps also.

If you have some pointers for me, I'd appreciate it much.

Thanks!

L


Post a reply to this message

From: Mike Williams
Subject: Re: Problems intersecting a transparent sphere and a box with an image
Date: 24 Dec 2003 15:24:07
Message: <6haWEDADWf6$EwhH@econym.demon.co.uk>
Wasn't it Laurent Duperval who wrote:
>I'm seeing a few problems:
>
>- I don't see the sphere at all (with the phong). I basically just see a
>clipped circle with the picture

Instead of a simple intersection, I think you want something like this:

#declare alekoBall = union {
  object {redBall}
  intersection {
    object{alekoFrame}
    object {redBall}
  }
}


>- My picture appears four times, I guess once for each 1x1x1 box. How do I
>make it appear once, but take up all the space of the box? And I only want
>it on one side of the box.

As you surmised, one copy of the image fills the region between <0,0>
and <1,1> whereas you probably want it to fill the region between
<-1,-1> and <1,1>. You can translate and scale it like this:-

        pigment{
            image_map{
                png "aleko.png"
            }
            translate <-0.5,-0.5,0>
            scale 2
        }

>- My picture appears speckled. I'm not sure what that's all about. By
>speckled, I mean that it looks like a bunch of random pixels have been
>removed from the picture.

Try adding "interpolate 2"

        pigment{
            image_map{
                png "aleko.png"
                interpolate 2
            }
            translate <-0.5,-0.5,0>
            scale 2
        }

>
>- My ball doesn't seem very 3D-ish and neither does it look very
>see-through... I see that changing ambient to 0 gives a better spheric look
>to the ball. But still not very see-through-ish. Maybe I need to put some
>kind of textured background to get the effect I want. I'll look into that.
>I see that using rgbf instead of rgbt helps also.

I'm not sure what sort of look you're aiming for, but it might be worth
trying some of the glass finishes and interiors from glass.inc

#include "glass.inc"
#declare redBall =
sphere {
    <0,0,0>,1
    pigment {
        color rgbt <1,0,0,0.5>
    }
    finish{F_Glass7}
    interior {I_Glass4}
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Laurent Duperval
Subject: Re: Problems intersecting a transparent sphere and a box with an image
Date: 24 Dec 2003 20:53:18
Message: <pan.2003.12.25.01.53.16.836283@videotron.ca>
On Wed, 24 Dec 2003 20:22:27 +0000, Mike Williams wrote:
> Instead of a simple intersection, I think you want something like this:
> 
> #declare alekoBall = union {
>   object {redBall}
>   intersection {
>     object{alekoFrame}
>     object {redBall}
>   }
>   }
> }
> 

Hey, yeah! This looks much better!

>>- My picture appears speckled. I'm not sure what that's all about. By
>>speckled, I mean that it looks like a bunch of random pixels have been
>>removed from the picture.
> 
> Try adding "interpolate 2"
> 
>         pigment{
>             image_map{
>                 png "aleko.png"
>                 interpolate 2
>             }
>             translate <-0.5,-0.5,0>
>             scale 2
>         }
>         }
> 

Nope, I still see the speckles. At one point, I had used something like
this (grabbed from another message):
box{0,<1,1,.1>
        texture{
                pigment{
                        image_map{
                                jpeg "man2_template.jpg"
                                //[IMAGE_MAP_MODS...]
                                }
                                }
                                }
                finish{diffuse 0 ambient 1}}
    scale 100
    translate <-50,-50,250>+265*z
}
}

and it didn't have this problem. THe problem started showing up when I
made my image much smaller (I guess). Is that what it is? My image is
682x403.

> I'm not sure what sort of look you're aiming for, but it might be worth
> trying some of the glass finishes and interiors from glass.inc
> 

Yep, that's what I was after! Thanks!

L

-- 
<Laurent Duperval> ldu### [at] videotronca

Anger is a condition in which the tongue works faster than
the mind.
   --- Anon


Post a reply to this message

From: gonzo
Subject: Re: Problems intersecting a transparent sphere and a box with an image
Date: 28 Dec 2003 01:30:01
Message: <3fee7869$2@news.povray.org>
Laurent Duperval <ldu### [at] videotronca> wrote in message
news:pan### [at] videotronca...
> Nope, I still see the speckles. At one point, I had used something like
> this (grabbed from another message):
<snip>
> and it didn't have this problem. THe problem started showing up when I
> made my image much smaller (I guess). Is that what it is? My image is
> 682x403.

Try changing one of the z values in box{<-1,-1,0.01>, <1,1,.01> } i.e.:
  box{<-1,-1,-0.01>, <1,1,.01> }
See if that helps.

RG


Post a reply to this message

From: Laurent Duperval
Subject: Re: Problems intersecting a transparent sphere and a box with an image
Date: 28 Dec 2003 20:10:08
Message: <pan.2003.12.29.01.10.07.864717@videotron.ca>
On Sat, 27 Dec 2003 22:31:07 -0800, gonzo wrote:
> Try changing one of the z values in box{<-1,-1,0.01>, <1,1,.01> } i.e.:
>   box{<-1,-1,-0.01>, <1,1,.01> }
> See if that helps.
> 

Yes, that's it! It must be the problem mentioned in the tutorial where
points that intersect too closely can give weird results.

Thanks!

L

-- 
<Laurent Duperval> ldu### [at] videotronca

Life is fraught with opportunities to keep your mouth shut.


Post a reply to this message

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