immersive-web / immersive-web/model-element

Camera control via HTML

Open
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
86
Forks
12
Avg merge
7h 12m
Merged PRs (30d)
1

Description

Has a consideration been made to position a camera via HTML attributes or CSS?

Assume that you're attempting to render a series of 3D models from different views in a page. With the current proposed API the code would look as follows:

<model id="model-1" style="width: 400px; height: 300px">
    <source src="assets/example.glb" type="model/gltf-binary">
</model>
<script>
  document.querySelector("model-1").setCamera({
    pitch: 0,
    yaw: 0,
    scale: 1.5,
  })
</script>
<model id="model-2" style="width: 400px; height: 300px">
    <source src="assets/example.glb" type="model/gltf-binary">
</model>
<script>
  document.querySelector("model-2").setCamera({
    pitch: 30,
    yaw: 45,
    scale: 1.5,
  })
</script>

It should also be noted that since setCamera returns a promise that the action would not be immediate and so the developer may want to hide the model until the setCamera Promise is resolved making the implementation more complex.

Where maybe ideally it would look as follows:

<model camera="0deg 0deg 1.5" style="width: 400px; height: 300px">
    <source src="assets/example.glb" type="model/gltf-binary">
</model>
<model camera="30deg 45deg 1.5" style="width: 400px; height: 300px">
    <source src="assets/example.glb" type="model/gltf-binary">
</model>

Or an alternative would be to define initial camera settings via inline CSS. We already have the perspective css property which is sort of driving in that direction.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reviewing the proposed setCamera API and comparing the declarative camera attribute with the CSS alternative described here; done would require a settled design for initial camera settings and its effect on model loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.