|
|
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
|
|
|
|
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
|
|