Catalog npm
Back to packageRELEASE DETAILS

1.0.3

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.

Published30 Oct 2024
Direct dependencies25
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 25

Native requirements
25 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
three
Environment
{
  "local_name": "three",
  "alias": false,
  "peer_metadata": null
}
^0.169.0runtime
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
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
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
postcss
Environment
{
  "local_name": "postcss",
  "alias": false,
  "peer_metadata": null
}
^8.4.47development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^29.2.5development
@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
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.3.1development
rollup-plugin-dts
Environment
{
  "local_name": "rollup-plugin-dts",
  "alias": false,
  "peer_metadata": null
}
^6.1.1development
rollup-plugin-terser
Environment
{
  "local_name": "rollup-plugin-terser",
  "alias": false,
  "peer_metadata": null
}
^7.0.2development
rollup-plugin-postcss
Environment
{
  "local_name": "rollup-plugin-postcss",
  "alias": false,
  "peer_metadata": null
}
^4.0.2development
@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
rollup-plugin-peer-deps-external
Environment
{
  "local_name": "rollup-plugin-peer-deps-external",
  "alias": false,
  "peer_metadata": null
}
^2.2.4development
@ulb-darmstadt/photogrammetry-viewer
Environment
{
  "local_name": "@ulb-darmstadt/photogrammetry-viewer",
  "alias": false,
  "peer_metadata": null
}
github:BernhardWebstudio/photogrammetry-viewerdevelopment
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.3.1peer
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.3.1peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "6eee296fcfd11c8becffc232cf0469c1c05298ab",
  "tarball": "https://registry.npmjs.org/3d-specimen-viewer/-/3d-specimen-viewer-1.0.3.tgz",
  "fileCount": 37,
  "integrity": "sha512-KIITdNPBbZxRNTYR+Q/ip4XdQuvF0lC7PZlR2VPfl+ISvx80vUFlHZUkjhRyG+6CYAG3rQ/2Ucr5RGgwjqrLIA==",
  "signatures": [
    {
      "sig": "MEUCIGBmIZWCKiDTSY1b060WSrT2Gdg2my74nnAi5uh5HxXVAiEAwukIiOqRpmKyLFmJ2cFb4dUgUaYVJdPoewqT3wFfXUA=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 4856994
}

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:9a76ae9c5bcbb37025030fd3cb9897dd2333f045dc97f37748d7f2be6f1dd28e

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 →