npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

3d-specimen-viewer

v1.1.0

Published

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

Downloads

105

Readme

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>
)

Demo

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