| Strawberry | Lemon | Lime |
|---|---|---|
![]() | ![]() | ![]() |
The source cuda code can be found here, which you should noted is that the stb_image.h, stb_image_write.h and the stanford-bunny.obj must be placed at the same file level.
It’s important to note that running this program on an RTX 4060 is not fast. The red image (red, the strawberry-flavored jelly rabbit) has a quality scale of 2.0 and took approximately 2 hours; the green image (green, the lime-flavored jelly rabbit) has a quality scale of 0.5 and took approximately 45 minutes. It’s clear that the bottom image has significantly more noise than the top. In addition, I’ve provided jelly rabbits in Clear, Orange, Lemon, Blueberry, Grape, and Peach flavors. Due to computational limitations, I’m only providing two .gif files for demonstration purposes; readers are welcome to obtain the other beautiful jelly rabbits themselves. Furthermore, if you have better methods or ideas for noise reduction and speeding up the process, please contact me at masterforliage@gmail.com.
1. Rendering Equation
1.1 Radiance and Surface Integral
For a shading point and outgoing direction , the surface form is:
Where:
- : outgoing radiance
- : emitted radiance (area light only)
- : BSDF (ground BRDF or jelly interface BSDF)
- : incident radiance from recursive transport
1.2 Jelly-Specific Transport Split
In this implementation, radiance transport is a combination of:
- Surface events (ground BRDF and dielectric reflection/refraction)
- Medium attenuation/scattering when path segments are inside jelly
- Direct-light sampling on non-delta surfaces with MIS
2. Dielectric Interface Model for Jelly
The bunny surface is treated as rough dielectric.
2.1 Snell + Fresnel
Snell:
Schlick approximation:
Sampling rule:
- Reflect with probability
- Refract with probability
- On TIR, force reflection
2.2 Rough Interface Sampling
For non-zero roughness, reflection/transmission directions are perturbed around ideal axes by a power-cosine lobe:
Where is roughness and is the mapped exponent.
3. Participating Medium Inside Jelly
Jelly color comes from absorption + weak scattering in the interior.
3.1 Beer-Lambert Attenuation
Whenever the path is inside jelly:
3.2 Weak In-Scatter Approximation (Engineering Term)
The implementation adds a controlled in-scatter term:
Where:
- (per channel)
- uses transmittance loss and anisotropy factor
- This is variance-friendly and keeps a translucent jelly look without full volumetric random walks
4. Ground BRDF Model
Ground uses a mixed diffuse + glossy model:
Current constants:
Ground albedo is checker-like and distance-faded to stabilize composition under motion.
5. Next Event Estimation (NEE)
At ground hits, direct light from rectangular area light is sampled:
And area-measure PDF is converted to solid-angle PDF:
6. MIS (Light Sampling + BSDF Sampling)
Power heuristic:
Used for:
- NEE contribution at diffuse/glossy surfaces
- BSDF-sampled paths that hit the light
This reduces variance under small area light + rough dielectric transport.
7. Path Throughput, RR, and Clamp
At each non-delta surface event:
Russian roulette after several bounces:
If survived, divide throughput by to keep unbiasedness.
A firefly clamp is also applied to sample radiance:
8. Denoising and Tonemap Pipeline
8.1 In-Kernel HDR Joint Bilateral
Before tonemap/gamma, an HDR bilateral-like filter is applied with:
- Spatial term (neighborhood distance)
- Color term (HDR difference, adaptive to spp)
8.2 Offline Temporal + Spatial Stabilization
Before GIF encoding, frame sequence is filtered by:
- Temporal neighbor blending with thresholds
- Spatial edge-aware smoothing
Then frames are encoded using palette-based GIF pipeline.
9. Soft-Body Dynamics (XPBD) for Drop and Impact Wobble
The bunny motion is simulated with XPBD edge constraints + shape constraint.
9.1 Edge Constraint
For an edge :
XPBD lambda update:
Position corrections:
9.2 Shape-Preserving Constraint with Translation
Each vertex is softly pulled toward translated rest pose:
This preserves shape while allowing global fall/impact motion.
9.3 Gravity, Ground Collision, and Friction
Velocity integration includes gravity:
On ground contact (), apply:
- Position projection to ground plane
- Vertical restitution
- Tangential friction damping
This produces the intended “drop, slam, wobble” feel.
10. Frame Accumulation Strategy for Lower Noise
Each animation frame uses:
- Warmup passes (discarded conceptually, but included in per-frame accumulation buffer)
- Main passes (final frame quality)
Also, render pass index is globally increasing across frames, so random sequences do not restart per frame.
This improves convergence stability and reduces visible per-frame noise flicker.
11. Practical Parameter Ranges (Current Jelly Setup)
ior: aroundroughness: aroundsigma_a,sigma_s: preset-dependent (flavor colors)max_bounces: 6 for offline sequencedrop_height: aboutimpact_boost: about
If model scale changes, calibrate medium coefficients and drop parameters together to keep color depth and impact timing consistent.


