POV-Ray : Newsgroups : povray.binaries.images : shadows don't honor image_map alpha channel Server Time
28 May 2024 16:19:33 EDT (-0400)
  shadows don't honor image_map alpha channel (Message 1 to 9 of 9)  
From: clipka
Subject: shadows don't honor image_map alpha channel
Date: 5 May 2009 18:25:01
Message: <web.4a00bbfb2b1505395dd6915e0@news.povray.org>
See povray.bugreports


Post a reply to this message


Attachments:
Download 'ivy.png' (54 KB)

Preview of image 'ivy.png'
ivy.png


 

From: Thomas de Groot
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 04:03:51
Message: <4a014467@news.povray.org>
That is strange... See my image: also a png image map.

Thomas


Post a reply to this message


Attachments:
Download 'imagemaptest3.jpg' (103 KB)

Preview of image 'imagemaptest3.jpg'
imagemaptest3.jpg


 

From: Ive
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 04:32:15
Message: <4a014b0f@news.povray.org>
clipka wrote:
> See povray.bugreports
> 
> 
> ------------------------------------------------------------------------
> 

The shadows seem to work with both methods:

PNG with internal alpha channel or by using pigment_pattern -
the way I do prefer, because you can add specular highlights:


#local Leaf_1_opaque = texture {
   uv_mapping
   pigment {P_Leaf}
   normal {N_Leaf}
   finish {
     ambient 0  diffuse 0.9
     specular 0.1 roughness 0.1
   }
}

#local Leaf_1_trans = texture {
   uv_mapping
   pigment {P_Leaf transmit 1}
   normal {N_Leaf}
   finish {
     ambient 0  diffuse 0.9
     specular 0.0 roughness 0.1
   }
}

#declare T_Leaf_1 = texture {
   uv_mapping
   pigment_pattern {A_Leaf1}
   texture_map {
     [0 TA03_Leaf_1_trans]
     [1 TA03_Leaf_1_opaque]
   }
}


But as soon as you add media or fog the transparent parts become
partial visible in 3.7 beta, see the attached shrub. This happens
also with both methods.


Post a reply to this message


Attachments:
Download 'testleaf.jpg' (27 KB) Download 'testshrub.jpg' (52 KB)

Preview of image 'testleaf.jpg'
testleaf.jpg

Preview of image 'testshrub.jpg'
testshrub.jpg


 

From: clipka
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 07:00:01
Message: <web.4a016c9e440bdc7953a485b50@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
> That is strange... See my image: also a png image map.
>
> Thomas

Maybe we're using different ways to get the transparency into the shot, or
different objects or whatever? This is the code I used (boiled down to its
essence):

-------------------

#declare Entwined_Ivy_leaf_adult_=mesh2{
vertex_vectors{
4,
<-1,1,-1>,
<-1,1,1>,
<1,1,1>,
<1,1,-1>,
}
normal_vectors{
4,
<0,1,0>,
<0,1,0>,
<0,1,0>,
<0,1,0>,
}
uv_vectors{
4,
<0,0>,
<0,1>,
<1,1>,
<1,0>,
}
face_indices{
2,
<0,1,2>,
<2,3,0>,
}
uv_indices{
2,
<0,1,2>,
<2,3,0>,
}
normal_indices{
2,
<0,1,2>,
<2,3,0>,
}
inside_vector <0,0,1> }

#declare p_map22 = pigment { image_map { png "efeu1.png" interpolate 2 transmit
all 0 filter all 0 } }

#declare Ivy_leaf_adult_=
material{
  texture {pigment{ uv_mapping p_map22}
          finish{specular 0 roughness 0.09632328 ambient rgb <0.00,0.00,0.00>
diffuse 0.6   reflection{0 } conserve_energy}
  }
}

object{Entwined_Ivy_leaf_adult_  material{Ivy_leaf_adult_} hollow}

plane{y,0
  pigment { color rgb 1 }
  finish { diffuse 0.7 ambient 0 }
}

-------------------

As some keen-eyed person may guess, this is output from Thomas Luft's Ivy
Generator, converted to POV-Ray format using PoseRay (hand-edited to reduce the
mesh to a single, perfectly flat leaf).

When I use a texture_map instead - as in the following code - I get good results
as well, so it's a feasible workaround, but I'd expect PNG alpha to do the same
job on its own:

#declare Ivy_leaf_adult_=
material{
  texture {
    uv_mapping
    image_pattern { png "efeu1.png" use_alpha }
    texture_map {
      [0.0 pigment{ uv_mapping p_map22}
          finish{specular 0 roughness 0.09632328 ambient rgb <0.00,0.00,0.00>
diffuse 0.6   reflection{0 } conserve_energy} ]
      [1.0 pigment { transmit 1 } ]
    }
  }
}


Post a reply to this message

From: clipka
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 07:10:00
Message: <web.4a016f9d440bdc7953a485b50@news.povray.org>
Ive <"ive### [at] lilysoftorg"> wrote:
> The shadows seem to work with both methods:
>
> PNG with internal alpha channel or by using pigment_pattern -
> the way I do prefer, because you can add specular highlights:

Not so in my experience with the Ivy Generator output run through PoseRay.

It's also not a 3.7 problem, but is seen in 3.6 as well (more precisely I tested
it with MegaPOV 1.2.1).


> But as soon as you add media or fog the transparent parts become
> partial visible in 3.7 beta, see the attached shrub. This happens
> also with both methods.

I guess this is due to the non-solid nature of the mesh employed: You have
surfaces where light "enters into" the mesh object, but fails to leave it
later; and while presumed "inside" the mesh object, it will ignore the outer
object's media settings.

Did you check this with 3.6?

I remember something about the "inside_vector" having some default; I guess this
might prevent POV from prudently assuming that a mesh without an "inside_vector"
represents a surface but no volume, and should therefore not affect meda.


Post a reply to this message

From: Ive
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 07:24:12
Message: <4a01735c@news.povray.org>
clipka wrote:
> Ive <"ive### [at] lilysoftorg"> wrote:
>> The shadows seem to work with both methods:
>>
>> PNG with internal alpha channel or by using pigment_pattern -
>> the way I do prefer, because you can add specular highlights:
> 
> Not so in my experience with the Ivy Generator output run through PoseRay.
> 
> It's also not a 3.7 problem, but is seen in 3.6 as well (more precisely I tested
> it with MegaPOV 1.2.1).
> 
>

This is really strange because my attached leave image uses the PNG 
alpha channel in the same way you do - and I do get the shadows.


#local T_Leaf = texture {
   pigment {image_map {png "AutumnLeaf1" interpolate 2} }
   finish {ambient 0  diffuse 1}
}

#local LeafBase = mesh {
   triangle { <0,0,0>, <1,0,0>, <1,1,0> uv_vectors <0,0>, <1,0>, <1,1> }
   triangle { <0,0,0>, <1,1,0>, <0,1,0> uv_vectors <0,0>, <1,1>, <0,1> }
}

#declare Leaf = object {
   LeafBase
   texture {T_Leaf}
   translate <-0.5,-0.5,0>
   rotate x*90
   scale <1, 1, 1.4> * 10.0
   hollow
   double_illuminate
}


I do not think this is related to the Ivy Generator (how should it?).
Could you post the PNG file you did use?


>> But as soon as you add media or fog the transparent parts become
>> partial visible in 3.7 beta, see the attached shrub. This happens
>> also with both methods.
> 
> I guess this is due to the non-solid nature of the mesh employed: You have
> surfaces where light "enters into" the mesh object, but fails to leave it
> later; and while presumed "inside" the mesh object, it will ignore the outer
> object's media settings.
> 
> Did you check this with 3.6?
> 
> I remember something about the "inside_vector" having some default; I guess this
> might prevent POV from prudently assuming that a mesh without an "inside_vector"
> represents a surface but no volume, and should therefore not affect meda.
> 


It works perfectly well with 3.6 and MegaPov.
But 3.7 renders those huge XFrog tree meshes about 3 times faster (per 
core!!!) than 3.6 and works well until no media is used.
Which is kinda sad and currently a show stopper to me.

-Ive


Post a reply to this message

From: clipka
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 07:55:00
Message: <web.4a01799c440bdc7953a485b50@news.povray.org>
Ive <"ive### [at] lilysoftorg"> wrote:
> This is really strange because my attached leave image uses the PNG
> alpha channel in the same way you do - and I do get the shadows.

It seems that the UV mapping is the key. I modified your code to use
"uv_mapping", resulting in the same black square for a shadow:

> #local T_Leaf = texture {
>    pigment {image_map {png "AutumnLeaf1" interpolate 2} }
>    finish {ambient 0  diffuse 1}
> }

#local T_Leaf = texture {
   pigment { uv_mapping image_map {png "AutumnLeaf1" interpolate 2} }
   finish {ambient 0  diffuse 1}
}

> I do not think this is related to the Ivy Generator (how should it?).
> Could you post the PNG file you did use?

I guess we can rule out the picture: With your original code, I don't see the
error with my PNG either. But I do see it once I add the "uv_mapping" keyword,
which I cannot do without.

(BTW, I use the original "efeu1.png" included with Thomas Luft's free Ivy
Generator.)


> It works perfectly well with 3.6 and MegaPov.
> But 3.7 renders those huge XFrog tree meshes about 3 times faster (per
> core!!!) than 3.6 and works well until no media is used.
> Which is kinda sad and currently a show stopper to me.

Yeah, I can imagine.


Post a reply to this message

From: Ive
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 08:10:20
Message: <4a017e2c$1@news.povray.org>
clipka wrote:
> Ive <"ive### [at] lilysoftorg"> wrote:
>> This is really strange because my attached leave image uses the PNG
>> alpha channel in the same way you do - and I do get the shadows.
> 
> It seems that the UV mapping is the key. I modified your code to use
> "uv_mapping", resulting in the same black square for a shadow:
> 
>> #local T_Leaf = texture {
>>    pigment {image_map {png "AutumnLeaf1" interpolate 2} }
>>    finish {ambient 0  diffuse 1}
>> }
> 
> #local T_Leaf = texture {
>    pigment { uv_mapping image_map {png "AutumnLeaf1" interpolate 2} }
>    finish {ambient 0  diffuse 1}
> }
> 



Ahh, I remember now there was something about not putting uv_mapping 
into the pigment statement (for unknown reasons, maybe a bug), that's 
why I do always use it this way:


#local T_Leaf = texture {
    uv_mapping
    pigment {image_map {png "AutumnLeaf1" interpolate 2} }
    finish {ambient 0  diffuse 1}
}


Sorry it did by mistake remove the uv_mapping keyword when I did remove 
the normal statement to simplify things.

-Ive


Post a reply to this message

From: Ive
Subject: Re: shadows don't honor image_map alpha channel
Date: 6 May 2009 10:01:36
Message: <4a019840@news.povray.org>
Just to be clear, uv-mapped images maps with alpha channel do work
only as expected when the uv_mapping statement is put into the
texture block but not into the pigment statement.


-Ive


Post a reply to this message

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