Heuristic42
Blog
Opengl
Meta
Rendering
0
comment
Feb 7 at 14:26
Matrices
[deleted]
–
anonymous
edited
Feb 2 at 15:54
Embedding GDB pretty printers, just like natvis
Pretty printers are awesome, but the setup can be a real pain. …
–
pknowles
created
Jan 31 at 20:27
Embedding GDB pretty printers, just like natvis
Pretty printers are awesome, but the setup can be a real pain. …
–
pknowles
comment
Jan 25 at 16:20
Matrices
[deleted]
–
anonymous
comment
Jan 14 at 15:46
Matrices
[deleted]
–
anonymous
comment
Jan 13 at 16:05
Making a real EMF Reader
All good/my bad. A half implemented feature that I really shoul…
–
pknowles
comment
Jan 13 at 16:03
Making a real EMF Reader
I don't have a circuit diagram sorry. The LEDs are all on separ…
–
pknowles
comment
Jan 9 at 8:07
Making a real EMF Reader
а есть подробные схемы что к чему подключать и куда припаивать…
–
anonymous
comment
Jan 5 at 2:00
Matrices
[deleted]
–
anonymous
comment
Dec 15 '24
Matrices
[deleted]
–
anonymous
comment
Nov 27 '24
DerBard: Custom Split Mechanical Keyboard Prototype
hello
–
anonymous
comment
Nov 19 '24
Matrices
[deleted]
–
anonymous
created
Oct 20 '24
Iterators: pointers vs cursors
You're already doing both of these by hand. This post emphaisze…
–
pknowles
comment
Oct 10 '24
Matrices
[deleted]
–
anonymous
comment
Oct 4 '24
Matrices
[deleted]
–
anonymous
comment
Sep 30 '24
Matrices
[deleted]
–
anonymous
comment
Sep 23 '24
Matrices
[deleted]
–
anonymous
comment
Sep 21 '24
Contributing
I kind of predicted what was bound to happen when my favourite …
–
anonymous
comment
Sep 7 '24
Route contention when running docker and a VPN
Thank you for this. Between this and the overwriting of iptabl…
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
Sorry for the random quoted text comments. I am one of those p…
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
[deleted]
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
[deleted]
–
anonymous
comment
Aug 20 '24
Matrices
[deleted]
–
anonymous
comment
Aug 11 '24
Matrices
[deleted]
–
anonymous
…
View All
Log in
Transparency and Alpha Blending
leave this field blank to prove your humanity
Slug
*
A URL path component
Parent page
<root>
rendering/:Article2:3D Rendering (Computer Graphics)
--- rendering/cameras/:Article11:Cameras
--- rendering/matrices/:Article12:Matrices
------ rendering/matrices/projection/:Article14:Projection Matrix
--- rendering/vectors/:Article13:Vectors
--- rendering/geometry/:Article62:3D Geometry
------ rendering/geometry/triangle_meshes/:None
--- rendering/shading/:Article64:Shading
------ rendering/shading/transparency/:Article70:Transparency and Alpha Blending
--- rendering/lights/:Article65:Lights
--- rendering/rasterization/:None
------ rendering/rasterization/deepimage/:Article72:Deep Image
--- rendering/shadows/:Article67:Shadows
--- rendering/spaces/:Article68:Vector Spaces
------ rendering/spaces/tangent_space/:Article69:Tangent Space
------ rendering/spaces/clip_space/:Article89:Clip Space
--- rendering/rotations/:None
--- rendering/images/:Article74:<unset>:Images
------ rendering/images/mipmapping/:Article75:<unset>:Mipmapping
--- rendering/materials/:None
opengl/:Article3:OpenGL Tutorials
--- opengl/oit/:Article7:Order Independent Transparency (OIT)
--- opengl/framebuffer/:Article71:The Framebuffer
meta/:Article4:Pages About This Site
--- meta/contribute/:Article5:Contributing
--- meta/bugs/:Article9:Bugs
--- meta/about/:Article10:Why does this website exist?
The parent page this belongs to.
Article title
*
Article revisions must have a non-empty title
Article body
*
Transparency is the visual effect of an object being partially see-through. In computer graphics it typically refers to *alpha blending*. This is where two colours are mixed by an *alpha* ratio. To make a surface see-through, it is mixed with the colour behind it. The colour behind it may be the result of mixing other surface colours. Blending is often order dependent, requiring sorting as discussed later. There are a number of blending operations, but the most common is alpha blending by Porter and Duff. Physically, alpha models a statistical surface coverage. An example is dust and dirt on clear glass, or a fine spray of paint, where a microscopic portion is fully opaque and the rest fully transparent. The alpha value is the ratio between opaque and transparent parts. Alpha blending can be seen as an antialiasing technique, approximating tiny surface details and avoiding the expense of modelling and rendering them. Coloured glass is a common transparency example, although this implies an absorption effect which isn't modelled by classic alpha blending. # Alpha Blending The following equation overlays or mixes a foreground colour $F$ with background $B$ given the ratio $\alpha$. $$\alpha F + (1 - \alpha) B$$ This equation, also called the *over* operator is the most common. # Transparency Multiple transparent surfaces are handled by starting with the background colour and blending each surface onto it in order from farthest to nearest. colour = background foreach surface colour = blend(colour, surface) In some cases it's useful to blend starting with the front surface and going back. In this case, a *visibility* value must be maintained. This gives a portion of remaining colour that can be added. This is scaled down by the transmittance, $1 - \alpha$ at each surface. vis = 1 colour = 0 foreach surface colour += surface * surfaceAlpha * vis vis *= 1 - surfaceAlpha colour += background * vis This approach is sometimes referred to as the *under* operator as colour from a surface behind the blended group is added. # Visibility Rather than blending surfaces in turn, an alternative approach to solving transparency is to find surface visibility by another means. This allows an unordered sum of surface colours: $$ C = \sum S \cdot S_\alpha \cdot \mathsf{vis}(S)$$ Where $C$ is the result, $S$ is the surface colour and $\mathsf{vis}$ is some function that gives the visibility of the surface, as in the under blending approach above. Although sorting is necessary for correct transparency, the colours themselves don't need sorting, only the alpha values to give the function $\mathsf{vis}$. The concept of a statistical visibility is a great tool to better understand transparency and alpha blending. It is also particularly useful in approximate transparency techniques, where the $\mathsf{vis}$ function is hard coded, approximated or compressed to allow fast unordered blending. # Saturation Blending Alpha blending assumes an even statistical coverage at each surface but this is not always the case. If the opaque parts of partially transparent surfaces perfectly overlap, only the front surface will be visible. Alternatively, if all opaque portions of a surface are visible through the gaps of the transparent surfaces in front of it then the visibility scaling factor should be ignored. That is until there are no more gaps left. This is where saturation blending comes in. vis = 1 colour = 0 foreach surface colour += colour * surfaceAlpha * vis vis = max(0, vis - surfaceAlpha) colour += background * vis This must be done in order of nearest to farthest. An example usage is rasterization antialiasing where a fragment's alpha is set to the portion of the triangle covering a pixel. Triangles are rendered from front to back and it is assumed that further contributions to that pixel will be from other triangles filling the remaining area.
Toggle Preview
Edit message
*
A description of the changes made
Discard Draft
Save Draft
leave this field blank to prove your humanity
Flag
the thing you clicked
for moderator attention.
Reason choice:
Spam, promoting, advertising without disclosure
Rude, inappropriate, generally offensive
Too arrogant or demeaning to others
Other
Reason:
The reason for raising the flag
Error