Camera nodes have sizing dimension input, Perspective camera has FOV - #181
Camera nodes have sizing dimension input, Perspective camera has FOV#181tobyspark wants to merge 5 commits into
Conversation
|
i think we should standardize on width , but i havent yet tacked the nuance of
What ive done now is
what ive yet to figure out, or systematize is how the unit -> pixels pixels -> unit conversions happen when the coordinate system is dynamic based off of moving cameras etc. my concerns is maybe cameras need to be refactored into subpatch / macro which make it very clear to any parent node what the coordinate system is. Im honestly open to suggestions here, because i think its quite nuanced really and theres a lot of valid approaches each with a ton of side effects. Lets discuss! |
|
I used to think standardising on width was good (in short, QC), but I REALLY REALLY have experienced the benefit of sizing on height. I don’t see a good reason to hold back that choice. I think it’s project dependent. Beyond that... yeah. I think the basic idea of -1, +1 is good, and yes there’s nuance as to whether that’s at the camera default or current setting or...? That said, if I’m changing the FOV of the perspective camera, I wouldn’t expect the whole scene to scale up, I’d expect to see more of it. So that would be width=2 at the “default” FOV? You might be right about subpatch. Though I think the ability to not have a camera in the root patch is a good “progressive disclosure” feature. (progressive complexity? whatever that phrase is) |
48ea891 to
1537ca4
Compare
|
I have clarified this PR by splitting the commit. There is now a fix to GraphRenderer’s resize function, with documentation on expected behaviour. And then the additions to Camera spec. |
1537ca4 to
508bc6c
Compare
508bc6c to
4d70a69
Compare
PerspectiveCameraNode now defines the canonical default camera config (FOV 30°, position derived so width=2 at origin, sizing by width) via statics and makeDefaultCamera()/resizeDefaultCamera(). GraphRenderer uses these instead of its own ad-hoc PerspectiveCamera setup. Shared setFOV(_:sizing:) extension on PerspectiveCamera eliminates duplicated horizontal-to-vertical FOV conversion logic.
Replace hardcoded -1/+1 bounds with configurable Size port (default 2.0). Default sizing dimension changed to Width, default position to (0,0,2). Mirrors PerspectiveCameraNode's static defaults pattern.
Override the inputPosition port from ObjectNode (default 0,0,0) with the camera-specific defaultPosition so the port value is correct from creation, not patched in startExecution.
|
The default camera setup wasn’t consistent with the camera nodes. That is now fixed. I think this is good.
|
I don’t think you can? In that QC couldn’t really either, it was only valid at the origin? I think if you care about pixel precision, you’re going to use an ortho camera, and Fabric provides that (and this PR allows you to set world units to pixels via the size input). Or if you’re doing 2.5D stuff, you can roll your own conversion with the Rendering Info node. |
Am I thinking about this right – There can only be one active camera per scene / render target. So there needs to be a way of ensuring there is one, and only one, active camera in the graph hierarchy, or sub-hierarchies of Render to Image and Depth. And logically it doesn’t actually matter where the camera is specified in each hierarchy. If that is true, I think there are three reasonable options
Or, is there an approach where there is effectively “no” root camera – ortho, 2D-like – and cameras are subgraph nodes which apply a (perspective) transform to the child graph? The math broadly works, but the finer points of rendering don’t though, right? |
|
Yea, ive struggled with that question tbh, because in theory, you can have multiple cameras, (think of 4 up quad rendering into a single window in CAD software, ie multiple points of view) etc, and that strictly speaking would require each camera being renderered to a sub view port of the existing window. Another option is having cameras respect layer orders, so multiple camera's could be instantiated making weird output on the same composite image (different geo with different FOV and angles composited together) Honestly thats more trouble than its worth , but fun in theory and worth thinking about architecture wise, but at some point i think youd say 'Fabric should pick a paradigm' and i agree with that, and think you are right. Let me consider your 3 options a bit! |
|
To clarify for myself, scenes ≠ render targets, per the 4-up rendering example. The root graph can only have one render target: "the screen” lets say. But a Render in Image node could potentially have multiple outputs. Also, there’s an obvious reason to go for option 2 or 3 – cameras as nodes – as this means you can patch to the inputs in the root graph. |
|
The problem with cameras as nodes / subgraphs is you have to duplicate the scene into the nodes. if you wanted a 4up of the same content, youd duplicate the graph, which is very inefficient |
|
...that’s what Render to Image could get you, though. One graph/scene, multiple render targets / images. |
|
I’m also going to note this comment again, as it is me changing my mind without flagging it clearly.
The 2D-like QC default is good, but we shouldn’t hold that when changing FOV. I think the current implementation does. I think we just have to pick an arbitrary perspective sizing, i.e. with the camera at a set distance from the origin, what the “units” across (or up) at the origin is a set arc-angle striking the origin. Those set values would align with the default camera, i.e. QC default. |
|
just for clarity terms, today in Satin: *
internally theres some additional bullshit to make it work, but thats the gist. Today in Satin 1.0 as a forward renderer, theres typically a single pass with all layers. In Satin 2.0, to support additional features modern renderers support, we carve up layers into passes and render them / composite them as needed.
Render to Image does that in Satin 2.0 and for a single pass output a collection of images. Options for rendering multiple cameras as i see it is going to be governed by Satin's underlying paradigm:
from the Example MultipleViewportRenderer: Im not sure if theres any other obvious wins after doing a review of Satins rendering architecture tbh My feeling is a single active camera, but allow additional camera's to be placed in a scene.
This means no multi viewport shit, which it think is fine. |
|
I’m not so sour on Render to Image being capable of having multiple active cameras, as it feels to me quite natural that its ability to have multiple image outputs already expresses the requirement of cameras being paired to outputs without introducing new concepts or twisting existing ones. (I’m curious why it would be “very very expensive” – is that because it would require vertex amplification?) But, I also feel that’s a bonus feature we can happily push down the road. Similarly, if instead we wanted to expose viewport on a camera node, and have multiple active cameras, that’s something we can push down the road. All as long as whatever we chose now doesn’t hamper us with either of those directions. i.e. I agree – “no multi viewport shit”, perhaps not forever, but definitely not for now. I have a very strong design opinion on your last point though: a multiple camera system where one is managed to be active is the wrong abstraction. Conceptually, there is only one camera active at a time, and it can be instantaneously set to any spec. That is what the primitive should be, and the patching around it should be a way of “puppeting” where it should be etc. at any one moment. Practically, that means
The one place I see where that breaks down is switching between perspective and ortho cameras – I’m not sure if they are fundamentally different types in Satin, or whether it’s just a matter of transform matrices etc. |
|
From discussion on a call – Adopt the paradigm that a graph has a camera node as a fixed feature. i.e. you cannot add another, you cannot delete it. It might house other one-per-graph aspects such as clear colour. Rationale of that vs. a multiple-cameras-in-the-scene with some-new-means-to-make-one-exclusively-active in the post above. |
I like QC’s unit system of -1,+1 with square units. But which dimension? QC used width. FOV is typically calculated on height. It looks like in Fabric the perspective camera uses horizontal and orthographic camera uses vertical?
This PR adds
Sizing Dimensionto both cameras, so this can be adopted on a case-by-case basis. On a practical note, fixing height and extending width per aspect is really handy in performance contexts where you can design for a single 16:9 output, and output your 3D world in wider-and-wider-wide-screen by adding screens to the side. Oh, you’ll want to increase the field of view then too... so that’s now a perspective camera input too.Note - I’ve run out of time so this is currently untested! Will get back to this... at some unknown point soon.