Parallel Neural Shader Implementation
This paper presents a compact implementation of a single-layer perceptron neural network executed entirely within a GLSL fragment shader. The implementation introduces three novel architectural features: (i) a data-dependent stochastic resonance mechanism that modulates synaptic weights based on input-weight interactions via a deterministic hash function; (ii) a multi-domain output encoding that simultaneously produces activation values, squared magnitudes, and absolute magnitudes; and (iii) a resolution-adaptive neuron allocation scheme where the number of parallel neurons is determined by the screen resolution. The code is self-contained, dependency-free, and executes with microsecond-scale latency on any GPU supporting OpenGL or WebGL. We analyze the theoretical underpinnings of each feature, compare the implementation with existing neural shading frameworks (ShaderNN, SimpNet, MobileNeRF), and discuss its potential for ultra-low-latency inference in real-time graphics applications, edge AI, and on-device computing. This work contributes a novel architectural variant to the emerging field of neural shading and demonstrates the viability of fragment shaders as a compute substrate for neural network inference. Keywords: Neural shading, fragment shader computing, GPGPU, on-device AI inference, stochastic resonance, GLSL, single-layer perceptron, real-time inference Code Availability: The source code is provided as a supplementary file and is licensed under CC BY 4.0.
Authors
- Elijah Octelus (ORCID: https://orcid.org/0009-0002-3206-9064)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-07-01
- DOI
- https://doi.org/10.5281/zenodo.21105661
- Primary Topic
- Advanced Neural Network Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00