You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every project has its own shader folder, inside the src folder of the project.
This folder has a folder for each shader.
These shaders will be compiled into the global object SHADERS which is available to all layers.
To use the shader example, simply write SHADERS.example.
Shaders may be used as a separate node in nin, by creating a node which inherits from NIN.ShaderNode with a shader object (or the name of a shader in the shaders folder) as a parameter in options, or they may also be used for materials, by using ShaderMaterial.
If your shader only needs for instance a vertex shader but not a fragment shader, NIN will fall back to a default set of shaders.
The only rules you need to oblige is that:
The uniform file needs to include tDiffuse
The vertex shader needs to pass on vUv (uv)
Live reloading
When a shader is changed on disk using an external editor, nin can reload node which depend on the shader.
To let nin know which node to reload, register the shader in graph.json, like this: