Geometry Nodes: Add Viewport Transform node #118680
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#118680
Loading…
Reference in New Issue
No description provided.
Delete Branch "HooglyBoogly/blender:geometry-nodes-viewport-transform"
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?
Add a node that outputs the transform of the viewport relative to the
self object's transform. This node can be used to build effects like
billboarding or aligning geometry to the current view. In combination
with the mouse position node in the future it will allow tools like
generating geometry at the mouse click position.
There are two output matrices. The first is the projection matrix
that takes positions in camera space and applies the final perspective
projection. The other is the "view" matrix which contains the location
and rotation of the camera. These are separate because though their
combination is useful, it isn't used like a typical rotation/transform matrix.
Example node group to be used for aligning to camera (billboards):
It might be useful to also add a boolean wheher or not the user is in camera view?
I don't doubt it, but do you have a use case in mind? Maybe it's more generally useful to have a camera object output for those cases.
@blender-bot build
What do you think should be the merging strategy here? With this node but without
Mouse Position
we are not really in a releasable state.Would be good to have an example of how you intend people to use this.
I think this still has value on its own. Things like billboarding or aligning geometry to the camera which is a relatively common modeling operation could use this. I planned to create a PR for the mouse position node right after this is committed.
Ok, well then maybe add a simple example in the PR description? Currently, it says that the node is not useful as is.
Ah right, sorry. Will do!
Need to merge
main
again. Also, last time I tried the setup in the image it didn't work. Did you try it yourself? Can you provide a .blend file?Of course :P I misinterpreted the results though, in retrospect it was clearly not working. And I realized that's because the
persmat
isn't a proper rotation matrix. We need to output the view and projection matrices separately from this node. For raycasting use cases, they can be combined with a multiply matrix node. For "align to camera" use cases, the view matrix is enough.Sure, attached a simple example.
The example for how to align something to the view seems to work fine for orthographic view or when the object is in the center of the 3D view. I found that this works better in perspective mode, because it actually aligns the matrix to the camera position instead of just to the viewing direction. Unfortunately, this approach does not work so well for orthographic view, because there the camera position is less well defined.
Any thoughts on how to deal with this? Might also be good to expose the camera position for perspective mode directly.
@ -0,0 +13,4 @@
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Matrix>("Projection")
.description("The 3D viewport's perspective projection matrix");
perspective or orthographic?
Okay I guess it deals with orthographic projection too. I'll change it to
perspective or orthographic
@ -0,0 +24,4 @@
return;
}
const Object &self_object = *params.self_object();
const RegionView3D &rv3d = *params.user_data()->call_data->operator_data->rv3d;
Node group operators should work even when there is no 3D view.
I'd rather not output redundant information from this node, I think that's more confusing than helpful for this sort of low level building block. I'd expect there to be some way to check if a matrix is orthographic/perspective in the future, then some node group using this can change its behavior based on that.
Would like to see the billboard example more explicitly in the PR description (with screenshot). Other than that, LGTM.