Skip to content

Conversation

@JMS55
Copy link
Contributor

@JMS55 JMS55 commented Jan 17, 2026

I was using a path termination heuristic designed for a radiance cache, but solari uses an irradiance cache. Whoops.

This new heuristic is inspired by RTXGI, and prevents the world cache from showing up in reflections properly.

To test, move the camera close to a mirror surface.


Also contains some bugfixes for bugs introduced in #22468.

@JMS55 JMS55 requested a review from SparkyPotato January 17, 2026 18:22
@JMS55 JMS55 added this to the 0.19 milestone Jan 17, 2026
@JMS55 JMS55 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Jan 17, 2026
@JMS55 JMS55 changed the title Soalri: Better path termination heuristic Solari: Better path termination heuristic Jan 17, 2026
let brdf = evaluate_brdf(N, wo, wi, ray_hit.material);
let cos_theta = saturate(dot(wi, N));
throughput *= (brdf * cos_theta) / p_bounce;
throughput *= brdf / p_bounce;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a small bugfix that was missed in #22468

@alice-i-cecile alice-i-cecile added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jan 18, 2026

if path_spread * path_spread > a0 * get_cell_size(ray_hit.world_position, view.world_position) {
// Path spread is wide enough, terminate path in the world cache
// Terminate path in the world cache if the ray is long enough and the path spread is large enough
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a citation or description akin to your PR description here to explain how this metric was selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kinda adhoc based on testing some stuff and what RTXGI was doing. There's not much basis to it really.

Comment on lines +186 to +190
fn path_spread_heuristic(ray_t: f32, roughness: f32) -> f32 {
let alpha_squared = min(roughness * roughness, 0.99);
let distance_squared = ray_t * ray_t;
return distance_squared * 0.5 * (alpha_squared / (1.0 - alpha_squared));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially copied from SHaRC, but accumulated over multiple bounces instead of the single bounce I think SHaRC does. Basically it's using the roughness to compute the area of a disk a certain distance along a code.

@JMS55
Copy link
Contributor Author

JMS55 commented Jan 19, 2026

I think there's still a bug when querying the world cache.

cos_theta is no longer applied when sampling DI in world cache update.

I think we need to apply cos_theta when querying the WC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants