---
title: 'Neural-GASh: Real-Time Shading Pipeline'
url: https://www.emergentmind.com/topics/neural-gash
type: topic
---

# Neural-GASh: Real-Time Shading Pipeline

Searching arXiv for the specified paper and nearby context.
{"query": "\"Neural-GASh\" arXiv", "max_results": 5}
Neural-GASh is a real-time shading pipeline for 3D meshes that leverages a neural radiance field architecture to perform image-based rendering using Conformal Geometric Algebra (CGA)-encoded vertex information as input. It replaces the costly offline precomputation of Precomputed Radiance Transfer (PRT) by learning, in a single feed-forward pass, the per-vertex spherical harmonic (SH) radiance coefficients directly from CGA-encoded geometry. Integrated into the Unity engine, it is designed for accurate shading of animated and deformed 3D meshes, with dynamic texture swaps and environment map rotation, and it is evaluated both on conventional meshes and on scenes generated via 3D Gaussian splats [2507.13917].

## 1. Pipeline definition and computational scope

Neural-GASh is organized around the runtime sequence

**Input Geometry \(\rightarrow\) CGA Encoding \(\rightarrow\) Neural Radiance Field (MLP) \(\rightarrow\) SH Coefficients \(\rightarrow\) Fragment Shader \(\rightarrow\) Final Shaded Mesh** [2507.13917].

A Unity mesh provides per-vertex positions \(\mathbf{v}\) and normals \(\mathbf{n}\). For each \((\mathbf{v},\mathbf{n})\), the system constructs a 32-dimensional multivector \(M\), and a neural field predicts 27 SH coefficients \(\{P_{i,0},\dots,P_{i,26}\}\) for vertex \(i\). These coefficients are then projected against SH lighting coefficients and consumed by a GPU fragment shader to render the final image in real time.

The central distinction from traditional PRT is explicit: Neural-GASh does not rely on expensive offline precomputations. Instead, the learned model directly consumes CGA-based representations of vertex positions and normals. Because CGA encoding and neural inference are only re-run when the mesh deforms or lighting changes, the per-frame cost remains low. This suggests that the method is structured around event-driven updates rather than unconditional per-frame recomputation.

## 2. Conformal Geometric Algebra representation

The geometric formulation is stated in 5D CGA. A 3D point \(\mathbf{x}=(x,y,z)\) is embedded as a null vector

$$
X \;=\; e_+ \;+\;\mathbf{x}\;+\;\tfrac12\,\|\mathbf{x}\|^2\,e_-\,,
\quad X^2=0.
$$

Here \(e_+\) and \(e_-\) are the null basis vectors with signature \((+,-)\) [2507.13917].

For Neural-GASh, the operative input is not merely a point lift or plane lift, but a **motor** \(M\) that encodes both rotation and translation. The construction is given in four steps: compute the unit quaternion \(q\) rotating the fixed up-axis \(\mathbf{y}=(0,1,0)\) to the normal \(\mathbf{n}\); build the corresponding CGA rotor \(R\); build the CGA translator
\[
Tr(\mathbf{v})=\exp\!\bigl(\tfrac12(e_--e_+)\wedge \mathbf{v}\bigr);
\]
and multiply them to obtain the 32D motor
$$
M \;=\; Tr(\mathbf{v})\,R
\;\in\;\mathrm{Cl}(4,1)\;\cong\;\mathbb{R}^{32}.
$$

This 32-dimensional multivector simultaneously captures local position and orientation, and it is used as the sole input to the neural field. A plausible implication is that the CGA encoding functions as an inductive bias: the network is not asked to reconstruct pose-related structure from raw Euclidean coordinates alone, but receives a representation in which translation and orientation are already algebraically coupled.

## 3. Neural radiance prediction and optimization

The predictor is a 5-layer MLP \(f:\mathbb{R}^{32}\to\mathbb{R}^{27}\). Its input dimension is 32, corresponding to the CGA motor \(M\); its hidden layers are fully-connected layers of size 1024, 512, 256, and 128; its activations are SiLU after each hidden layer; and its output is 27 real values, corresponding to SH coefficients \(\{P_{i,0\ldots 26}\}\), that is, 9 per RGB channel for 3 bands [2507.13917].

Regularization consists of batch normalization on inputs and hidden layers, together with dropout with decaying rate. During training, the objective is the mean squared error between network outputs and ground-truth PRT coefficients. At inference time, the predicted coefficients are combined with pre-computed SH lighting coefficients \(L_{j,k}\), derived from an HDR skybox, via the inner product

$$
C_{i,k} \;=\;\frac{1}{255}\sum_{j=0}^{B-1} P_{i,\,3j+k}\,\cdot\,L_{j,k},
$$

where \(B=b^2\) is the number of SH basis functions, with \(b=3\) bands and \(B=9\).

This formulation fixes the output space to low-order SH radiance coefficients rather than directly predicting pixels or fragment-space colors. That choice ties Neural-GASh to a radiance-transfer representation that remains compact and compatible with standard shader pipelines.

## 4. Spherical harmonics rotation and lighting model

Neural-GASh implements scene shading in Unity, where rotation of scene lights in terms of spherical harmonics is also performed optimally using CGA. To rotate a lighting environment by a CGA rotor \(R\), the paper states that one can apply the adjoint action on the embedded directions or directly rotate the SH coefficients via the Wigner-D matrices [2507.13917]:

$$
L'_{\ell m}
\;=\;\sum_{m'=-\ell}^{\ell}D^{(\ell)}_{m,m'}(R)\;L_{\ell m'}.
$$

The corresponding geometric action is written as

$$
X' \;=\; R\,X\,R^\dagger\quad\longrightarrow\quad
Y_\ell(X') \;=\;\sum_{m'}D^{(\ell)}_{m,m'}(R)\,Y_\ell(X).
$$

An important implementation nuance is that the Unity realization substitutes quaternions for CGA rotors, while the resulting rotation of SH coefficients is described as mathematically equivalent. This addresses a likely misconception: the method is CGA-based in representation and formulation, but not every engine-side operation is executed through an explicit CGA rotor implementation.

The lighting model therefore combines learned per-vertex transfer with SH-domain environment lighting. This suggests that Neural-GASh occupies a middle ground between classical radiance-transfer pipelines and learned radiance fields: it uses a neural predictor, but its runtime lighting composition remains analytically structured.

## 5. Engine integration and runtime behavior

The trained PyTorch model is exported to ONNX and loaded via Unity’s Barracuda. CGA encoding in C# uses the GA-Unity package to convert \((\mathbf{v},\mathbf{n})\to M\) in parallel jobs, writing 32 floats per vertex into a Barracuda tensor [2507.13917].

A tensor-layout conversion is required because Barracuda expects \([B,H,W,C]\) whereas PyTorch uses \([B,N,F]\); the implementation reorders dimensions so that \(N\), the vertex count, maps to \(H\times W\). For each mesh, an independent Barracuda worker runs the MLP and produces \(\{P_{i,k}\}\). SH projection is then executed by a compute shader that performs the projection equation in parallel across vertices and assembles color buffers.

The animation and deformation path is explicit. Whenever the mesh deforms or the vertex-normal buffer changes, the CGA encoding \(\rightarrow\) network \(\rightarrow\) shader pipeline re-executes. If motion is rapid, defined as velocity above threshold, updates are skipped to save CPU time, since lighting changes become imperceptible. The fragment shader supports dynamic texture swaps and environment map rotation without restarting the application.

The platform notes delimit the practical operating regime. On mobile/VR hardware, maintaining sub-33 ms updates requires meshes of \(< 1\,000\) vertices; higher counts or multiple meshes will require further optimization or low-rank approximations. Quality-of-service can be traded off by skipping updates on fast motion or by culling distant geometry.

## 6. Empirical results and comparative capabilities

The evaluation compares Neural-GASh to a Python reference PRT on five meshes of increasing complexity, timing only the precomputation/inference stage. All timings were run on AMD Ryzen 5 2400G + GTX 1060 (6 GB) [2507.13917].

| Mesh Name | Vertices | PRT Time (s) / NGASh Time (s) |
|---|---:|---:|
| Teapot | 672 | 100.12 / 0.03 |
| Pawn | 4 892 | 868.42 / 0.12 |
| Humanoid | 5 340 | 892.28 / 0.20 |
| Wolf | 5 559 | 962.27 / 0.15 |
| Statue | 49 671 | 10 957.75 / 1.31 |

The stated real-time threshold is \(< 33\) ms per update, and Neural-GASh achieves this for meshes up to \(\sim 1\,000\) vertices. Across the five meshes, the MSE, together with standard deviation, between ground-truth PRT coefficients and network predictions ranges from \(10^{-4}\) to \(10^{-3}\). Visually, Neural-GASh matches PRT creases, soft shadows, and low-light regions far more closely than a Blinn-Phong baseline.

The method was also integrated with a 3D Gaussian Splatting scene of approximately 80 k vertices split into 2 submeshes. In that setting, environment map swaps complete in 0.3–0.6 s, versus \(>16\,900\) s for conventional PRT on the same geometry. This suggests that the pipeline’s flexibility extends beyond conventional mesh benchmarks, although the update latency for that larger scene is not in the sub-33 ms regime.

A compact comparison of stated capabilities is as follows:

| Method | Animations/Deformations | Engine Integration |
|---|---|---|
| Traditional PRT | No | No |
| DeepPRT | Yes | No |
| Neural PRT (image-based) | No | No |
| 3D Gaussian Splatting | No | No |
| Neural-GASh | Yes | Unity (Barracuda) |

The full capability table in the source also lists dynamic textures and lighting rotation. In that comparison, Neural-GASh is the only listed method marked “Yes” for animations/deformations, dynamic textures, and lighting rotation, while also reporting engine integration as “Unity (Barracuda).”

## 7. Interpretation, limits, and relation to prior practice

Neural-GASh is positioned directly against traditional PRT. The central claim is not merely that inference is fast, but that the pipeline removes offline PRT precomputation while preserving high rendering quality and supporting animated and deformed 3D meshes [2507.13917]. In that sense, its novelty lies in combining CGA-encoded geometry, SH-domain radiance prediction, and a Unity runtime path.

Several boundaries are explicit. The reported comparison is against a Python reference PRT and measures only the precomputation/inference stage. The real-time claim is qualified by mesh size: it is tied to meshes up to approximately \(1\,000\) vertices under the stated threshold. For larger geometries, the paper points to further optimization or low-rank approximations. A plausible implication is that Neural-GASh should be understood as a practical learned shading pipeline with a clearly bounded operating envelope rather than as an unconditional replacement for all PRT workloads.

Another likely misconception concerns precomputation. Neural-GASh eliminates offline PRT precomputation, but its inference still combines predicted transfer coefficients with pre-computed SH lighting coefficients derived from an HDR skybox. This does not contradict the main claim; it clarifies that the removed cost is the geometry-dependent PRT precompute, not every preprocessing step in the lighting pipeline.

In summary, Neural-GASh demonstrates that encoding vertices and normals in CGA and predicting SH coefficients via a lightweight MLP can support deformation-aware global illumination in a production engine without offline PRT precomputation, while retaining compatibility with dynamic textures, lighting rotation, and real-time shader execution.

Source: https://www.emergentmind.com/topics/neural-gash