POV-Ray : Newsgroups : povray.binaries.images : Question about layered textures (19KB) Server Time
20 Nov 2024 04:13:18 EST (-0500)
  Question about layered textures (19KB) (Message 1 to 3 of 3)  
From: Tor Olav Kristensen
Subject: Question about layered textures (19KB)
Date: 26 Sep 2001 17:15:54
Message: <3BB24583.FE858816@hotmail.com>
I'm trying to understand layered textures better,
but I don't understand why the colors of the left
spheres in the attached image don't match the 
colors of right spheres.

See my code below.

Can anyone please explain ?

And what do I have to do in order to make the 
colors of the right spheres equal to the colors 
of the left spheres (using subtractive color 
mixing for the right ones and additive for the
left ones) ?

E.g.: Any changes to the finish {} part of the textures ?


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#version 3.5;

#default {
  texture {
    finish {
      ambient 0
      diffuse 1
    }
  }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

// Red
sphere {
  2*<-1,  2,  0>, 2
  texture { pigment { color rgbt <1, 0, 0, 0.0> } }
}

// Green
sphere {
  2*<-1,  0,  0>, 2
  texture { pigment { color rgbt <0, 1, 0, 0.0> } }
}

// Blue
sphere {
  2*<-1, -2,  0>, 2
  texture { pigment { color rgbt <0, 0, 1, 0.0> } }
}



// White - Blue  - Green = Red
sphere {
  2*< 1,  2,  0>, 2
  texture { pigment { color rgbt <1, 0, 1, 0.0> } }
  texture { pigment { color rgbt <1, 1, 0, 0.5> } }
}

// White - Red   - Blue  = Green
sphere {
  2*< 1,  0,  0>, 2
  texture { pigment { color rgbt <1, 1, 0, 0.0> } }
  texture { pigment { color rgbt <0, 1, 1, 0.5> } }
}

// White - Green - Red   = Blue
sphere {
  2*< 1, -2,  0>, 2
  texture { pigment { color rgbt <0, 1, 1, 0.0> } }
  texture { pigment { color rgbt <1, 0, 1, 0.5> } }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

// Red   + Green = Yellow
sphere {
  2*<-3,  2,  0>, 2
  texture { pigment { color rgbt <1, 1, 0, 0.0> } }
}

// Green + Blue  = Cyan
sphere {
  2*<-3,  0,  0>, 2
  texture { pigment { color rgbt <0, 1, 1, 0.0> } }
}

// Blue  + Red   = Magenta
sphere {
  2*<-3, -2,  0>, 2
  texture { pigment { color rgbt <1, 0, 1, 0.0> } }
}



// White - Blue  = Yellow
sphere {
  2*< 3,  2,  0>, 2
  texture { pigment { color rgbt <1, 1, 1, 0.0> } }
  texture { pigment { color rgbt <1, 1, 0, 0.5> } }
}

// White - Red   = Cyan
sphere {
  2*< 3,  0,  0>, 2
  texture { pigment { color rgbt <1, 1, 1, 0.0> } }
  texture { pigment { color rgbt <0, 1, 1, 0.5> } }
}

// White - Green = Magenta
sphere {
  2*< 3, -2,  0>, 2
  texture { pigment { color rgbt <1, 1, 1, 0.0> } }
  texture { pigment { color rgbt <1, 0, 1, 0.5> } }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

background { color rgb <1, 1, 1>/2 }

light_source { 1000*<0, 5, -5> color rgb <1, 1, 1>*1.2 shadowless }

camera {
  location <0, 0, -14>
  look_at <0, 0, 0>
  orthographic
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =


Post a reply to this message


Attachments:
Download 'layered.jpg' (19 KB)

Preview of image 'layered.jpg'
layered.jpg


 

From: Francois Labreque
Subject: Re: Question about layered textures (19KB)
Date: 26 Sep 2001 18:11:10
Message: <3BB25245.701@videotron.ca>
Tor Olav Kristensen wrote:

> I'm trying to understand layered textures better,
> but I don't understand why the colors of the left
> spheres in the attached image don't match the 
> colors of right spheres.
> 
> See my code below.
> 
> Can anyone please explain ?
> 
> And what do I have to do in order to make the 
> colors of the right spheres equal to the colors 
> of the left spheres (using subtractive color 
> mixing for the right ones and additive for the
> left ones) ?
> 
> E.g.: Any changes to the finish {} part of the textures ?
> 


Nope.

What happens is that when you put a color that has a non-zero transmit 
component, it does a weighted average of the color and the color underneath.

for example:

> // White - Blue  - Green = Red
>   texture { pigment { color rgbt <1, 0, 1, 0.0> } }
>   texture { pigment { color rgbt <1, 1, 0, 0.5> } }


is equivalent to:

     texture { pigment { color rgbt < 1, 0.5, 0.5, 0.0 > } }

That is:

#declare Weight = 0.5;
#declare Magenta = color rgb < 1, 0, 1 >;
#declare Yellow = color rgb < 1, 1, 0 >;
#declare Not_Red = Weight*Magenta + (1-Weight)*Yellow;

As you can see, the green and blue components of the final color are not 
zero as a fraction of the orignal two colors is still present in the 
final one.

Since layered textures are additive, to substract a color component, 
you'd have to add a negative color, in other words,do the following:
    texture { pigment { color rgbt <1, 1, 1, 0.0> } }
    texture { pigment { color rgbt <1, -1, -1, 0.5> } }

As you can see, the second texture does not make physical sense.

-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   videotron.ca  */}camera{location<6,1.25,-6>look_at a orthographic}


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Question about layered textures (19KB)
Date: 26 Sep 2001 21:01:18
Message: <3BB27A60.1574216D@hotmail.com>
Thank you very much Francois !

I think I understand rgbt better now,
but I have some more testing to do before
I'm sure about how it works.

Tor Olav


Francois Labreque wrote:
> 
> Tor Olav Kristensen wrote:
> 
> > I'm trying to understand layered textures better,
> > but I don't understand why the colors of the left
> > spheres in the attached image don't match the
> > colors of right spheres.
> >
> > See my code below.
> >
> > Can anyone please explain ?
> >
> > And what do I have to do in order to make the
> > colors of the right spheres equal to the colors
> > of the left spheres (using subtractive color
> > mixing for the right ones and additive for the
> > left ones) ?
> >
> > E.g.: Any changes to the finish {} part of the textures ?
> >
> 
> Nope.
> 
> What happens is that when you put a color that has a non-zero transmit
> component, it does a weighted average of the color and the color underneath.
> 
> for example:
> 
> > // White - Blue  - Green = Red
> >   texture { pigment { color rgbt <1, 0, 1, 0.0> } }
> >   texture { pigment { color rgbt <1, 1, 0, 0.5> } }
> 
> is equivalent to:
> 
>      texture { pigment { color rgbt < 1, 0.5, 0.5, 0.0 > } }
> 
> That is:
> 
> #declare Weight = 0.5;
> #declare Magenta = color rgb < 1, 0, 1 >;
> #declare Yellow = color rgb < 1, 1, 0 >;
> #declare Not_Red = Weight*Magenta + (1-Weight)*Yellow;
> 
> As you can see, the green and blue components of the final color are not
> zero as a fraction of the orignal two colors is still present in the
> final one.
> 
> Since layered textures are additive, to substract a color component,
> you'd have to add a negative color, in other words,do the following:
>     texture { pigment { color rgbt <1, 1, 1, 0.0> } }
>     texture { pigment { color rgbt <1, -1, -1, 0.5> } }
> 
> As you can see, the second texture does not make physical sense.
> 
> --
> /*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
> /*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
> /*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
> /*   videotron.ca  */}camera{location<6,1.25,-6>look_at a orthographic}


Post a reply to this message

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