Latexluv opened this issue on Jun 04, 2010 · 182 posts
bagginsbill posted Wed, 09 June 2010 at 10:41 PM
Consider one "cell" of the pattern of tubes. The horizontal tube covers part of that cell. The area it covers is exactly the density value, i.e. if the tube is 30% density, then 30% of the cell is covered by the tube. The remaining 70% (1 - .3) is covered by the vertical tube. Of that, the coverage is based on the opacity given in the first part.
D / cos(alpha)
So the combined effect is:
D + (1 - D) * D / cos(alpha)
Consider a 50% density, where D = .5. When the surface faces the camera, cos(alpha) is 1, so the opacity is:
.5 + (1 - .5) * .5 / 1
which reduces to
.75
This makes sense, right? If each tube is half of the cell spacing size, then the little window left over is exactly half of half, or .25. The transparency is the complement of opacity. Since the window is 1/4 the area, and the tubes cover 3/4 the area, the opacity is .75.
What if the density is .3? Then the central (lowest) opacity is:
.3 + (1 - .3) * .3
= .3 + .21
= .51
Now whenever we have formula in this shape:
k * a + (1-k) * b
we should recognize that this is a weighted sum of a and b, with the relative weights given by k.
Any time we need a weighted sum, we can use a Blender node. The Blender node implements the formula:
(1 - Blending) * Input_1 + Blending * Input_2
In this case, we want Blending = D, Input_2 = 1 (or white), and Input_1 = the original formula from part 1.
This arrangement is shown in the attached screen shot.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)