From d39782206807089436a78fbeeef31ba9176198a6 Mon Sep 17 00:00:00 2001 From: Garux Date: Mon, 23 Dec 2024 03:18:46 +0500 Subject: [PATCH] clarify alphagen portal documentation more, simplify example shader --- docs/shaderManual/stage-directives.html | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/shaderManual/stage-directives.html b/docs/shaderManual/stage-directives.html index 28345e97..549125ee 100644 --- a/docs/shaderManual/stage-directives.html +++ b/docs/shaderManual/stage-directives.html @@ -311,7 +311,7 @@

alphaGen const N.N

A constant vertex alpha is assigned to the affected surface. This modifies the transparency of the texture.

alphaGen portal distance

-

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.

+

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.

Basic fading portal/mirror shader example:

@@ -323,14 +323,10 @@

alphaGen portal distance

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 - } }