IIIF / api

Source for API and model specifications documents (api and model)
http://iiif.io/api
105 stars 54 forks source link

Introduce Camera Class #2257

Open tomcrane opened 11 months ago

tomcrane commented 11 months ago

See https://github.com/IIIF/3d/issues/15#issuecomment-1589931301 from Napoli

The publisher will often (usually?) wish to indicate what the user / view is looking at when the Scene initializes. The publisher may also wish to provide additional specific views.

Cameras are added to the scene as annotations, just as model content resources are. They target a point.

The camera’s view is determined by two properties of the Camera class, lookAt and fieldOfView (split these into individual issues? Probably not, need to be considered together)

lookAt

(from Rob’s draft)

The property's value is either a Selector or a Model instance that has been annotated into the Scene with the camera. The Selector will describe a polygon or point within the Scene, such as a PointSelector instance that gives the x,y and z coordinates.

For the Model or polygonal Selector, the client should treat this as a PointSelector at the origin of the model or polygon. If the Model which the Camera is configured to look at is not, in fact, annotated into the Scene, then the client SHOULD treat it as if the lookAt property was not defined.

If not defined, then the client SHOULD calculate the bounding cube of all content in the Scene, and look at the origin (0,0,0) of that cube. If there are no contents in the Scene, the camera will look at the origin of the Scene itself.

fieldOfView

“defined as a floating point degree value similar to Three.js”

See https://threejs.org/docs/#api/en/cameras/PerspectiveCamera.fov

Camera Annotation Example

This shows two cameras in the Scene’s items property, as painting annotations:

"items": [
    {
        "id": "https://example.org/iiif/3d/anno1",
        "type": "Annotation",
        "motivation": [
            "painting"
        ],
        "body": {
            "type": "Camera",
            "lookAt": {
                "id": "https://example.org/iiif/selectors/1",
                "type": "PointSelector",
                "x": 0.0,
                "y": 0.0,
                "z": 0.0
            },
            "fieldOfView": 50.0
        },
        "target": [
            {
                "type": "SpecificResource",
                "source": [
                    {
                        "id": "https://example.org/iiif/scene1/page/p1/1",
                        "type": "Scene"
                    }
                ],
                "selector": [
                    {
                        "type": "PointSelector",
                        "x": 100.0,
                        "y": 100.0,
                        "z": 0.0
                    }
                ]
            }
        ]
    },
    {
        "id": "https://example.org/iiif/3d/anno1",
        "type": "Annotation",
        "motivation": [
            "painting"
        ],
        "body": {
            "type": "Camera",
            "lookAt": {
                "id": "https://example.org/iiif/3d-models/spaceman-1.obj",
                "type": "Model"
            },
            "fieldOfView": 35.0
        },
        "target": {..} // similar syntax as above
    }
]
azaroth42 commented 11 months ago

I think they're painted into the scene, as they're "of" the scene, rather than "about" the scene. Lights should be the same. Similarly, a model format that allows a camera to be part of the model would be a painting annotation ... and if a format allows a camera to be the ONLY thing in the model, that would be the equivalent of the above JSON.

mikeapp commented 11 months ago
tomcrane commented 8 months ago

Updated example with rotation:

The third annotation has no lookAt but has a position and a rotation. In this case, what is being rotated - where did it start?

{
  "items": [
    {
      "id": "https://example.org/iiif/3d/anno1",
      "type": "Annotation",
      "motivation": ["painting"],
      "body": {
        "type": "Camera",
        "lookAt": {
          "id": "https://example.org/iiif/selectors/1",
          "type": "PointSelector",
          "x": 0.0,
          "y": 0.0,
          "z": 0.0
        },
        "fieldOfView": 50.0
      },
      "target": [
        {
          "type": "SpecificResource",
          "source": [
            {
              "id": "https://example.org/iiif/scene1/page/p1/1",
              "type": "Scene"
            }
          ],
          "selector": [
            {
              "type": "PointSelector",
              "x": 100.0,
              "y": 100.0,
              "z": 0.0
            }
          ]
        }
      ]
    },
    {
      "id": "https://example.org/iiif/3d/anno1",
      "type": "Annotation",
      "motivation": ["painting"],
      "body": {
        "type": "Camera",
        "lookAt": {
          "id": "https://example.org/iiif/3d-models/spaceman-1.obj",
          "type": "Model"
        },
        "fieldOfView": 35.0
      },
      "target": [{ "// as above": "" }]
    },
    {
      "id": "https://example.org/iiif/3d/anno3",
      "type": "Annotation",
      "motivation": ["painting"],
      "body": {
        "type": "SpecificResource",
        "source": [
          {
            "id": "camera-sr-1",
            "type": "Camera",
            "fieldOfView": 65.0
          }
        ],
        "transforms": [
          {
            "type": "RotationTransform",
            "x": 0.0,
            "y": 90.0,
            "z": 0.0
          }
        ]
      },
      "target": [
        {
          "type": "SpecificResource",
          "source": [
            {
              "id": "https://example.org/iiif/scene1/page/p1/1",
              "type": "Scene"
            }
          ],
          "selector": [
            {
              "type": "PointSelector",
              "x": 100.0,
              "y": 100.0,
              "z": 0.0
            }
          ]
        }
      ]
    }
  ]
}
JulieWinchester commented 8 months ago

At the Basel working meeting on October 26, 2023, general consensus was present for the following:

JulieWinchester commented 7 months ago

Question arising from TSG meeting on November 15 2023: What happens (default expectation) when multiple camera annotations are present in a single manifest? Is it choice, or is it multiple viewports? This has implications on importing cameras from sub-manifests or scene files, if we were to possibly want to support somehow pulling those in?

azaroth42 commented 5 months ago

IMO:

tomcrane commented 5 months ago

Discussion:

Camera(s) are optional.

Where will the viewer put the camera if you don't provide one?

What is the initial state of a camera placed in the scene? What do you have to provide?

If we are rotating it what are we rotating it from?

Can we have a "show-all" - viewer works out where to put the camera to see everything in the scene.