bevyengine / bevyengine/bevy

Use oct-encoding for `NormalPrepass` texture

Open
#22,843 1 comment 0 reactions 0 assignees View on GitHub
A-Rendering C-Feature D-Shaders S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Currently normal prepass texture is `Rgb10A2`, which is 10x3 bit for normal vec3 and 2 bit unused. The precision is much lower than oct-encoded `Rg16Snorm` though oct-encoding/decoding it in shaders has a overhead.

## What solution would you like?

Use oct-encoded `Rg16Snorm` for normal prepass texture.

## What alternative(s) have you considered?

Leave it as is.

## Additional context

See also #21926 which uses oct-encoding for vertex normal and tangent.

Contributor guide

Open the contributing guide

Research direction

Start at the NormalPrepass texture implementation and its shader consumers, then compare the oct-encoding approach referenced in #21926. Replace the Rgb10A2 representation with oct-encoded Rg16Snorm and verify that normal prepass rendering and decoding preserve the expected normal precision.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.