WIP: Cycles octahedral normals (and tangents) #121704
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#121704
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "boberfly/blender:feature/octahedral_tangents"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While experimenting with corner normals, an issue coming up is the extra memory overhead that would incur if there was a hypothetical swap from vertex normals as the default. One of the known effective compression techniques is octahedral normals:
https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/
https://twitter.com/Stubbesaurus/status/937994790553227264
https://jcgt.org/published/0003/02/01/paper.pdf
https://www.shadertoy.com/view/llfcRl
I went with compressing/quantising to a single uint, it seems to have enough precision and is 1/3rd the memory usage over float3.
Another concern is any performance overheads that would incur from this approach, so there is some benchmark data. Octahedral is just the normals, and octahedral_tangents combines both normals and tangents (as well as compressing tangent_sign to a char/8-bit value that gets a cast to float).
I've only just tested on CPU and OptiX (Nvidia RTX 2070) but the results seem like they do add overhead, and junkshop has the best memory savings probably due to using more normal maps than the other tests.
Renders seem to 'match' enough, the quantisation probably causes some samples to differ very slightly.
ba15d4fde0
to3cd950f8b1
I made a modification in this latest version. I've updated the functions to be templated so you can specify the precision of the octahedral quantisation. I've made this so I could compress tangents into 30 bits instead of 32 bits so I can also fit tangent_sign in there, as it only needs to store 1.0f or -1.0f (with the default as 1.0f) which also simplifies the code quite a bit across the board. I needed to make it compatible with OSL but I've not tested that codepath yet.
Memory should go down a little bit more and visually I can't see a difference - but I'd appreciate more eyes on the signage code, or a unit test that can verify that the flag is working as intended - looks like 97.13mb less in junkshop from the previous commit (or 336.81mb less from main branch).
3cd950f8b1
to680ad333ab
...and one minor tweak so that non-default tangents are correctly tagged for encoding/decoding.
680ad333ab
tof12776cdb2
f12776cdb2
toa627942c02
Checkout
From your project repository, check out a new branch and test the changes.