|
|
il y a 2 ans | |
|---|---|---|
| .github/workflows | il y a 2 ans | |
| .idea | il y a 3 ans | |
| examples | il y a 2 ans | |
| plugins | il y a 2 ans | |
| scripts | il y a 2 ans | |
| src | il y a 2 ans | |
| .eslintignore | il y a 3 ans | |
| .eslintrc.cjs | il y a 2 ans | |
| .gitignore | il y a 3 ans | |
| .npmignore | il y a 3 ans | |
| LICENSE | il y a 2 ans | |
| NOTICE | il y a 2 ans | |
| README.md | il y a 2 ans | |
| package-lock.json | il y a 2 ans | |
| package.json | il y a 2 ans | |
| rollup.config.mjs | il y a 2 ans | |
| tsconfig.json | il y a 2 ans | |
| typedoc.json | il y a 2 ans | |
A new way to work with three.js, 3D models and rendering on the web.
ThreePipe — Github — Examples — API Reference — WebGi
ThreePipe is a 3D framework built on top of three.js in TypeScript with a focus on rendering quality, modularity and extensibility.
Key features include:
Code samples and demos covering various usecases and test are present in the examples folder.
Try them: https://threepipe.org/examples/
View the source code by pressing the code button on the top left of the example page.
To make changes and run the example, click on the CodePen button on the top right of the source code.
npm install threepipe
First, create a canvas element in your HTML page:
<canvas id="three-canvas" style="width: 800px; height: 600px;"></canvas>
Then, import the viewer and create a new instance:
import {ThreeViewer, IObject3D} from 'threepipe'
// Create a viewer
const viewer = new ThreeViewer({canvas: document.getElementById('three-canvas') as HTMLCanvasElement})
// Load an environment map
await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
// Load a model
const result = await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', {
autoCenter: true,
autoScale: true,
})
That’s it! You should now see a 3D model on your page.
The 3D model can be opened in the editor to view and edit the scene settings, objects, materials, lights, cameras, post-processing, etc. and exported as a GLB file. All settings are automatically serialized and saved in the GLB file, which can be loaded into the viewer. Any plugins used in the editor can be added to the viewer to add the same functionality. The plugin data is automatically loaded(if the plugin is added) when the model is added to the scene.
The viewer initializes with a Scene, Camera, Camera controls(Orbit Controls), several importers, exporters and a default rendering pipeline. Additional functionality can be added with plugins.
Check out the GLTF Load example to see it in action or to check the JS equivalent code: https://threepipe.org/examples/gltf-load/
Check out the Plugins section below to learn how to add additional functionality to the viewer.
The core framework(src, dist, examples folders) and any plugins without a separate license are under the Apache 2.0 license.
Some plugins(in the plugins folder) might have different licenses. Check the individual plugin documentation and the source folder/files for more details.
The project is in alpha stage and under active development. Many features will be added but the core API will not change significantly in future releases.
Check out WebGi for an advanced tailor-made solution for e-commerce, jewelry, automobile, apparel, furniture etc.
Check the list of all functions, classes and types in the API Reference Docs.
Check out WebGi - Premium Photo-realistic 3D rendering framework and tools for web applications and online commerce along with custom modules and rendering solutions for e-commerce, jewelry, automobile, apparel, furniture and other retail applications.
Contributions to ThreePipe are welcome and encouraged! Feel free to open issues and pull requests on the GitHub repository.
ThreePipe Asset Manager supports the import of following file formats out of the box:
Additional formats can be added by plugins:
ThreePipe has a simple plugin system that allows you to easily add new features to the viewer. Plugins can be added to the viewer using the addPlugin and addPluginSync methods. The plugin system is designed to be modular and extensible. Plugins can be added to the viewer at any time and can be removed using the removePlugin and removePluginSync methods.
todo: image
Example: https://threepipe.org/examples/#depth-buffer-plugin/
Source Code: src/plugins/pipeline/DepthBufferPlugin.ts
Depth Buffer Plugin adds a pre-render pass to the render manager and renders a depth buffer to a target. The render target can be accessed by other plugins throughout the rendering pipeline to create effects like depth of field, SSAO, SSR, etc.
import {ThreeViewer, DepthBufferPlugin} from 'threepipe'
const viewer = new ThreeViewer({...})
const depthPlugin = viewer.addPluginSync(new DepthBufferPlugin(HalfFloatType))
const depthTarget = depthPlugin.target;
// Use the depth target by accesing `depthTarget.texture`.
The depth values are based on camera near far values, which are controlled automatically by the viewer. To manually specify near, far values and limits, it can be set in the camera userData. Check the example for more details.
todo: image
Example: https://threepipe.org/examples/#normal-buffer-plugin/
Source Code: src/plugins/pipeline/NormalBufferPlugin.ts
Normal Buffer Plugin adds a pre-render pass to the render manager and renders a normal buffer to a target. The render target can be accessed by other plugins throughout the rendering pipeline to create effects like SSAO, SSR, etc.
Note: Use DepthNormalBufferPlugin if using both DepthBufferPlugin and NormalBufferPlugin to render both depth and normal buffers in a single pass.
import {ThreeViewer, NormalBufferPlugin} from 'threepipe'
const viewer = new ThreeViewer({...})
const normalPlugin = viewer.addPluginSync(new NormalBufferPlugin())
const normalTarget = normalPlugin.target;
// Use the normal target by accessing `normalTarget.texture`.
todo
todo: image
Example: https://threepipe.org/examples/#render-target-preview/
Source Code: src/plugins/ui/RenderTargetPreviewPlugin.ts
RenderTargetPreviewPlugin is a useful development and debugging plugin that renders any registered render-target to the screen in small collapsable panels.
import {ThreeViewer, RenderTargetPreviewPlugin, NormalBufferPlugin} from 'threepipe'
const viewer = new ThreeViewer({...})
const normalPlugin = viewer.addPluginSync(new NormalBufferPlugin(HalfFloatType))
const previewPlugin = viewer.addPluginSync(new RenderTargetPreviewPlugin())
// Show the normal buffer in a panel
previewPlugin.addTarget(()=>normalPlugin.target, 'normal', false, false)
Example: https://threepipe.org/examples/#rhino3dm-load/
Source Code: src/plugins/import/Rhino3dmLoadPlugin.ts
Adds support for loading .3dm files generated by Rhino 3D. This plugin includes some changes with how 3dm files are loaded in three.js. The changes are around loading layer and primitive properties when set as reference in the 3dm files.