POV-Ray : Newsgroups : povray.newusers : Add transparency to a pattern Server Time
1 Nov 2024 06:17:16 EDT (-0400)
  Add transparency to a pattern (Message 1 to 6 of 6)  
From: MadKairon
Subject: Add transparency to a pattern
Date: 9 Apr 2010 12:15:01
Message: <web.4bbf51ec812b882e5e975f010@news.povray.org>
I have a little problem with transparency. Let's say I have a sphere textured
with a crackle pattern. I want a brick pattern to appear on the surface of my
sphere only in some spots. Is there a way to add a noise pattern to the
transparency channel of my brick pattern to achieve this?

NOTE: I need to do this with patterns, can't solve this with image_map.


Post a reply to this message

From: Kenneth
Subject: Re: Add transparency to a pattern
Date: 9 Apr 2010 13:05:01
Message: <web.4bbf5cb738be503265f302820@news.povray.org>
If I understand your question correctly, overlaying one pigment or texture onto
another--in only some spots--is a simple trick; no need for actual 'noise.' The
idea is to pigment the sphere with crackle first, then add brick
on top of it--held back in some areas using the transparency of a third pattern,
as a 'mask.'

Here's an example, done two different ways. I used the bozo pattern as a
substitute for your 'noise' idea--any other pattern could also be used. BTW,
you'll see that the scale of the bozo 'mask' also scales the pigments within its
pigment_map--so the various scales are interdependent.

// #1
sphere {0,1
  texture {
    pigment {crackle scale .1}
    finish{ambient .2 diffuse .8}
          }

  texture{
   pigment{
    bozo
    scale .1
    pigment_map{
     [0.0 rgbt 1] // the transparent parts of the mask
     [0.5 rgbt 1]
     [0.5 brick scale .5]
     [1.0 brick scale .5]
     }
    }
   finish{ambient .2 diffuse .8}
   }
   }

OR...

// #2
sphere{0,1
texture{
   pigment{
    bozo
    scale .1
    pigment_map{
     [0.0 crackle scale .8]
     [0.6 crackle scale .8]
     [0.6 brick scale .5]
     [1.0 brick scale .5]
     }
    }
   finish{ambient .2 diffuse .8}
   }
     }


Post a reply to this message

From: Alain
Subject: Re: Add transparency to a pattern
Date: 9 Apr 2010 13:20:26
Message: <4bbf61da$1@news.povray.org>

> I have a little problem with transparency. Let's say I have a sphere textured
> with a crackle pattern. I want a brick pattern to appear on the surface of my
> sphere only in some spots. Is there a way to add a noise pattern to the
> transparency channel of my brick pattern to achieve this?
>
> NOTE: I need to do this with patterns, can't solve this with image_map.
>
>

You can layer several textures. In your case, start with the brick 
pattern. Then, add your crackle pattern with a color_map that contains 
some transparency. The seams of the crackle corespond to low values and 
the centers to high values. It can be something like:

texture{pigment{brick...}}
texture{pigment{crackle color_map{[0 rgb 1][1 rgbt 1]}}

Change the "[x" values to controll the point where the transition occurs 
and it's sharpness. If the values are very close together, or even 
equal, the transition get sharper. If the lower value increase, the area 
where the brick pattern is visible get smaller. Reduce the larger value 
to see more of the brick pattern. The sample gives you the fuzzyest 
transition.

You can also have a texture in another texture by using texture_map.
It can look like: (where Texture_One and Texture_Two are previously 
defined textures using a #declare)

texture{crackle
	texture_map{[0 Texture_One][0.78 Texture_Two][0.8 texture{brick...}]}// 
end of map
} // end of texture

You can also use another pattern:
pigment{bozo color_map{
	[0.80 pigment{crackle...}]
	[0.85 pigment{brick...}]
	}
}
Here, 15% of the surface will use the brick pattern, 80% will use the 
crackle and you get a fuzzy transition of 5%.

This is legal: color_map{[0.5 rgb<1, 0.5, 0.1>][0.5 rgb<0.2, 0.6, 0.4>]}
 From 0 to 0.5, you use the first color, and from 0.5 to 1, you use the 
second one.

color_map need pigments or simple patterns.
texture_map use textures that can include a finish.



Alain


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Add transparency to a pattern
Date: 9 Apr 2010 13:52:27
Message: <4bbf695b$1@news.povray.org>
Alain wrote:

> This is legal: color_map{[0.5 rgb<1, 0.5, 0.1>][0.5 rgb<0.2, 0.6, 0.4>]}

Great! Didn't know this ;)


Post a reply to this message

From: Alain
Subject: Re: Add transparency to a pattern
Date: 9 Apr 2010 14:01:06
Message: <4bbf6b62$1@news.povray.org>

> Alain wrote:
>
>> This is legal: color_map{[0.5 rgb<1, 0.5, 0.1>][0.5 rgb<0.2, 0.6, 0.4>]}
>
> Great! Didn't know this ;)

Several samples scenes use that. If you look around, you'll find many 
scenes that use that. I use it from times to times.


Alain


Post a reply to this message

From: MadKairon
Subject: Re: Add transparency to a pattern
Date: 9 Apr 2010 14:15:00
Message: <web.4bbf6e9338be50325e975f010@news.povray.org>
Thanks Kenneth and Alain, I tried Kenneth 2nd method but using texture maps
instead of pigment maps and worked great. Then came back here and found Alain
had posted an example using texture maps. You've made me happier :)


Post a reply to this message

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