Page tree
Skip to end of metadata
Go to start of metadata

For a brief tutorial on shaders see: https://github.com/mtijanic/nwnee-shader-tutorials

Uniforms

* int screenWidth, int screenHeight
Viewport size.

* float nearClip, float farClip
Render clipping cutoff.

* int sceneCurrentFrame
The current render frame. No guarantees to limits or wrapping behaviour.

* int worldtimerTimeOfDay
The current time of day as seen from the game world, in milliseconds. This value will pause when the game pauses.

* int windPointSourcesCount (max: 128)
A wind point source is a "explosion" source. You can see this with some spells that bend grass around you.
This is the number of wind point sources for the current frame; you need this to walk the following vectors:

* float windPointSourcesPosition[windPointSourcesCount*3]
A vector of X, Y, Z positions for each windPointSource.

* float windPointSourcesRadius[windPointSourcesCount]
The radius for each windPointSource.

* float windPointSourcesIntensity[windPointSourcesCount]
The intensity for each windPointSource.

* float windPointSourcesTimeRemaining[windPointSourcesCount]
The time remaining for each windPointSource.

* int moduleDawnHour
The module dawn hour (usually something like 8).

* int moduleDuskHour
The module dusk hour (usually something like 16).

* int moduleMinutesPerHour
Minutes per hour. You can use this to calculate the dawn/dusk progression.

* vec3 areaGlobalWind
The global wind vector for the current area (including magnitude).

* int areaWeatherType
The weather type: 0 = clear, 1 = rain, 2 = snow.

* float areaWeatherDensity
The weather density as determined by the engine.

* int areaFlags
A mask of area flags: 1 = interior, 2 = underground, 4 = natural

* int moduleYear
* int moduleMonth
* int moduleDay
* int moduleHour
The module time as seen by the player.

* float moduleTimeIntoTransition
* float moduleTransitionTime
This describes the day/dusk/dawn/night transition animations for areas.

* ivec2 userinputMousePosition
Mouse coordinates.

* int userinputMouseButtons
A mask of mouse buttons currently down: 1 = left, 2 = right, 4 = middle.


* int fogEnabled
1 if fog is enabled.

* int fogMode
Fog mode (0 = linear, 1 = exp, 2 = exp2).

* float fogStart, float fogEnd
Fog render distances.

* vec4 fogColor
The current fog colour.

* int numLights
The number of dynamic lights currently in the scene.

* vec4 globalColor
The global/world colour.

* vec4 frontLightModelProductSceneColor
The scene colour (ambient light).

* vec4 materialFrontAmbient
* vec4 materialFrontDiffuse
* vec4 materialFrontSpecular
* vec4 materialFrontEmissive
* float materialFrontShininess
Material source components.

* vec4 lightAmbient
* vec4 lightDiffuse
* vec4 lightSpecular
* vec4 lightPosition
* vec4 lightHalfVector
* float lightConstantAtten
* float lightLinearAtten
* float lightQuadraticAtten
Light source parameters.

* int texUnitXX (where 0 <= XX < 14)
* int texUnitEnv
* int textureXXBound (where 0 <= XX < 14)
Bound textures.

* vec4 texCoordOffset0, vec4 texCoordOffset1
* float texCoordRot0, float texCoordRot1
Bound textures position and rotation.


* mat4 m_m
* mat4 m_mv
* mat4 m_mvp
Model, ModelView and ModelViewProjection matrices for vertex transformations.

* mat3 m_normal
Matrix for vertex normal transformations.


In addition to the uniforms, the following vertex attributes are exposed:

* vec4 vPos
Vertex position in object space.

* vec2 vTcIn
Texture coordinates for current texture.

* vec4 vColor
Active colour for the vertex.

* vec3 vNormal
Current vertex untransformed normal.



UPDATE: info posted by Sherincall on the nwvault #custom-content Discord channel on Monday 17 Feb, 2020:

đź“Ž uniforms available to all shaders:

sceneCurrentFrame
worldtimerTimeOfDay
windPointSourcesCount
windPointSourcesPosition
windPointSourcesRadius
windPointSourcesIntensity
windPointSourcesTimeRemaining
moduleDawnHour
moduleDuskHour
moduleMinutesPerHour
moduleYear
moduleMonth
moduleDay
moduleHour
moduleTimeIntoTransition
moduleTransitionTime
areaGlobalWind
areaWeatherType
areaWeatherDensity
areaFlags
userinputMousePosition
userinputMouseButtons
m_mvp
m_mv
m_m
m_normal
m_texture
m_view
m_proj
m_vp
m_view_inv
m_proj_inv
m_vp_inv
m_bones[128]
idxmap[128]
lightAmbient[8]
lightDiffuse[8]
lightPosition[8]
lightQuadraticAtten[8]
numLights
FragmentLighting
GammaCorrection
materialFrontAmbient
materialFrontDiffuse
materialFrontSpecular
materialFrontEmissive
materialFrontShininess
frontLightModelProductSceneColor
globalColor
texUnit{0..14}
texUnitEnv
texture{0..15}Bound
fSchemeRow{0..14}
fogEnd
fogMode
fogStart
fogColor
fogEnabled
cameraPitch
cameraYaw
cameraPosition
cameraViewAngle
cameraDialogState
startFadePitch
keyholeCanDissolve
keyholeRadius
nearClip
farClip
screenWidth
screenHeight
AORadius
AOIntensity
AOColor
blackPoint
whitePoint
Vibrance
RGBBalance
DOFAmount
Gamma
playerPosition
playerOrientation
playerInCutscene
playerCameraDist

(plus whatever MTR+nwscript pass, for individual objects)

  • No labels