mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 02:09:41 +00:00
re-sync docs with postprocessing API
This commit is contained in:
parent
231803c6ea
commit
0f53088014
5 changed files with 37 additions and 10 deletions
|
@ -190,6 +190,11 @@ mat4 omw_InvProjectionMatrix()
|
|||
#endif
|
||||
}
|
||||
|
||||
vec3 omw_GetNormalsWorldSpace(vec2 uv)
|
||||
{
|
||||
return (vec4(omw_GetNormals(uv), 0.0) * omw.viewMatrix).rgb;
|
||||
}
|
||||
|
||||
vec3 omw_GetWorldPosFromUV(vec2 uv)
|
||||
{
|
||||
float depth = omw_GetDepth(uv);
|
||||
|
|
|
@ -189,19 +189,30 @@ The following functions can be accessed in any fragment or vertex shader.
|
|||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec4 omw_GetLastPass(vec2 uv)`` | Returns RGBA color output of the last pass |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec3 omw_GetNormals(vec2 uv)`` | Returns normalized worldspace normals [-1, 1] |
|
||||
| | |
|
||||
| | The values in sampler are in [0, 1] but are transformed to [-1, 1] |
|
||||
+--------------------------------------------------+-----------------------+-------------------------------------------------------+
|
||||
| ``vec3 omw_GetNormals(vec2 uv)`` | Returns normalized view-space normals [-1, 1] |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec3 omw_GetNormalsWorldSpace(vec2 uv)`` | Returns normalized world-space normals [-1, 1] |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec3 omw_GetWorldPosFromUV(vec2 uv)`` | Returns world position for given uv coordinate. |
|
||||
+--------------------------------------------------+-----------------------+-------------------------------------------------------+
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``float omw_GetLinearDepth(vec2 uv)`` | Returns the depth in game units for given uv coordinate. |
|
||||
+--------------------------------------------------+-----------------------+-------------------------------------------------------+
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``float omw_EstimateFogCoverageFromUV(vec2 uv)`` | Returns a fog coverage in the range from 0.0 (no fog) and 1.0 (full fog) |
|
||||
| | |
|
||||
| | Calculates an estimated fog coverage for given uv coordinate. |
|
||||
+--------------------------------------------------+-----------------------+-------------------------------------------------------+
|
||||
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``int omw_GetPointLightCount()`` | Returns the number of point lights available to sample from in the scene. |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec3 omw_GetPointLightWorldPos(int index)`` | Returns the world space position of a point light. |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``vec3 omw_GetPointLightDiffuse(int index)`` | Returns the diffuse color of the point light. |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``int omw_GetPointLightAttenuation(int index)`` | Returns the attenuation values of the point light. |
|
||||
| | |
|
||||
| | The XYZ channels hold the constant, linear, and quadratic components. |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
| ``float omw_GetPointLightRadius(int index)`` | Returns the radius of the point light, in game units. |
|
||||
+--------------------------------------------------+-------------------------------------------------------------------------------+
|
||||
|
||||
Special Attributes
|
||||
##################
|
||||
|
|
|
@ -34,6 +34,7 @@ DisplayDepthFactorName: "Depth colour factor"
|
|||
DisplayDepthFactorDescription: "Determines correlation between pixel depth value and its output colour. High values lead to brighter image."
|
||||
DisplayDepthName: "Visualize depth buffer"
|
||||
DisplayNormalsName: "Visualize pass normals"
|
||||
NormalsInWorldSpace: "Show normals in world space"
|
||||
ContrastLevelDescription: "Constrast level."
|
||||
ContrastLevelName: "Constrast"
|
||||
GammaLevelDescription: "Gamma level."
|
||||
|
|
|
@ -33,6 +33,7 @@ DisplayDepthName: "Визуализация буфера глубины"
|
|||
DisplayDepthFactorDescription: "Определяет соотношение между значением глубины пикселя и его цветом. Чем выше значение, тем ярче будет изображение."
|
||||
DisplayDepthFactorName: "Соотношение цвета"
|
||||
DisplayNormalsName: "Визуализация нормалей"
|
||||
NormalsInWorldSpace: "Показывать нормали мирового пространства"
|
||||
ContrastLevelDescription: "Контрастность изображения"
|
||||
ContrastLevelName: "Контрастность"
|
||||
GammaLevelDescription: "Яркость изображения"
|
||||
|
|
|
@ -19,6 +19,11 @@ uniform_bool uDisplayNormals {
|
|||
display_name = "#{OMWShaders:DisplayNormalsName}";
|
||||
}
|
||||
|
||||
uniform_bool uNormalsInWorldSpace {
|
||||
default = false;
|
||||
display_name = "#{OMWShaders:NormalsInWorldSpace}";
|
||||
}
|
||||
|
||||
fragment main {
|
||||
|
||||
omw_In vec2 omw_TexCoord;
|
||||
|
@ -30,8 +35,12 @@ fragment main {
|
|||
if (uDisplayDepth)
|
||||
omw_FragColor = vec4(vec3(omw_GetLinearDepth(omw_TexCoord) / omw.far * uDepthFactor), 1.0);
|
||||
#if OMW_NORMALS
|
||||
if (uDisplayNormals && (!uDisplayDepth || omw_TexCoord.x < 0.5))
|
||||
omw_FragColor.rgb = omw_GetNormals(omw_TexCoord) * 0.5 + 0.5;
|
||||
if (uDisplayNormals && (!uDisplayDepth || omw_TexCoord.x < 0.5)) {
|
||||
if (uNormalsInWorldSpace)
|
||||
omw_FragColor.rgb = omw_GetNormalsWorldSpace(omw_TexCoord) * 0.5 + 0.5;
|
||||
else
|
||||
omw_FragColor.rgb = omw_GetNormals(omw_TexCoord) * 0.5 + 0.5;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue