# Why DOESN'T the color of overlapped region between opaque red and green objects become opaque yellow?

In theory, additive mixing Red color and Green color produces Yellow color.

In my mental model, additive mixing opaque Red and opaque Green will produce opaque Yellow.

But the following attempt, I got a result that is different from my mental model.

WHY?

## Minimal Code (PSTricks)

\documentclass[dvipsnames,dvips,rgb]{minimal}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(3,3)
\psset{fillstyle=solid,opacity=0.5,linestyle=none}
\pscircle[fillcolor=red](1,1){1}
\pscircle[fillcolor=green](2,1){1}
\psframe[fillcolor=yellow](0,2)(3,3)
\end{pspicture}
\end{document}


## Minimal Code (PGF/Tikz)

\documentclass[dvipsnames,dvips,rgb]{minimal}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw [fill=red,opacity=0.5](1,1) circle (1);
\draw [fill=green,opacity=0.5](2,1) circle (1);
\draw [fill=yellow,opacity=0.5] (0,2)--(0,3)--(3,3)--(3,2)--cycle;
\end{tikzpicture}
\end{document}

• – Caramdir Jan 1 '11 at 19:37
• Is this a question about TeX or friends? – Seamus Jan 1 '11 at 20:03
• I learned this in primary school :P Couldn't remember much of it, though, as it was some 20 years ago, so thanks @Caramdir... – Vivi Jan 1 '11 at 22:41
• Your code and question are different. Your code draws two semi-transparent circles; are you asking why their overlap is a brown-yellow color instead of bright yellow? Or are you asking why code such as \fill [red] (0,0) circle (2cm) ; \fill [green] (0,1) circle (2cm) ;, which draws opaque circles, produces no yellowish region at all? – Antal Spector-Zabusky Jan 1 '11 at 22:58
• @Antal, the question based on the output produced by the codes. Your question confirmation is my question. – xport Jan 2 '11 at 3:27

The result you get isn't what you expect because tikz is using an rgb colour model; try the following document to see how the colour model matters. Since tikz doesn't support hsb, your intuitive mixing model doesn't work.

\documentclass{article}

\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [fill=red,opacity=0.5](1,1) circle (1);
\draw [fill=green!50,opacity=0.5](2,1) circle (1);
\draw [fill=yellow,opacity=0.5] (0,2)--(0,3)--(3,3)--(3,2)--cycle;
\end{tikzpicture}

Equal parts mixture of red!50 and green!50 (rgb model):
{\color{rgb:red!50,1;green!50,1}\rule{1cm}{1cm}}

This is equivalent to your overlapping circles.

Equal parts mixture of red!50 and green!50 (hsb model):
{\color{hsb:red!50,1;green!50,1}\rule{1cm}{1cm}}

This is equivalent to what you expected.

\end{document}

• thanks for answering. It solved the problem. Using clipping technique, I will fill the overlapped region manually. – xport Jan 2 '11 at 5:04