What is the best method for converting an ASCII JSON 3D model file into binary format?

As I delved into various webGL examples, particularly those based on Three.js, I came across a fascinating method of loading large models using a combination of ASCII and binary JSON. This technique caught my attention due to the significant reduction in file size. The structure of the ASCII JSON is similar to the following (taken from a Three.js example, webgl_geometry_large_mesh.html):

{
    "metadata" :
    {
        "formatVersion" : 3,
        "sourceFile"    : "lucy100k.obj",
        "generatedBy"   : "OBJConverter",
        "vertices"      : 50002,
        "faces"         : 100000,
        "normals"       : 0,
        "uvs"           : 0,
        "materials"     : 0
    },

    "materials": [  {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "default"
    }],

    "buffers": "Lucy100k_bin.bin"
}

The snippet reveals that instead of inundating the main file with an excessive amount of vertices, normals, UVs, etc., all the data is packed into a separate binary file. Are you aware of how to create this binary file? Can it be done through Blender? If not, are there any scripts available for this purpose?

Thank you

Answer №1

As per the information in this line:

"generatedBy"   : "OBJConverter"

The mentioned file was created using OBJConverter (from a combination of .obj and .mtl files).

OBJConverter refers to a Python script known as convert_obj_three.py located in

three.js / utils / converters / obj
.

This particular script contains guidance on "How to obtain accurate OBJ + MTL files with Blender".

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Background Patterns on Webpages

My website has a lovely gradient background on the html tag in css, while the body tag showcases a seamless pattern repeating on both the x and y axes. Everything was looking great until I checked the website on an iPad/iPhone in portrait mode, where the ...

Utilizing logic classes in conjunction with styled components

I am seeking a way to utilize this logic in order to assign the appropriate class to an element: <ul onClick={handleClick} className={click ? 'dropdown-menu clicked' : 'dropdown-menu'}> However, as I am employing styled component ...

Transforming a Laravel collection of arrays into a JSON object containing an array

In my Laravel API, I am creating an array of categories and subcategories for use in the client-side application. To achieve this, I am utilizing the collection's filter and map methods to structure the data fetched from the database: // Retrieve da ...

Cloud function -> time stamps evaluation

I've been working on a cloud function to delete items in the "links" collection that have an end time older than the current timestamp. Although my function runs without any errors, it's not deleting the items as expected and is causing me quite ...

Creating dynamic "floating divs" with consistent width but varying heights, alignment challenge

Seeking assistance to solve the following challenge: Description of Issue: We are dealing with dynamically generated "floating divs" that have equal width but varying heights based on their content. The "Parent container" will have different width parame ...

Issue with custom directive - bi-directional binding not functioning as expected

I'm currently working on creating a custom directive in Angular that transforms a tag into a toggle button, similar to a checkbox. As of now, the code I've developed updates the internal variable within isolated scope, but bidirectional binding ...

Can we use JSON to effectively compare various variables?

My current task involves comparing running services before and after a reboot on Linux servers. However, I am facing difficulty in getting the output to display the differences. The function I have right now saves the pre/post state to disk. Ideally, I wo ...

The most effective method for verifying a user's login status using node.js and express and updating the client-side HTML

For my web application, I am using node.js and express along with sessions in mongoDB to handle server side code like this: exports.home = function(req, res){ if(req.session.userEnabled){ console.log("logged"); res.render('home', { title ...

Preventing Vue.js SPA from accessing cached version when JWT expires: the solution

I'm encountering an issue with my Vue.js / Express application that I can't seem to resolve. Here's how the process unfolds: An unauthenticated user logs into the app and is presented with the login page. Once successfully authenticated, t ...

What is the best way to retrieve the reference value from a dropdown box and pass it to another component?

Currently, I am in the process of creating a chat application using socket.io. Within this application, there is a dashboard component that consists of two child components known as Room.js and Chat.js. The Room component serves the purpose of selecting th ...

Vanilla JavaScript - Conceal all remaining div elements

I have a situation where multiple divs are only visible after clicking a link. How can I ensure that when one div is clicked, all others are closed so that only the clicked one remains visible? Currently, I am using the following JavaScript: functio ...

stream a song with a font awesome symbol

Can an audio track be played using a font awesome icon, such as displaying the song name (mp3) with a play icon right next to it? When users click on the play icon, can the track start playing and be paused or stopped at will? The list will consist of app ...

Is there a way to verify whether a user is currently logged in? (Using everyauth in node.js)

Previously, I relied on client-side auth for my application. Recently, I integrated server-side everyauth and it's functioning well. However, I'm unsure how to perform a function similar to FB.getLoginStatus (which I used in the client-side) when ...

Delivery person receiving biscuit but my internet browser doesn't seem to be getting it when I attempt to retrieve it

Currently, I am in the process of creating a website using Flask and React. The user is required to input an email and password on a form, which is then sent via axios.post to the backend. The backend checks if the email and password match with the databas ...

Utilizing Jquery tabs for consistent height display

Currently, I am utilizing jquery tabs for showcasing various content. This is what my functions look like: $(function() { $( "#tabs" ).tabs(); }); I attempted to ensure all tabs have the same height by using this approach: var heightStyle = ...

Troubleshooting problem with Material-UI and Next.JS in Webpack

I have encountered an error while trying to add the code from this file: https://github.com/mui-org/material-ui/blob/master/examples/nextjs-with-styled-components-typescript/next.config.js When I include the next.config.js code provided below, I receive ...

Showcase a sizable picture broken down into smaller sections

I am interested in creating a mapping application similar to Google Maps that can asynchronously load images from the backend. I am seeking guidance on where to begin and how to proceed in this endeavor. The ultimate goal is to have the image displayed w ...

How come JSON.parse is altering the data within nested arrays?

In my journey to master Angular 2, I decided to challenge myself by creating a Connect Four game using Angular CLI back when it was still utilizing SystemJS. Now, with the switch to the new Webpack-based CLI, I am encountering a peculiar issue... The fun ...

Exploring the functionality of a Vue component designed solely through a template

I currently have a basic Vue application set up: <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'& ...

What's the best way to integrate Bootstrap into my HTML document?

Hey there, I'm new to the coding world and just started learning. I could use some assistance with including Bootstrap v5.1 in my HTML code. The online course I'm taking is using an older version of Bootstrap, so I'm having trouble finding t ...