POV-Ray : Newsgroups : povray.advanced-users : shadows and transparent textures (transparency map) Server Time
31 Oct 2024 16:17:15 EDT (-0400)
  shadows and transparent textures (transparency map) (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: uwe
Subject: shadows and transparent textures (transparency map)
Date: 7 Mar 2005 11:40:00
Message: <web.422c831e64e9657f77b144780@news.povray.org>
Hi all,
i am using a TGA file with alpha channel as an image map.  i had expected
that the object would not cast shadows in areas where the image is
completely transparent.

however, the shadows are not affected by the image map. the shadows are
those cast by the underlying object.

has anyone got an idea how i could get the desired result?

kind regards, uwe


Post a reply to this message

From: Slime
Subject: Re: shadows and transparent textures (transparency map)
Date: 7 Mar 2005 15:36:02
Message: <422cbb32$1@news.povray.org>
> however, the shadows are not affected by the image map. the shadows are
> those cast by the underlying object.


If you can see through it, then it should not cast a shadow. Perhaps your
max_trace_level is too low?

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Chris B
Subject: Re: shadows and transparent textures (transparency map)
Date: 8 Mar 2005 05:36:13
Message: <422d801d$1@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote in message
news:422cbb32$1@news.povray.org...
> > however, the shadows are not affected by the image map. the shadows are
> > those cast by the underlying object.
>
>
> If you can see through it, then it should not cast a shadow. Perhaps your
> max_trace_level is too low?
>

It also depends on how much of the surface is opaque and whether the light
lines up with the bits of the image on the front and back surfaces.
It's probably stating the obvious, but a ray will only shine through if both
the point where it enters and the point where it leaves the object are
transparent.

Chris.


Post a reply to this message

From: uwe
Subject: Re: shadows and transparent textures (transparency map)
Date: 8 Mar 2005 07:05:02
Message: <web.422d943651916273b054365e0@news.povray.org>
The object is a box. the texture (pigment image map) is an image of a numer
"35" the 35 is solid, everything else is 100% transparent. the shadow is
clearly cast by the entire box. no silouhette of a number 35is visible.

i did some more testing, without texture map. i set the transmit of the box
to 100%. still it casts a shadow. strange, isn't it?

kind regards, uwe



"Chris B" <c_b### [at] btconnectcom> wrote:
> "Slime" <fak### [at] emailaddress> wrote in message
> news:422cbb32$1@news.povray.org...
> > > however, the shadows are not affected by the image map. the shadows are
> > > those cast by the underlying object.
> >
> >
> > If you can see through it, then it should not cast a shadow. Perhaps your
> > max_trace_level is too low?
> >
>
> It also depends on how much of the surface is opaque and whether the light
> lines up with the bits of the image on the front and back surfaces.
> It's probably stating the obvious, but a ray will only shine through if both
> the point where it enters and the point where it leaves the object are
> transparent.
>
> Chris.


Post a reply to this message

From: Chris B
Subject: Re: shadows and transparent textures (transparency map)
Date: 8 Mar 2005 10:14:45
Message: <422dc165$1@news.povray.org>
"uwe" <nomail@nomail> wrote in message
news:web.422d943651916273b054365e0@news.povray.org...
> "Chris B" <c_b### [at] btconnectcom> wrote:
> > "Slime" <fak### [at] emailaddress> wrote in message
> > news:422cbb32$1@news.povray.org...
> > > > .. the shadows are not affected by the image map. the shadows are
> > > > those cast by the underlying object.
> > >
> > > If you can see through it, then it should not cast a shadow. Perhaps
your
> > > max_trace_level is too low?
> >
> > It also depends on how much of the surface is opaque and whether the
light
> > lines up with the bits of the image on the front and back surfaces...
> >
> The object is a box. the texture (pigment image map) is an image of a
number
> "35" the 35 is solid, everything else is 100% transparent. the shadow is
> clearly cast by the entire box. no silouhette of a number 35is visible.
>
> i did some more testing, without texture map. i set the transmit of the
box
> to 100%. still it casts a shadow. strange, isn't it?
>

Have you tried Slime's suggestion and adjusted the max_trace_level?
Otherwise I suggest reducing the scene to the minimum number of elements
(comment out the rest) to make sure nothing else is causing the effect.
If you're saying that without the texture map you get something like box
{0,1, pigment {color rgbt 1}} casting a shadow on plane {y,-1 pigment {color
rgb 1}} then yes that's something very strange.
If you reduce it to the minimum and still see a problem then why not post a
short code snippet.

Chris.


Post a reply to this message

From: uwe
Subject: Re: shadows and transparent textures (transparency map)
Date: 13 Mar 2005 07:35:00
Message: <web.423432ad51916273f00afe800@news.povray.org>
max_trace_level makes no difference in this case.

consider this example:



global_settings { max_trace_level 10 }

camera {
  perspective
  location  <1, 1.5, 2>
  look_at   <0.5, 0.5, 0>
  angle     45
}

light_source {
  <10, 10, 10>,
  color rgb <1, 1, 1>
}

object {
 polygon { 4, <0, 0>, <1, 0>, <1, 1>, <0, 1> }
  texture {
    finish { ambient 1.000000 diffuse 1.000000 }
// 35.tga is an image with alpha channel of the number "35" on a fully
transparent background.
    pigment { uv_mapping image_map { tga "35.tga" interpolate 2 } }
  }
}

object {
  plane { <0.000000, 1.000000, 0.000000>, 0.000000 }
  texture {
    finish { ambient 1.000000 diffuse 1.000000 }
    pigment { color rgbft <0.400000, 0.400000, 1.000000, 0.000000, 0.000000>
}
  }
}

// note that the shadow cast by the polygon on the plane is the outline of
the polygon, not the outline of the number "35"


Post a reply to this message

From: Slime
Subject: Re: shadows and transparent textures (transparency map)
Date: 13 Mar 2005 15:06:40
Message: <42349d50@news.povray.org>
> max_trace_level makes no difference in this case.
>
> consider this example:

Yeah, you're right (tested with my own transparent PNG). The problem doesn't
happen if you remove the uv_mapping keyword.

I also get some weird results trying to rotate the polygon when uv_mapping
is there.

Oh, according to "3.5.7.1  Supported Objects" in the docs, uv_mapping isn't
supported for polygons. And if it *did* work for a polygon, you'd probably
have to put the texture block inside the polygon object instead of inside an
object{} wrapper. Do you really even need it for a polygon (which is 2D)?
What are you trying to do?

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: uwe
Subject: Re: shadows and transparent textures (transparency map)
Date: 15 Mar 2005 04:45:00
Message: <web.4236adbb5191627373b827db0@news.povray.org>
> What are you trying to do?
>
>  - Slime
>  [ http://www.slimeland.com/ ]


i write a program that reads .3DS meshes and renders them using POV-Ray. so
i have a lot of uv-mapped meshes.

here is my example rewritten with mesh2: same result!



global_settings { max_trace_level 10 }

camera {
  perspective
  location  <2, 3, 4>
  look_at   <1, 1, 0>
  angle     45
}

light_source {
  <10, 10, 10>,
  color rgb <1, 1, 1>
}

object {
  mesh2 {
    vertex_vectors { 4,
      <0, 0, 0>,
      <2, 0, 0>,
      <0, 2, 0>,
      <2, 2, 0>
    }
    normal_vectors { 1,
      <0, 0, 1>
    }
    uv_vectors { 4,
      <0, 0>,
      <1, 0>,
      <0, 1>,
      <1, 1>
    }
    face_indices { 2,
      <0, 1, 2>,
      <1, 2, 3>
    }
    normal_indices { 2,
      <0, 0, 0>,
      <0, 0, 0>
    }
    uv_indices { 2,
      <0, 1, 2>,
      <1, 2, 3>
    }
  }
  texture {
    finish { ambient 1 diffuse 1 }
// 35.tga is an image with alpha channel of the number "35" on a fully
transparent background.
    pigment { uv_mapping image_map { tga "35.tga" interpolate 2 }  }
  }
}

object {
  plane { <0, 1, 0>, 0 }
  texture {
    finish { ambient 1 diffuse 1 }
    pigment { color rgbft <0.4, 0.4, 1, 0, 0> }
  }
}

// note that the shadow cast by the mesh2 on the plane is the outline of the
mesh2, not the outline of the number "35"
// note if you remove the "uv_mapping" modifier the shadow will be correct
but the texture will not be mapped correctly


Post a reply to this message

From: Slime
Subject: Re: shadows and transparent textures (transparency map)
Date: 15 Mar 2005 13:12:25
Message: <42372589$1@news.povray.org>
> here is my example rewritten with mesh2: same result!

Oh, ok. You're doing the same thing:

object {
    mesh {
        (mesh data)
    }
    texture {...}
}

You should be doing this:

mesh {
    (mesh data)
    uv_mapping
    texture {...}
}

When you're UV-Mapping an object, the texture must be on the very object
being UV-mapped or else it can't be evaluated properly. I'm not sure why
POV-Ray even lets you get away with the former.

Note that you have to add the uv_mapping keyword to the mesh itself and not
the pigment; I'm not sure why this is, and it does seem contrary to what
"3.5.7  UV Mapping" suggests. Maybe someone else can step in and explain
this...

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: uwe
Subject: Re: shadows and transparent textures (transparency map)
Date: 15 Mar 2005 14:10:00
Message: <web.423732db5191627373b827db0@news.povray.org>
> Note that you have to add the uv_mapping keyword to the mesh itself and not
> the pigment; I'm not sure why this is, and it does seem contrary to what
> "3.5.7  UV Mapping" suggests. Maybe someone else can step in and explain
> this...
>
>  - Slime
>  [ http://www.slimeland.com/ ]

thanks for pointing this out to me! this works really well. GREAT!

have you got any idea of how to implement specular maps and shininess maps?
3DS materials can have both of them.

uwe


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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