nudibranchrecords / hedron

Perform live shows with your three.js creations
GNU Affero General Public License v3.0
480 stars 22 forks source link

Multi-camera control #460

Open funwithtriangles opened 1 month ago

funwithtriangles commented 1 month ago

In the old version of Hedron, there is only one camera per scene. Sketches must take control of the same camera, often leading to conflicts. Two sketches might be trying to reposition the camera every frame.

Let's look at an example. We have a scene with three GLB alien models dancing in a room. The scene has a main camera control sketch, and another three sketches (one for each dancer). The user wants to be able to switch between a main overview shot and close ups of each dancer. Each dancer has a camera attached to it (maybe deep inside the model hierarchy, e.g. tracked to the head of the dancer).

How to do it in the old version of Hedron (v0.6.0) This is probably possible but tricky! For each sketch that controls the camera we need to have some way of re-adding the camera to whatever object is needed (e.g. the main scene or the head of a dancer). Probably possible with a shot to do this, but might also need some flag variable so each sketch knows when to control the camera. A huge pain!

Idea for how to do it with the new version Allowing for multiple cameras within a scene is clearly the right way to go. Sketches could "register" their cameras that then appear in the UI on a scene panel. The panel lets you switch between cameras individually with controls to also rotate through the list with one button, all MIDI mappable. Perhaps only switching is permitted, any other camera control (e.g. movement) is still kept as part of the sketch params.

funwithtriangles commented 1 month ago

Basic camera cycling could be done with this feature, but creating groups of cameras to cycle through might be a good use case for a plugin

cale-bradbury commented 1 month ago

Another option here could be some form of meta-sketch that you can register other existing sketches in the scene.

ie; an orbit camera controller with params for distance, y angle, x/z angle, shots to cycle the current target, and like a multi-select dropdown to choose which sketches it can target (maybe a trigger to select/deselect all).

Regardless support for more than 1 camera might still be good, but maybe it overcomplicated things and should just be 1 camera per scene

cale-bradbury commented 1 month ago

Immediately after posting I thought of wanting multiple targets that are sub-objects of a single sketch, feel like the meta sketch thing falls apart there unless we allow for access to the entire scene hierarchy, but that adds questions about when things get dynamically added/removed :/

funwithtriangles commented 1 month ago

I think this sort of relates to the child sketches idea. Where you could register a container in a sketch that accepts other sketches as a child.

Giving multiple strategies to users to solve problems makes sense and sometimes ya just gotta have a weird solution for your weird requirements. For example I've managed to get this multi camera thing working in old hedron by just looking up the models in the scene from a camera sketch and moving the camera to the bones of each sketch via a shot. However this is still quite hacky and would have been much easier if we had built in multi camera support.