The tutorials posted here are outdated, and NWN:EE has progressed to the point where parts of it are no longer correct, or good advice. Use at your own risk.
This repository holds various shader demos you can use as a primer to write your own superfancy effects. The shaders are well commented, so if you're feeling adventurous you can dive right in. Otherwise, read on.
These tutorials assume a basic level of understanding of:
- NWScript: Code flow, control structures (if/for/while), functions, structs (specifically vector)
- Linear algebra: Matrix and vector operations (additions, multiplication, dot products)
- 3D models: Vertices, triangles, textures
The tutorials will (try to) teach you to write shaders for NWN:EE. A lot of this knowledge is applicable to other games, but there are also significant gaps. NWN supports only a small subset of features present in a modern game; others (e.g. tessellation, geometry shaders, etc) are beyond the scope of these tutorials. You will find plenty of generic tutorials online, should you want to learn about those.
If you already have some knowledge how shaders work and are just looking for a specific answer, check the FAQ.
- What is a shader?
- GLSL (OpenGL Shading Language) basics
- Framebuffer effects
- Material fragment shaders
- Material vertex shaders
- Dynamic lighting in NWN
If you are having trouble following, this is a great animated introduction about the rendering pipeline, made with non-technical people in mind.
If this is too slow and basic for you, try the lighthouse3d tutorials on GLSL. You can skip anything that mentions "Geometry Shaders" or "Tessellation", as NWN doesn't have those.
If you've gone through everything and really want to know more about GPUs, send me a PM or email.