Catalog npm
Back to packageRELEASE DETAILS

1.0.1

npm

3d-specimen-viewer

This is a React component library to visualise 3D models, with a focus on 3D models of various specimen from scientific collections.

Published29 Oct 2024
Direct dependencies20
Transitive dependenciesNot calculated

README

Current package documentation

3D Specimen Viewer

This is a React component library to visualize 3D models, with a focus on 3D models of various specimen from scientific collections.

Table of contents

Supported files

Currently, the following file-types as detected by extensions are supported:

  • gltf,
  • glb,
  • stl,
  • obj,
  • ply,
  • fbx,
  • p3v

wherein the p3v file type is a new one specific to this react component, see the this section for details; it supports using the https://github.com/ULB-Darmstadt/photogrammetry-viewer with only one file provided.

.p3v Files

The .p3v file-type is a custom file-type introduced by this component. The motivation for introducing a custom file-type is the limitation in various collection databases of uniquely associating files that belong together. Such a set of files belonging together is, for example, given for photogrammetry, where many 2D images come together to construct one 3D image.

The https://github.com/ULB-Darmstadt/photogrammetry-viewer is included as one of the viewers of this component. It allows to view the 3D image side-by-side with the source 2D images. As a consequence, it requires this full set of files.

This .p3v file-type is a zip compressed directory, which must contain

  • an .xml file, which will be used as the camera and scan information (at the moment, only the xml format from Agisoft is supported),
  • a .gltf or .glb file, which will be used as the source for the 3D viewer part,
  • and the 2D images used to produce the 3D file. These may be in any format and folder, in theory, and simply be consistent in their filenames with what the scan information xml provides. However, for performance reasons, and since it is possible that the files suggested by the xml are not unambiguous, we recommend having them in a folder called redof, with lowercase file extensions png or jpg
  • (optional) an image called hdr.png or hdr.jpg, which will be used as the sky-box image in the 3D-viewer

More files are allowed in the ZIP; however, they are simply ignored.

[!IMPORTANT] The first files with the respective file endings are used (for the xml and 3D files). Correspondingly, make sure no other files with the same ending are included in the package. Similarly, there should not be unrelated files with the same identifier as the 2D images.

Example

In minimum, an example file could be build like this:

minimal-example.zip.p3v

.
├── camera.xml
├── example-p3v-3dfile.glb
└── redof
    ├── image_000.jpg
    ├── image_001.jpg
    ├── image_002.jpg
    └── ...

the following would be valid just as well:

larger-example.zip.p3v

.
├── cameras.xml
├── CamPos.txt
├── Model
│   ├── example-p3v-3dfile.gltf
│   ├── example.psx
│   ├── example.mtl
│   ├── example.png
│   └── ...
└── images-2d
    ├── image_000.PNG
    ├── image_001.PNG
    ├── image_002.PNG
    └── ...

Nonetheless, we recommend to build the zip file in the minimum configuration, in order to reduce the filesize and therewith the loading times when displaying the .p3v file.

Other files

For completeness, this viewer also serves a small basis of additional files that are not concerned with 3d, such as images or video. The motivation here is to be a bit easygoing with collection databases employing this viewer in some way which is not guarding against calling it for other file types (Specify, for example, where access to the viewer could be implemented as a button (web-link) on the same level as any other asset; notably, one might consider integrating this React component into Specify, but that petition was unfortunately declined). Since the viewer's primary purpose is to be a 3d-viewer, these other file types shall not be documented further here.

Developer's Usage

Since this repository contains a React component, the following documentation is tailored towards developers and assumes basic knowledge of what you are doing.

Installation

yarn add 3d-specimen-viewer

or

npm i 3d-specimen-viewer

Usage

import { SpecimenViewer3D } from "3d-specimen-viewer";

// ...your react javascript code...

return (
  <your-react-jsx-code>
    <SpecimenViewer3D src="https://link.to/your/specimens-3d-file">
  <your-react-js-code>
)

Optionally, you may also pass the parameter fileName and/or fileType to help determine the type of 3D file specified.

Demo

This repository comes with a demo in ./3d-specimen-viewer-demo.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 20

Native requirements
20 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
unzipit
Environment
{
  "local_name": "unzipit",
  "alias": false,
  "peer_metadata": null
}
^1.4.3runtime
react-spinners
Environment
{
  "local_name": "react-spinners",
  "alias": false,
  "peer_metadata": null
}
^0.14.1runtime
react-3d-viewer
Environment
{
  "local_name": "react-3d-viewer",
  "alias": false,
  "peer_metadata": null
}
^1.0.12runtime
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.3.1runtime
styled-components
Environment
{
  "local_name": "styled-components",
  "alias": false,
  "peer_metadata": null
}
^6.1.13runtime
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^29.7.0development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.3.1development
tslib
Environment
{
  "local_name": "tslib",
  "alias": false,
  "peer_metadata": null
}
^2.8.0development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^4.24.1development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^29.2.5development
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.3.1development
@lit/react
Environment
{
  "local_name": "@lit/react",
  "alias": false,
  "peer_metadata": null
}
^1.0.6development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.6.3development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^29.5.14development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.3.12development
rollup-plugin-dts
Environment
{
  "local_name": "rollup-plugin-dts",
  "alias": false,
  "peer_metadata": null
}
^6.1.1development
@rollup/plugin-commonjs
Environment
{
  "local_name": "@rollup/plugin-commonjs",
  "alias": false,
  "peer_metadata": null
}
^28.0.1development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
^12.1.1development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^15.3.0development
@ulb-darmstadt/photogrammetry-viewer
Environment
{
  "local_name": "@ulb-darmstadt/photogrammetry-viewer",
  "alias": false,
  "peer_metadata": null
}
github:BernhardWebstudio/photogrammetry-viewerdevelopment

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "463126593bb09233307678c4cd10a7255be0a008",
  "tarball": "https://registry.npmjs.org/3d-specimen-viewer/-/3d-specimen-viewer-1.0.1.tgz",
  "fileCount": 22,
  "integrity": "sha512-/UQ4mrKOH+oHn3AdqtTSLKJlWpS46k4FyCT9SmDpwNAbuTJ0hDBkpFVuxTXb8O5LpYO/TWobGozj5uHErP4I4A==",
  "signatures": [
    {
      "sig": "MEUCIQDdBvjtOkj9nApvzbnD5HuLYtEoo36dVzJNDWKaPId14AIgEs7WieBlF6XFBPR7Fe2eYMOopvfehX9MQRNBLYxGrSs=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 6283071
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:37 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:e29779edbd47652cd456edc6e9083d7fbfa3d2df6cc89ef2937f3ed1139228ec

Other collected versions

2.0.825 May2.0.74 May2.0.618 Oct2.0.511 Oct2.0.43 Jun2.0.327 MayView all collected versions →