Skip to content

Erosion Optimizations #182

@zachEastin

Description

@zachEastin

Totals:

Testing done with a single frame at 100 iterations (substeps). Thermal with Use 8 on. Grid is 512x512 vertices. No water mesh

Hydro and Thermal w/out Sediment Traversal

Before After Total Increase
1440ms 550ms ~2.6x

Hydro and Thermal with Sediment Traversal

Before After Total Increase
1700ms 1050ms ~1.6x

Hydro Only w/o Sediment Traversal

Before After Total Increase
1483ms 487ms ~3x

Hydro Only with Sediment Traversal

Before After Total Increase
1500ms 1021ms ~1.5x

Thermal Only

Before After Total Increase
1234ms 129ms ~9.5x

No Thermal and No Hydro (ie Erosion Off)

Not a great, but fun comparison!

Before After Total Increase
1040ms <0.1ms ~11555.6x

Most likely wasn't really noticed previously as erosion is primarily a frame by frame deal, not the for loop like the test was using it as. So users were really only seeing 1-2 wasted iterations, not 100 leading to smaller and mostly unnoticeable lost

Refactor the hydro erosion module to use sampleIndex instead of evaluateAtIndex node for improved performance and clarity. This also affects sediment traversal, though I didn't get a measurement of it before performing the other optimizations.
I'm getting roughly a 2ms speed up per iteration. Not a lot, but over many iterations it adds up nicely.

FIX: Use a switch on geometry to ensure NO calculations are being done for sediment traversal when disabled. Results in a 2x increase in speed up.

Should have been done before, hence the reason it's more of a fix, not a true optimization of algorithm

FIX: Added switch node to switch betwee geo with and without hyrdo node use when Use Hydro is toggled off.
Results in massive savings when only wanting Thermal Erosion.
Before at 100 iterations: 1347ms | After: 280ms

Refactor the thermal erosion module to use sampleIndex instead of evaluateAtIndex node for improved performance and clarity.
I'm getting roughly a 1.5ms speed up per iteration. Not a lot, but over many iterations it adds up nicely.

Skip erosion totally if both Use Hydro and Use Thermal are disabled.

Sediment Traversal: Don't use 2 capture attribute nodes for the sediment surrounding sediment values. (Blender 4.5 now allows for 1 capture attribute node to capture multiple inputs saving much time)
Roughly 2ms per iteration speed up.
At 100ms -> Before: 1258ms | After: 1015ms

Metadata

Metadata

Assignees

Labels

OptimizationA task that should make things faster

Type

No fields configured for Task.

Projects

Status
Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions