Skip to content

Commit

Permalink
clarify alphagen portal documentation more, simplify example shader
Browse files Browse the repository at this point in the history
  • Loading branch information
Garux committed Dec 22, 2024
1 parent 225996f commit d397822
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions docs/shaderManual/stage-directives.html
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ <h3>alphaGen const N.N</h3>
<p>A constant vertex alpha is assigned to the affected surface. This modifies the transparency of the texture.</p>

<h3>alphaGen portal <em>distance</em></h3>
<p>This rendering stage keyword is normally used in conjunction with the surface parameter keyword portal. The function accomplishes the "fade" that causes the scene in the portal/mirror to fade from view. Specifically, it means "Generate alpha values based on the distance from the viewer to the portal". Viewer distance 0 maps to alpha 0, when distance is more than "distance" parameter value, alpha is 1. While latter is the case, portal/mirror content is not rendering at all, this optimization is original purpose of the keyword, though it may be utilized for other distance dependent effects.</p>
<p>This rendering stage keyword is normally used in conjunction with the surface parameter keyword portal. It is mandatory for portals to work (but not for mirrors). The function accomplishes the "fade" that causes the scene in the portal/mirror to fade from view. Specifically, it means "Generate alpha values based on the distance from the viewer to the portal". Viewer distance 0 maps to alpha 0, when distance is more than "distance" parameter value, alpha is 1. While latter is the case, portal/mirror content is not rendering at all, this optimization is original purpose of the keyword, though it may be utilized for other distance dependent effects.</p>
<p>
Basic fading portal/mirror shader example:
</p>
Expand All @@ -323,14 +323,10 @@ <h3>alphaGen portal <em>distance</em></h3>
portal
{
map textures/sfx/portalfog.tga
blendFunc GL_ZERO GL_SRC_ALPHA
blendFunc blend
alphaGen portal 256
depthWrite
}
{
map textures/sfx/portalfog.tga
blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphagen portal 256
}
}
</pre>

Expand Down

0 comments on commit d397822

Please sign in to comment.