Materials
EXEPERT uses two custom ShaderMaterials, both classic GLSL ES (not TSL),
living in src/materials/. They are the same shaders that drive the legacy
reference pages, which is why they are referred to as the "v1" shaders.
Neuron material
src/materials/neuron.ts renders the neuron Points. The vertex shader sizes
each point by its per-vertex size attribute, a global sizeMultiplier
uniform, and distance attenuation:
gl_PointSize = size * sizeMultiplier * (300.0 / length(mvPosition.xyz));
The fragment shader multiplies the per-vertex color and opacity by the sprite
texture:
gl_FragColor = vec4(vColor, opacity) * texture2D(map, gl_PointCoord);
The material uses AdditiveBlending, transparent: true, and
depthTest: false, which gives the glowing, layered look.
The texture uniform is named map, not texture, to avoid a GLSL ES 3.00
reserved-word collision. This is the one deliberate difference from the original
v1 shaders.
The factory returns a bundle with setters so the GUI can mutate uniforms without rebuilding the material:
export interface NeuronMaterialBundle {
material: ShaderMaterial
setSizeMultiplier(value: number): void
setOpacity(value: number): void
}
Axon material
src/materials/axon.ts renders the axon LineSegments. It applies the
per-vertex opacity attribute times a global opacity multiplier, with additive
blending, so denser bundles of axons read as brighter. Its bundle exposes
setColor and setOpacityMultiplier, which Brain.updateSettings() calls when
the corresponding GUI controls change.
How they connect to the GUI
Brain.updateSettings() updates these material uniforms alongside the WASM
settings:
this.neuronMaterial.setOpacity(this.neuronOpacity)
this.neuronMaterial.setSizeMultiplier(this.neuronSizeMultiplier)
this.axonMaterial.setColor(this.axonColor)
this.axonMaterial.setOpacityMultiplier(this.axonOpacityMultiplier)
So changing "Neuron Opacity" or "Axon Opacity Mult" in the panel updates both the simulation-side value and the shader uniform in the same call.