opt-rapid3d-loader
v1.0.0
Published
OptRapid3dLoader for Three.js.
Readme
Welcome to OptRapid3dLoader for Three.js
I. Components of OptRapid3dLoader for Three.js
OptRapid3dLoader for Three.js consists of two parts:
- OptFileGenerator:
- A local 3D/BIM model conversion and processing software that runs on Windows desktop.
- Responsible for "producing"
.optformat model geometry files and.dbformat model data files that support high-performance rendering. - We also provide SDK packages in service form to meet customers' software integration application scenarios.
- Pricing: In the OptFileGenerator software, we charge based on model conversion volume, which is calculated as the original model size multiplied by a multiplier (e.g.,
.rvtformat models have a multiplier of 1, while.nwdformat models have a multiplier of 10).
- OptRapid3dLoader for Three.js npm package:
- Responsible for "consuming" generated
.optfiles. - Achieving high-performance 3D/BIM model loading and rendering on the web under the Three.js framework.
- You can freely download and distribute, and share this npm package for learning, evaluation or use in commercial projects.
- Responsible for "consuming" generated
II. Advantages of OptRapid3dLoader for Three.js
Compared to native Three.js, OptRapid3dLoader for Three.js offers the following advantages:
1. Supports Multiple 3D/BIM Model Formats with 9 Dedicated Export Plugins, No Geometry or Data Loss
To completely solve the industry problem of "3D model components or attribute loss" caused by other ODA-based solutions, we specifically developed 9 dedicated export plugins for Revit, Bentley, Tekla, Rhino, Navisworks, SolidWorks, Inventor, Siemens NX, and PTC Creo.
- No Data Loss: Not only geometric shapes, but also materials, textures, hierarchical structures, and key 3D/BIM model structural attribute data can be extracted without loss.
- Broad Support: We provide perfect support for mainstream 3D model formats including
skp,ifc,3dxml,fbx,dae,stp,step,stl,iges,rvm,vue, andobj. - Industry Coverage: Whether you work in shipbuilding, marine engineering, aerospace, energy power, petrochemicals, advanced manufacturing, traditional manufacturing, smart cities, or architectural design, you can find the corresponding "key".
2. Ultra-optimized 3D/BIM Model Lightweight Processing Technology
To achieve high-performance rendering on the web, during the 3D/BIM model lightweight conversion and processing phase, we comprehensively adopt multiple technical solutions:
- High-performance floating-point compression.
- Scene component instantiation/parameterization compression.
- Automatic face reduction and redundant data removal while maintaining geometric precision.
- Model material merging and texture compression.
- LOD multi-level data construction and coarse/fine model automatic generation.
- High-performance Draco compression.
3. Over 10x Faster 3D/BIM Model Loading Speed Than Native
OptRapid3DLoader is optimized at the underlying graphics level, which goes beyond code-level streamlining to complete reconstruction of the rendering pipeline.
- Multi-worker Queue: Significantly reducing the time for 3D models to download from servers to local web browsers.
- Chunk Rendering: Breaking down large scene graphs into manageable rendering units, greatly reducing Draw Call overhead.
- Instanced Rendering: Pushing the rendering efficiency of repeated components to the limit.
- Frustum Culling: Browsers no longer waste even a single pixel rendering objects outside the field of view.
- LOD Strategy: For ultra-large models at the 10GB level, we adopt a LOD strategy combining hierarchical loading with coarse/fine model replacement. The system intelligently judges camera distance, dynamically scheduling different precision model resource loading and replacement.
4. Achieves One-to-One Correspondence Between 3D/BIM Model Geometry and Attribute Data
During lightweight conversion processing, we extract all professional structures and attribute data (such as component IDs, hierarchical relationships, professional attributes) intact and generate .db format model data files stored locally on the user's device.
- The complete table structure and field descriptions of this DB file are fully disclosed.
- Developers can obtain component IDs through calling OptRapid3dLoader's basic interface and retrieve corresponding structural attribute data from the DB file based on component IDs.
5. Freely Expandable Development with Seamless Three.js Integration
OptRapid3DLoader provides a set of basic interaction interfaces, including component picking, coloring, transparency control, show/hide, displacement, rotation, outline highlighting. These commonly used interactive functions are encapsulated into simple APIs for developers to call.
Installation
Install using npm:
npm install opt-rapid3d-loaderQuick Start
import { Scene, WebGLRenderer, PerspectiveCamera, AmbientLight, DirectionalLight, Color, Vector2, Vector3 } from 'three';
import OptRapid3dLoader from 'opt-rapid3d-loader';
const scene = new Scene();
scene.background = new Color(0x87CEFA);
const renderer = new WebGLRenderer({ antialias: true, logarithmicDepthBuffer: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById("container").appendChild(renderer.domElement);
const camera = new PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 100, 150);
camera.lookAt(0, 0, 0);
const ambientLight = new AmbientLight(0xffffff, 2.0);
scene.add(ambientLight);
const mainLight = new DirectionalLight(0xffffff, 1.0);
mainLight.position.set(5, 10, 7);
scene.add(mainLight);
const loader = new OptRapid3dLoader({
renderer: renderer,
camera: camera,
parent: scene,
libs: './libs', // Directory path corresponding to your three version's libs directory, plugin depends on draco and basis parsers in libs directory
url: "http://192.168.1.200/bim/house_opt/root.opt",
callback: () => {
console.log("Loading completed!");
}
});
function animate() {
requestAnimationFrame(animate);
loader.interface.update(); // Update function needs to be triggered for each loader instance here
renderer.render(scene, camera);
}
animate();API Documentation
Constructor new OptRapid3dLoader(options)
Creates an OptRapid3dLoader instance.
| Parameter | Type | Description |
| :--- | :--- | :--- |
| renderer | WebGLRenderer | Three.js renderer instance |
| camera | Camera | Three.js camera |
| parent | Scene/Group | Three.js container |
| libs | String | Decoder file directory path. If not provided, will default to public CDN: https://unpkg.com/[email protected]/examples/jsm/libs |
| url | String | Path to opt data format exported using dedicated export plugin |
| callback | Function | Model loading completion callback function |
Interaction Interface (Interface)
OptRapid3dLoader provides a powerful interface object for interacting with and controlling specific components in the model. All operations are asynchronous, please use with await.
Component Picking (Pick)
Pick component information in the scene through screen coordinates.
const json = await loader.interface.pick({ position: new Vector2(x, y) });- position (
Vector2): Screen pixel coordinates, typically corresponding to mouse click event'sclientXandclientY. - Return:
Promise<Object | null>, containing component ID and other information.
Set Color (SetColor)
Modify the color of specified components.
await loader.interface.setColor({ featureIds: json.id, type: 0, color: "rgb(255, 255, 0)" });- featureIds (
String): Target component ID, supports batch operations (e.g.,1111#2222). - type (
Number): Coloring type,0is mixing,1is replacement. - color (
String): CSS format color value.
Set Visibility (SetVisible)
Control component display or hide state.
await loader.interface.setVisible({ featureIds: json.id, visible: false });- visible (
Boolean):truefor show,falsefor hide.
Set Alpha (SetAlpha)
Adjust component transparency and color.
await loader.interface.setAlpha({ featureIds: json.id, color: "rgb(255, 0, 0)", alpha: 0.3 });- alpha (
Number): Transparency value, range 0.0 to 1.0.
Component Offset (Offset)
Translate component position.
await loader.interface.offset({ featureIds: json.id, x: 10, y: 10, z: 0 });Clear Offset (ClearOffset)
Reset component position offset, restore original position.
await loader.interface.clearOffset({ featureIds: json.id });Component Rotation (Rotate)
Apply rotation transformation to component.
await loader.interface.rotate({ featureIds: json.id, angle: 30 });- angle (
Number): Rotation angle.
Clear Rotation (ClearRotate)
Reset component rotation state, restore original angle.
await loader.interface.clearRotate({ featureIds: json.id });Component Zoom To (ZoomTo)
Automatically adjust camera view to focus on specified component.
await loader.interface.zoomTo({ featureIds: json.id });Other Methods
loader.interface.update();// Loader updateloader.interface.dispose();// Loader disposal
Try Now
Please visit: https://www.opt3ds.com/ Download: OPTFileGenerator (windows 64bit)
License Agreement
OptRapid3dLoader for Three.js End User License Agreement (EULA)
This End User License Agreement ("Agreement") is a legal agreement between you (either an individual or a single entity) and 3DExpert Co.,Ltd. ("3DExpert", "we", "us", or "our") regarding your use of the OptRapid3dLoader for Three.js software, including the JavaScript library ("Loader JS Package"), the Desktop EXE application, the SDK Service (collectively, the "Software"), and any associated documentation, updates, or services. By installing, copying, accessing, or otherwise using the Software, you agree to be bound by the terms of this Agreement. If you do not agree to the terms of this Agreement, do not install or use the Software.
Grant of License Subject to your compliance with this Agreement and payment of applicable fees, We grants you a non-exclusive, revocable, worldwide license to:
- Use the Desktop EXE and SDK Service solely for the purpose of processing and lightweighting 3D/BIM models on your local device. The Desktop EXE and SDK Service are provided free of charge for installation and use; however, you agree to pay the fees based on the 3D/BIM models size of the processing and lightweighting, as specified in We pricing policy.
- Use the Loader JS Package free of charge to render the lightweighted 3D/BIM models processed by the Desktop EXE or SDK Service within web applications built on the Three.js framework (.opt file).
- Distribute the Loader JS Package as part of your web application, provided that you may, at your option, retain or exclude all copyright notices.
Ownership and Intellectual Property The Software, including its code, structure, organization, and documentation, is the proprietary property of 3DExpert and is protected by copyright laws and international treaty provisions. All rights not expressly granted herein are reserved by 3DExpert. The Three.js framework is a third-party open-source library, your use of Three.js is governed by its own license terms, which are independent of this Agreement.
Data and Privacy OptRapid3dLoader for Three.js is designed to operate in a client-side environment. The Software does not collect, transmit, or store any user data, model files, or personally identifiable information on our servers. All model processing and rendering occur locally on the user's device. By using the Software, you acknowledge that you are solely responsible for the data processed through the Software and for complying with applicable data protection laws (including but not limited to GDPR, CCPA, and other regional regulations) in your jurisdiction.
Limitation of Liability TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, WE PROVIDES THE SOFTWARE "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. OPT DOES NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED, ERROR-FREE, OR SECURE, OR THAT DEFECTS WILL BE CORRECTED. YOU ASSUME ALL RISKS ASSOCIATED WITH THE USE OF THE SOFTWARE. IN NO EVENT SHALL OPT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS, DATA, OR BUSINESS INTERRUPTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. OUR TOTAL LIABILITY TO YOU FOR ALL CLAIMS ARISING UNDER THIS AGREEMENT SHALL NOT EXCEED THE AMOUNT PAID BY YOU FOR THE LIGHTWEIGHTED MODELS IN THE SIX (6) MONTHS PRECEDING THE CLAIM.
Termination This Agreement is effective until terminated. Your rights under this Agreement will terminate automatically without notice from us if you fail to comply with any term of this Agreement. Upon termination, you must cease all use of the Software and destroy all copies, full or partial, of the Software in your possession or control.
Governing Law and Jurisdiction This Agreement shall be governed by and construed in accordance with the laws of Japan, without regard to its conflict of laws principles. Any legal action or proceeding arising under this Agreement will be brought exclusively in the courts located in Osaka, Japan, and the parties hereby consent to personal jurisdiction and venue therein.
Export Control You acknowledge that the Software may be subject to export control laws and regulations of Japan and other jurisdictions. You agree to comply with all applicable export and re-export restrictions, including but not limited to those administered by the Japanese Ministry of Economy, Trade and Industry (METI).
Miscellaneous This Agreement constitutes the entire agreement between you and we regarding the subject matter hereof and supersedes all prior or contemporaneous agreements, representations, warranties, and understandings, whether written or oral. If any provision of this Agreement is held to be invalid or unenforceable, the remaining provisions shall remain in full force and effect. We may update this Agreement from time to time; your continued use of the Software after such updates constitutes acceptance of the revised terms. By using the Software, you represent and warrant that you have the authority to enter into this Agreement and that you are at least 18 years of age.
Contact Us
3DExpert Co.,Ltd. Registered Address: 4F Thera Projects, 2-4 Komatsubara-cho, Kita-ku, Osaka, Osaka, Japan Email: [email protected]
Japan Corporate Number:1200-01-271788
Technical Services
We can only provide you with technical documentation and email-level technical support services; the technical support service hours are Monday to Friday, Tokyo time 9:00 AM - 6:00 PM.
- Please note: Technical support services are not available on Japanese national holidays.
- Technical support email: [email protected]
Note: This project includes the 3DTilesRendererJS component from NASA AMMOS, which is licensed under the Apache 2.0 License. See THIRD-PARTY-NOTICES.md for details.
