Stylized nonlinear Monte Carlo rendering
Applies nonlinear artistic operators inside the path-tracing estimator, so stylization such as banding or thresholding is applied to light transport before it is averaged.
In the family Stylized & non-photorealistic rendering, stylized light transport
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | No built-in stylized nonlinear Monte Carlo renderer. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Ordinary path tracing averages unbiased samples, so applying a nonlinear stylisation (a toon ramp, a threshold) to the final pixel average is not the same as applying it inside the light-transport integral. The paper studies rendering in which artist-defined nonlinear operators act within the Monte Carlo estimator, so that stylisation becomes part of how light bounces (for example banded or thresholded indirect lighting), and develops practical estimators for evaluating those nonlinear expressions from path samples. The result is stylised global illumination rather than a stylised final image. A reference implementation accompanies the paper; see the sources for the project page and code
When to choose it
Reach for it when
- stylisation breaks when path tracing averages samples
- toon banding on indirect light in offline renders
- thresholded shading gets noisy or washed out in pt
- need stylised global illumination in film rendering
- art operators applied before averaging light
Choose it for offline stylised films or stills where indirect light must stay stylised. Prefer Toon / cel shading with lighting ramps for real-time use where only direct lighting is shaded in toon style, and Guilty Gear Xrd anime-style 3D shading for artist-directed real-time looks.
Field marks
- Nonlinear functions amplify noise, so more samples are needed than for a plain path tracer
- Nonlinear estimators can trade bias against variance
- Hard to preview interactively
- Reference code repository is archived
Presets
Stylized Nonlinear Monte Carlo — post-average toon ramp (left) vs in-integrator nonlinear sample stylization (right)
{
"P_BANDS": 4,
"P_PENUMBRA": 0.75,
"P_BOUNCE_STYLE": 0.85,
"P_SPLIT": 0.48
}Show GLSL (140 lines)
const float P_BANDS = 4.00; // P Toon Bands [2.0, 6.0, 1.0]
const float P_PENUMBRA = 0.75; // P Area Light Size [0.15, 1.3, 0.05]
const float P_BOUNCE_STYLE = 0.85; // P Nonlinear Bounce [0.0, 1.2, 0.05]
const float P_SPLIT = 0.48; // P Post-Toon / NL-MC [0.0, 1.0, 0.02]
float hash21(vec2 p) {
p = fract(p * vec2(127.1, 311.7));
p += dot(p, p + 34.5);
return fract(p.x * p.y);
}
// Nonlinear artistic stylization operator phi(L): quantizes luminance into crisp chromatic ink bands!
vec3 nonlinearOp(vec3 rad, float bands) {
float lum = dot(rad, vec3(0.299, 0.587, 0.114));
float qLum = floor(clamp(lum, 0.0, 1.4) * bands + 0.35) / bands;
// Subtle artistic warm-highlight / cool-shadow chromatic shift inside the operator
vec3 tint = mix(vec3(0.72, 0.84, 1.16), vec3(1.14, 0.98, 0.82), clamp(qLum, 0.0, 1.0));
return (rad / max(lum, 0.02)) * qLum * tint;
}
vec2 mapRoom(vec3 p) {
float dFloor = p.y + 0.54;
vec2 res = vec2(dFloor, 1.0);
// Coral bounce wall on left
float dWall = p.x + 1.05;
if (dWall < res.x) res = vec2(dWall, 2.0);
// Hero central ceramic sphere
float dSph1 = length(p - vec3(0.06, -0.14, -0.05)) - 0.40;
if (dSph1 < res.x) res = vec2(dSph1, 3.0);
// Floating small blocker orb casting a rich soft penumbra across sphere & floor!
float dSph2 = length(p - vec3(0.32, 0.36, 0.25)) - 0.16;
if (dSph2 < res.x) res = vec2(dSph2, 4.0);
return res;
}
vec3 calcNormal(vec3 p) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapRoom(p + e.xyy).x - mapRoom(p - e.xyy).x,
mapRoom(p + e.yxy).x - mapRoom(p - e.yxy).x,
mapRoom(p + e.yyx).x - mapRoom(p - e.yyx).x
));
}
float softShadowRay(vec3 p, vec3 lPos) {
vec3 toL = lPos - p;
float dL = length(toL);
vec3 dir = toL / max(dL, 1e-4);
float t = 0.03;
for (int i = 0; i < 20; i++) {
float h = mapRoom(p + dir * t).x;
if (h < 0.003) return 0.0;
t += max(h, 0.03);
if (t > dL - 0.04) break;
}
return 1.0;
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isNLMC = screenX >= split;
float bands = clamp(floor(P_BANDS + 0.5), 2.0, 6.0);
float lightR = clamp(P_PENUMBRA, 0.10, 1.4) * 0.42;
float bStyle = clamp(P_BOUNCE_STYLE, 0.0, 1.4);
vec3 ro = vec3(0.12, 0.24, 2.22);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.08, -1.48));
vec3 col = mix(vec3(0.08, 0.11, 0.18), vec3(0.20, 0.28, 0.42), smoothstep(-0.4, 0.5, uv.y));
float dist = 0.05;
vec2 hit = vec2(10.0, 0.0);
for (int i = 0; i < 64; i++) {
vec2 h = mapRoom(ro + rd * dist);
if (h.x < 0.002) { hit = vec2(dist, h.y); break; }
dist += h.x;
if (dist > 8.0) break;
}
if (hit.y > 0.5) {
vec3 p = ro + rd * hit.x;
vec3 n = calcNormal(p);
vec3 alb = vec3(0.84, 0.82, 0.78);
if (hit.y > 1.5 && hit.y < 2.5) alb = vec3(0.92, 0.34, 0.24);
else if (hit.y > 2.5 && hit.y < 3.5) alb = vec3(0.92, 0.86, 0.76);
else if (hit.y > 3.5) alb = vec3(0.22, 0.68, 0.84);
// Area light center orbiting gently overhead
vec3 areaCenter = vec3(0.72 + 0.22 * cos(iTime * 0.5), 1.05, 0.62 + 0.22 * sin(iTime * 0.5));
// Evaluate 8 stratified Monte Carlo light-transport samples across the area light & bounce hemisphere:
// Left (Post-process toon): linear average FIRST, then apply phi(E[L]) -> harsh binary cut, flat indirect!
// Right (Nonlinear MC): apply phi(L_i) INSIDE the estimator E[phi(L)] -> smooth painterly penumbra transitions
// AND vivid quantized coral indirect bounce bands!
vec3 linearAcc = vec3(0.0);
vec3 nlAcc = vec3(0.0);
float jitter = hash21(floor(fragCoord) * 0.5) * 6.2831853;
for (int s = 0; s < 8; s++) {
float fs = float(s);
float ang = (fs / 8.0) * 6.2831853 + jitter * 0.25;
float rr = sqrt((fs + 0.5) / 8.0) * lightR;
vec3 lPt = areaCenter + vec3(cos(ang) * rr, 0.0, sin(ang) * rr);
vec3 lDir = normalize(lPt - p);
float vis = softShadowRay(p + n * 0.01, lPt);
float ndl = max(dot(n, lDir), 0.0);
// Colored indirect bounce contribution from coral left wall (x = -1.05)
float wallFactor = max(dot(n, normalize(vec3(-1.05, 0.0, 0.0) - p)), 0.0) / (0.65 + (p.x + 1.05) * (p.x + 1.05));
vec3 bounceS = vec3(0.96, 0.36, 0.24) * wallFactor * (0.45 + 0.55 * sin(ang) * 0.3 + 0.35) * bStyle;
vec3 skyS = vec3(0.22, 0.34, 0.54) * (0.5 + 0.5 * n.y) * 0.36;
vec3 sampleRad = alb * (vec3(1.28, 1.18, 1.02) * ndl * vis + bounceS + skyS);
linearAcc += sampleRad;
nlAcc += nonlinearOp(sampleRad, bands);
}
vec3 avgLinear = linearAcc * 0.125;
vec3 avgNL = nlAcc * 0.125;
if (!isNLMC) {
// Left: Standard post-process toon ramp phi(E[L]) -- rigid stair-step contour cutting penumbra harshly
col = nonlinearOp(avgLinear, bands);
} else {
// Right: Stylized Nonlinear Monte Carlo E[phi(L)] -- rich ink-wash penumbra + vibrant banded indirect bounce!
col = avgNL;
}
if (hit.y < 1.5) col = mix(vec3(0.08, 0.11, 0.18), col, exp(-hit.x * 0.10));
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.96, 0.98, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| stylized-nonlinear-monte-carlo-live | Tesla T4 1920x1080 | 61.5× baseline (extreme) · 2.02 ms / 2.13 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| stylized-nonlinear-monte-carlo-live | NVIDIA L4 1920x1080 | 58.5× baseline (heavy) · 0.931 ms / 0.936 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| stylized-nonlinear-monte-carlo-live | NVIDIA A100-SXM4-40GB 1920x1080 | 40.7× baseline (heavy) · 1.17 ms / 1.18 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Unidirectional Path Tracing, Instant NGP (Multiresolution Hash Encoding), Neural Radiance Caching.
Crosses
- Toon-banded bounce light, learned live: Real-time GI whose indirect light is banded or thresholded at every bounce. The cache returns a converged average per surface point, so the artist's nonlinear ramp acts on an expectation instead of on single noisy samples.
Sources
- primaryXiaochun Tong, Toshiya Hachisuka (2025). Practical Stylized Nonlinear Monte Carlo Rendering. Proceedings of the Special Interest Group on Computer Graphics and Interactive Techniques Conference Conference Papers.Verified via crossref · 2026-11-29doi:10.1145/3721238.3730686
- implementationLuisaGroup (2025). LuisaGroup/practical-stylized. Source Code for SIGGRAPH North America 2025 Paper "Practical Stylized Nonlinear Monte Carlo Rendering"GitHub API · no license declared · archived · 2026-11-29
- primaryToshiya Hachisuka. Toshiya Hachisuka's page (paper link). cs.uwaterloo.ca.Verified via live page · 2026-11-29