Mark Ku's Blog
Podcast ConversationAI dialogue version of this article · Mandarin audio
Audio for this article is powered by VoAIVoAI

Context

Our competitor, maingear, launched a 3D Configurator, so I spent some time researching 3D technology.

First, Solving the 3D File Format Problem

I got the 3D model file for our company's computer case from the product designer. It was a STEP file, so I started by learning about common web-friendly formats.

When it comes to 3D product showcases, we need to understand the differences between the two main formats: GLB and GLTF (From ChatGPT)

GLB and GLTF are two formats used to represent 3D models, primarily for 3D graphics and virtual reality. Both are based on the glTF (GL Transmission Format), but there are some differences between them:

File Structure: GLB: This is a binary file format where all data (including textures, meshes, etc.) is stored in a single binary file. This makes the file smaller and faster to load. GLTF: This is a JSON-based format that can store textures, meshes, etc., in separate binary files or embed them directly into the JSON. Compared to GLB, the GLTF file structure can be more flexible but also more complex. Readability:

GLB: Being a binary format, GLB files are not easily human-readable or editable. GLTF: Being JSON-based, GLTF files are easier to read and edit. Developers can open and modify them with a regular text editor. Use Cases:

GLB: Suitable for scenarios requiring fast loading and efficient performance, such as real-time 3D applications. GLTF: Due to its readability and flexibility, it's suitable for development and debugging. File Size:

GLB: Usually smaller than GLTF because it packs all data into a single binary file. GLTF: Can be relatively larger, especially when textures and other resources are embedded in the JSON. In summary, both GLB and GLTF have their own advantages and use cases. GLB is better for performance-sensitive applications, while GLTF is more suitable for situations that require readability and editability. During the development phase, you might choose to use GLTF for iteration and debugging, then convert to GLB for the production stage to improve performance.

Our company only has two SolidWorks licenses, and the designers are very busy. I felt bad bothering them frequently, so I looked for some tools to convert 3D models myself.

Vectary Online Tool Conversion requires payment, but there's a free trial for a few days.

Why choose Vectary? There are many 3D conversion tools to choose from, but I chose Vectary because of its intuitive interface and simple import/export features. Additionally, Vectary has rich tutorial resources that helped me get started quickly. With this tool, I could easily convert SolidWorks files into web-supported formats.

Blender (Open Source) + Stepper Plugin (Paid)

Next, Converting the 3D Model into a React Component

npm i gltfjsx -g
npx gltfjsx <glTF model source file>

GLB

As mentioned earlier, gltfjsx is better for adjustments during the product phase, but GLB files are smaller, making them more suitable for the final production deployment.

npm i gltf-pipeline -g
gltf-pipeline -i scene.gltf -o scene.glb 

Since 3D models are often large, which leads to a poor user experience, you can use gltf-pipeline to set a compression level when exporting to GLB.

gltf-pipeline -i <source file> -o <output file> --draco.compressionLevel=10
gltf-pipeline -i scene.gltf -o mother-board.glb

At this point, we have the necessary files to create a 3D product showcase. Following this blog post, we can build our 3D product display.

3D render of an open PC case with motherboard, graphics card, fan
3D render of an open PC case with motherboard, graphics card, fan

Advanced Applications

  • Adding other computer components
  • Fan animations
  • Applying textures
  • Color changing functionality
  • Loading animation while the model loads (component loading animation)
  • Product feature tooltips (part's hint)
  • Material glow effects (bloom, emissive)
  • Scene setup

Debugging Tip: Bind a click event to a group to log which object was clicked.

  <group            
      https://hackmd.io/onPointerMissed={() => (state.current = null)}
      onPointerDown={(e) => (
        e.stopPropagation(), (state.current = e.object.material.name)
      )}
    >

Crashes on Mobile Devices

My own phone isn't very powerful. The motherboard model from the original manufacturer had too much detail and complexity, causing it to crash easily on load. Every circle is composed of many triangles, which requires a 3D designer to perform topology optimization to reduce the triangle count. If we want to build a 3D product configurator in the future, every motherboard or other component will need a 3D designer's help, even for manually reducing details. This means we would need a dedicated in-house or freelance 3D designer.

3D on the iPhone currently has significant limitations. iOS itself imposes a memory limit of 384 MB on Safari. Exceeding this will also cause the page to refresh.

3D model of a green computer motherboard with componentsWireframe 3D model of a circuit board with circular connectors

If you are using Next.js and everything works fine during local debugging, but you get a "next js application error a client-side exception has occurred" message in production, you need to switch to client-side rendering. The server cannot render 3D components.

In Conclusion

Rendered computer case showing motherboard, GPU, and red fan Demo
As technology evolves, online 3D web model showcases and 3D product configurators will become more widespread. It's crucial for developers to understand and master these technologies. After all, only by keeping up with the times can we provide the best user experience for our customers.

Although Web 3D still has some limitations—such as slow network speeds, large 3D model sizes, insufficient support for certain effects and materials on iOS, and high demands on mobile performance and memory—we can expect to see more applications implemented in 3D as technology and infrastructure improve.

References

Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference
Reference

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··490

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··333

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··264

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··221

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··215

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11