close
Skip to content

Solari brdf fixes#23818

Closed
dylansechet wants to merge 4 commits into
bevyengine:mainfrom
dylansechet:solari_brdf
Closed

Solari brdf fixes#23818
dylansechet wants to merge 4 commits into
bevyengine:mainfrom
dylansechet:solari_brdf

Conversation

@dylansechet
Copy link
Copy Markdown
Contributor

@dylansechet dylansechet commented Apr 15, 2026

Objective

BRDF fixes for solari!

Solution

  • Use a local TBN instead of mikktspace, which was producing seams on the spheres used for the white furnace test.
  • Separate metallic/dielectric paths, evaluating each endpoint separately then blending rather than working with a blended F0. This is the same as what Fix energy loss in multi-scattering term #23203 did for IBL.
  • The Fresnel layering that was introduced isn't energy conserving. Instead, I compute the total energy reflected by the specular lobe using the DFG table and Filament's multi-scattering approximation. I can then scale the diffuse by the complement to ensure energy conservation.
    A downside to this approach is that it breaks reciprocity because of the simplifications that Filament's multi-scattering formulation makes. As far as I can tell the path tracer is unidirectional, so this shouldn't cause issues. The fix to restore reciprocity would be to add the full Kulla-Conty compensation lobe, which requires an extra LUT.

Note: I've mostly focused on getting this correct, performance can probably be improved. For example, this does entirely too many F_AB lookups.

Testing and showcase

White furnace

We're still not passing, but the changes improve it a lot.

On main:
0_main
With the LUT-based F_AB:
1_main_F_AB
Adding the local TBN:
2_proper_tbn
Adding the BRDF fixes:
3_proper_brdf

Bunch of spheres

Notice the darkening on main for the middle row of spheres, with metallic=0.5.

Main:
main
This PR:
new_brdf

Dragons

The shading differences are particularly visible on the dragons in the front row.
There is some kind of exposure or tonemapping difference between bevy and cycles that's been driving me crazy, but I haven't been able to track it down.

animated
Individual images

Main:
main

This PR:
fix_brdf

Cycles:
cycles

More Dragons

animated
Individual images Main: main

This PR:
fix_brdf

Cycles:
cycles

@kfc35 kfc35 added A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 16, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 16, 2026
@alice-i-cecile alice-i-cecile added the C-Refinement Improves output quality, without fixing a clear bug or adding new functionality. label Apr 16, 2026
@alice-i-cecile alice-i-cecile added D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes D-Domain-Expert Requires deep knowledge in a given domain X-Uncontroversial This work is generally agreed upon labels Apr 16, 2026
Comment thread crates/bevy_solari/src/scene/brdf.wgsl Outdated
@JMS55 JMS55 added this to the 0.20 milestone Apr 20, 2026
@dylansechet
Copy link
Copy Markdown
Contributor Author

Splitting into smaller PRs.

@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Apr 23, 2026
yonas pushed a commit to yonasBSD/bevy that referenced this pull request Apr 24, 2026
# Objective
BRDF fixes for solari. Split off from bevyengine#23818.

## Solution

Use a local TBN instead of mikktspace, which was producing seams on the
spheres used for the white furnace test.

## Testing
On main:
<img width="1920" height="1013" alt="1_main_F_AB"
src="https://github.com/user-attachments/assets/c05acf43-faa1-4128-9cdc-807ed2364518"
/>

This PR:
<img width="1920" height="1013" alt="2_proper_tbn"
src="https://github.com/user-attachments/assets/7230e9d9-02ec-4435-8d74-1b7b7a314e27"
/>
tychedelia pushed a commit to processing/bevy that referenced this pull request Apr 30, 2026
# Objective
BRDF fixes for solari. Split off from bevyengine#23818.

## Solution

Use a local TBN instead of mikktspace, which was producing seams on the
spheres used for the white furnace test.

## Testing
On main:
<img width="1920" height="1013" alt="1_main_F_AB"
src="https://github.com/user-attachments/assets/c05acf43-faa1-4128-9cdc-807ed2364518"
/>

This PR:
<img width="1920" height="1013" alt="2_proper_tbn"
src="https://github.com/user-attachments/assets/7230e9d9-02ec-4435-8d74-1b7b7a314e27"
/>
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-Refinement Improves output quality, without fixing a clear bug or adding new functionality. D-Domain-Expert Requires deep knowledge in a given domain D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants