POV-Ray : Newsgroups : povray.advanced-users : Removing highlights from transparent texture areas Server Time
25 Dec 2024 01:09:32 EST (-0500)
  Removing highlights from transparent texture areas (Message 1 to 3 of 3)  
From: Random Pete
Subject: Removing highlights from transparent texture areas
Date: 5 Oct 2006 13:05:00
Message: <web.45253af1ae62dc6f9cf609e10@news.povray.org>
I have a texture with square areas of transparency which looks like a mesh
speaker casing. I want specular highlights to show only on the visible areas
of texture, and not the transparent areas in between. Unfortunately it seems
the default behaviour is for transparent textures to display highlights
(which makes sense for glass-like textures but not in this case). Is there
a way to change this?

Pete


Post a reply to this message

From: Samuel Benge
Subject: Re: Removing highlights from transparent texture areas
Date: 5 Oct 2006 13:52:56
Message: <45254678@news.povray.org>
Random Pete wrote:
> I have a texture with square areas of transparency which looks like a mesh
> speaker casing. I want specular highlights to show only on the visible areas
> of texture, and not the transparent areas in between. Unfortunately it seems
> the default behaviour is for transparent textures to display highlights
> (which makes sense for glass-like textures but not in this case). Is there
> a way to change this?
> 
> Pete

Is your texture a bitmap (or, png, gif, etc.)? If so, you may have to 
use a texture_map like this:

#declare mytex = pigment{image_map{....regular stuff}}

object{
  myobj
  texture{
   pigment_pattern{ mytex }
   texture_map{
    [0 pigment{mytex} finish{specular 1}]
    [1 pigment{mytex} finish{specular 0}]
   }
  }
}

I hope this makes sense to you. Good luck!

~Sam


Post a reply to this message

From: Random Pete
Subject: Re: Removing highlights from transparent texture areas
Date: 5 Oct 2006 15:50:00
Message: <web.452560f563cd2a479cf609e10@news.povray.org>
Samuel Benge <stb### [at] hotmailcom> wrote:
> Is your texture a bitmap (or, png, gif, etc.)? If so, you may have to
> use a texture_map like this:
>
> #declare mytex = pigment{image_map{....regular stuff}}
>
> object{
>   myobj
>   texture{
>    pigment_pattern{ mytex }
>    texture_map{
>     [0 pigment{mytex} finish{specular 1}]
>     [1 pigment{mytex} finish{specular 0}]
>    }
>   }
> }

Of course... I should have thought of this really! I'm using a pigment_map
and normal_map to make the texture, but for some reason didn't think of
using a texture_map to include the finish. Doh! Thanks for the pointer...
Here's the code I'm using:

#declare GrillWidth = 0.1;

#declare GrillPt1 = 0.5-GrillWidth*0.8;
#declare GrillPt2 = 0.5-GrillWidth*0.5;
#declare GrillPt3 = 0.5+GrillWidth*0.5;
#declare GrillPt4 = 0.5+GrillWidth*0.8;

#declare SpeakerCoverColMap =
        color_map {
                        [GrillPt1 rgbf 1]
                        [GrillPt2 rgb 0.1]
                        [GrillPt3 rgb 0.1]
                        [GrillPt4 rgbf 1]
        };

#declare SpeakerCoverSlopeMap =
        slope_map {
                [0.00 <0,0>]
                [GrillPt1 <0,1>]
                [GrillPt2 <1,0>]
                [GrillPt3 <1,0>]
                [GrillPt4 <0,-1>]
                [1.00 <0,0>]
        };


#declare SpeakerCoverHPig = pigment {
        gradient x
        color_map {
                SpeakerCoverColMap
        }
};

#declare SpeakerCoverVPig = pigment {
        gradient y
        color_map {
                SpeakerCoverColMap
        }
};

#declare SpeakerCoverHNorm = normal {
        gradient x
        slope_map {
                SpeakerCoverSlopeMap
        }
};

#declare SpeakerCoverVNorm = normal {
        gradient x
        slope_map {
                SpeakerCoverSlopeMap
        }
};

#declare SpeakerCoverTex = texture {
        pigment {
                gradient x
                pigment_map {
                        [GrillPt1 SpeakerCoverVPig]
                        [GrillPt2 SpeakerCoverHPig]
                        [GrillPt3 SpeakerCoverHPig]
                        [GrillPt4 SpeakerCoverVPig]
                }
        }
        normal {
                gradient x
                normal_map {
                        [GrillPt1 SpeakerCoverVNorm]
                        [GrillPt2 SpeakerCoverHNorm]
                        [GrillPt3 SpeakerCoverHNorm]
                        [GrillPt4 SpeakerCoverVNorm]
                }
        }
        finish {
                phong 0.8
                phong_size 40
        }
        scale 0.2
};

#declare SpeakerCover =
        sphere { 0,1
        scale <1,1,0.2>
        texture { SpeakerCoverTex }
};


Post a reply to this message

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