Fixed startup.blend default Viewport view tilt #113751
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113751
Loading…
Reference in New Issue
No description provided.
Delete Branch "Brainzman/blender:viewport-tilt-fix"
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?
Problem Description
This Pull Request addresses a long-standing (since Blender 2.5!) "bug", or UI/UX inconsistency where the default Blender viewport view is tilted by around ~0.8 degrees to the right.
While this issue might seems strange, or even unbelievable to some, you can learn more about it in this archived issue I originally created 2 years ago, which contains more details and videos showcasing the problem, as well as some information about the possible historical source of this problem.
While this inconsistency is minor, here are a few reasons why it should be fixed:
Align Active Camera to View
operator without having aligned his view to an axis first.While this issue will probably almost never affect proficient Blender users, who through the use a custom startup.blend and advanced camera setups probably won't encounter this problem, this might affect novice users a lot more, who might rely unknowingly on the fact that the default viewport view seems to be levelled, even though it's not.
Fix / Solution
This new startup.blend was generated on a fresh Blender release build (from commit
b6131cc338ab
) using the following Python script:This script uses a port of GLM's quatLookAtRH for Blender mathutils to compute a new camera view matrix using the original camera location, the camera direction vector (the inverse of its location since we're always targeting
(0, 0, 0)
and the up vector. The resulting function is then applied to every viewport area present in the startup.blend file by iterating over the workspaces it contains.This script is then ran using Blender in headless mode using a custom empty config directory to which Blender outputs the resulting modified startup.blend using the following command:
BLENDER_USER_CONFIG=./output <path_to_blender>/blender -b --python ./viewport_tilt_fix.py
Note: Thanks @HooglyBoogly for the heads up in commit b646846646 that only Release builds should be used when modifying the startup.blend file to prevent overriding other settings
Before/After gif
Also see the original report for videos better showcasing the original issue
Possible shortcomings of this solution
The method used to apply the fix (Using a Python script ran in headless mode with a custom config directory) seems to be the simplest and most elegant one, but regarding the actual fix, there exist other ways to solve this problem, such as:
After trying variants of the aforementioned methods, the one that seemed to work best and give the most precise result was the GLM quatLookAtRH mathutils port I ended up using, but there are definitely other ways to solve this problem.
Fixed startup.blend Viewport tiltto Fixed startup.blend default Viewport view tiltPinging @ideasman42 @JulianEisel @brecht @pablovazquez as potential reviewers.
Fixed startup.blend default Viewport view tiltto WIP: Fixed startup.blend default Viewport view tiltThis should be corrected by versioning code in
source/blender/blenloader/intern/versioning_defaults.cc
see:blo_update_defaults_screen
.Right! This indeed makes more sense and is way cleaner. I've reverted the
startup.blend
commit and implemented the corresponding versioning code instead. Let me know what you think.Thinking on this further, I rather use a replacement table for versioning, since differences in floating point math between systems shouldn't result in a different users
startup.blend
.This means loading the
starup.blend
, printing values before/after correction. Then adding the values with a significant differences to a lookup table, double checking they apply properly.Previous comment:
@ideasman42 I implemented your requested changes, except for the floating-point math lookup/replacement tables on which I need a little more details. I took the opportunity to add a quaternion lookat function to the broader
math_rotation.c
library, let me know what you think.Regarding the floating point lookup tables, they are indeed a necessity, but I'm not quite sure I understand the way you want them to be implemented.
Would this be more about building and using a levelled camera quaternion lookup table? Or more about filling and using a replacement table to identify viewport cameras whose resulting quaternion values are close to each other in the same
startup.blend
and make sure they get the same values? Or perhaps a mix of both?Regarding lookups I was thinking of something like this:
This can all be done in
source/blender/blenloader/intern/versioning_defaults.cc
.c7a4fc5973
to5b97af4a57
5b97af4a57
to467d2f8295
467d2f8295
to3c7a0cb960
3c7a0cb960
tode3fa3cc66
de3fa3cc66
to4a8b9461b1
4a8b9461b1
to00f857d3b9
This is the before/after comparaison data used to create the LUT, printed out in hexadecimal floating-point format:
Note: If you want to print this out on your own build of Blender to verify it, you can pull the commit
a07ab99e1c
from this PR's branch.In this data, we can see that a lot of viewports end up having values that are very close to each other, basically having the same viewpoint. The UV Editing, Texture Paint, Animation, Scripting and Modeling workspaces have the same original quaternions, and the Layout and Geometry Nodes workspaces are really close. I thus took the opportunity to "unify" them under one unique corrected quaternion, which I chose to be the one of the Layout, due to it being the default workspace.
We can also see that the Geometry Nodes and Sculpting workspaces both have a very close to 0 pivot point offset. In an effort to clean up these values, and to also uniformize the Geometry Nodes workspace with the other workspaces as stated above, I added logic to clear out these values to 0.
I've also left the viewport of the Shading, Sculpting and the first viewport of the Animation workspace as-is due to them being already leveled.
This went through quite a few iterations, from using a simple
float[][2][4]
table, to using a full blownblender::Map
with the workspace names as keys to handle all sorts of edge cases. In the end, I managed to simplify it down to using two simplefloat[][4]
quaternion lists, one being the list of viewports to correct to the unified quaternion, and the other the list of viewports to clear the pivot point offset of.You'll find this new LUT implementation in the last commit of this branch, which has been soft-reseted to main to keep its previous history. Tell me if this solving strategy looks good to you, and if so, I'll update the PR description with it.
7b5b5f19f2
to0b0df93741
0b0df93741
toaf62161dbe
@blender-bot build
WIP: Fixed startup.blend default Viewport view tiltto Fixed startup.blend default Viewport view tiltThanks, committed
913acaf395
, closing.Pull request closed