I’ve been stuck on this issue for a couple of days now and it’s about time for some reinforcements if possible.
I’ve got a backend Spring Boot project that returns a String of raw .OBJ data as a blob to an angular front-end project. I console log the resulting string and I can see the .OBJ data, I’m testing on a hefty file.
importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse
Any thoughts on this?
These are my imports in the file:
import { ElementRef, EventEmitter, Injectable, NgZone } from '@angular/core';
import { AssetService } from './asset.service';
import { AssetModel } from './model/asset.model';
import * as BAB from '@babylonjs/core';
import '@babylonjs/loaders';
import {AssetDownloadModel} from './model/asset-download.model';
import {MatSnackBar} from '@angular/material/snack-bar';
import {AssetInfoModel} from './model/asset-info.model';
You could also convert the raw data to a base64 string and use data URLs to load it (we support data URLs everywhere), but the File solution is so much cleaner
Sure I would love to but do you have a open resource link for importing a .OBJ file directly? Cause I’m currently using an API and it requires authentication.
Are you referring to the Embedded Asset technique or one from an open link? Cause ideally I would have to import the file contents (in this case the contents of a .OBJ file) directly into the scene.
Would you be open to a zoom call so that I can show you quickly? Cause there’s a lot going on and I feel as though I can’t reproduce the exact environment, I have a Spring Boot backend which is retrieving from Quixel’s API. I’m sending the raw wavefront file data from the backend to an Angular frontend as a Blob using RxJs.
If I understand you correctly the createObjectURL needs a polyfill in node - it’s meant for the browser. I think the fetch promise resolves to a response object that has a .blob() method and that you need to base64 encode that and then use that data as per here:
edit: have you tried loading with: SceneLoader.ImportMesh(undefined, environment.backend, 'getQuixelSceneAsset?quixelAssetId=' + assetDetails, scene, ...., 'obj');