AlloSphere-Research-Group / allolib

Library for interactive multimedia application development
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

use of `nav().pullBack(16);` is confusing #24

Open kybr opened 5 years ago

kybr commented 5 years ago

this method (pullBack) separates Nav position from camera/viewer position. while the effect is interesting and useful, the name of the function is misleading and the effect is confusing. Nav position is camera/viewer position. that's the rules. please explain and justify using this method in user code.

grrrwaaa commented 5 years ago

Possibly unrelated to pullBack, but the assumption that camera pose and centre of navitation pose being the same doesn't hold.

Example: camera and navigation poses are frequently not the same in room-scale HMD settings, where it makes sense to consider the stereo camera(s) defined as offsets of the HMD pose (this must always be true to avoid nausea of course), whereas navigation in the virtual world may be relative either to the viewer's feet or to the center of the tracking space (depending on application needs). As a scene graph, one imagines each camera eye is a child of the HMD pose, which is a child of the navigation pose, which is (or is a child of) the tracking centre pose, which is a child of the world.

Another common example would be a 3rd person perspective in a character-driven game, where the camera is conceptually on a "boom" behind and above the character location, but navigation is remains centred in the character itself. Maybe this is what pullBack is about?

Sorry for the noise if I've misunderstood the situation.

kybr commented 5 years ago

i do not think you are misunderstanding; your points are taken. of course camera position is different than viewer position for practical and aesthetic reasons. (GTA San Andreas comes to mind.)

all the AlloSphere content I can think of at the moment holds the navigator and the viewer at (or very very near) the same spot. i don't think this should be a rule, but it might easily be construed to be a rule given the history of content.

the camera is conceptually on a "boom" behind and above the character is exactly what pullBack implies. that's the only thing it could mean. however, without an avatar or some object at the navigation point, it breaks from this concept. in practice, the effect of pullBack is that of switching from a sane nav=cam world that we fly around in to a world where....

if i only use the mouse, it appears that we (nav and camera) are stationary and mouse drags rotate scene as 3D model viewing software might turn an object around[1]. BUT as soon as i use ASDW-style navigation keys my brain melts because nothing works the way i expect. just go try examples/graphics/platonics.cpp to see that i mean. in my opinion, that example is ruined by that one call to pullBack. by ruined, i mean that i cannot in good conscience recommend it to students.

i suspect that [1] is the unintended and sometimes pleasing effect that callers/authors of pullBack enjoy, but they should think again.

please do one or more of these:

younkhg commented 5 years ago

In addition to Graham's point, Pullback also helps when you want different lens effect. With pullback, one can do something like 'almost ortho' or 'want narrow field of view perspective but have wider frustum near viewpoint'.

The weird navigation effect can be eliminated if near plane of the lens is set to be larger than pullback. The code will be something like: nav().pullBack(16); lens().near(16.1).far(100);

Still it is an confusing functionality and an example being there will definitely help

LancePutnam commented 5 years ago

The intended effect of pullBack is to place the camera a positive distance along the back vector of the navigator. This greatly simplifies scenarios where you just want to quickly look around an object as if using a modeling program. Otherwise, doing so requires very skilled FPS-like (as in circling an enemy) input. Many of my students (or generally speaking, non-gamers) struggle with this kind of input before pullBack. Also, it is not intended to be an aesthetic effect and drawing an avatar when pullBack is active will occlude the object you want to look at. (Transparency might help, but then who's responsible for drawing the avatar?) When pullBack is used is context dependent. It is not appropriate in contexts where one is expected to navigate around in a 3D world first-person style and therefore shouldn't be used in any of those types of examples.

I suspect the confusion arises from the fact that pullBack separates navigator and camera. Maybe there is a better model for viewing/navigation like having separate Nav and Cam classes and a (simplified) scene graph. However, that will likely complicate the API and control mappings. Does Nav have a Cam? Are there separate control mappings for Cam? Are AlloSystem users expected to know the difference between Nav and Cam? (IMO, yes.)