i want to load .obj file size is about 300Mb. when i m load that file it will crash the browser and some time it will take more time to load but after that it will say memory core dumped…
so there is any other way that i’m missing here for loading big object file and material file.
thank you in advance… :slight_smile:
i want to load .obj file size is about 300Mb. when i m load that file it will crash the browser and some time it will take more time to load but after that it will say memory core dumped…
so there is any other way that i’m missing here for loading big object file and material file.
thank you in advance… :slight_smile:
Share Improve this question edited Dec 16, 2017 at 17:11 WestLangley 105k11 gold badges287 silver badges283 bronze badges asked Dec 14, 2017 at 6:23 Darshit HedparaDarshit Hedpara 6706 silver badges17 bronze badges 3- Optimize but how ?? i have been working on optimization part since last 2 days but it will break objects quality and high defination textures – Darshit Hedpara Commented Dec 14, 2017 at 8:16
- 1 docs.blender/manual/en/dev/modeling/modifiers/generate/… Use decimate tool. For web even 30mb is very big data. Time load is critical for user . Nobody want's to wait 5 minute for webpage show. – Nikola Lukic Commented Dec 14, 2017 at 8:21
- stackoverflow./questions/45144656/… Try this also – Nikola Lukic Commented Dec 14, 2017 at 9:04
1 Answer
Reset to default 17There is so much you can do to optimise your file and your application.
Reduce poly-count as much possible. Remember that the model should not at all be over-detailed.
Convert Obj file to Json and/or create saperate JSON file for each objects in your scene. Remember, geometry is the heaviest chunk of data in the file you 're trying to load. So, if possible, create separate
BufferGeometry
files for each and load it viaBufferGeometryLoader
You can use some pression/depression technique before loading all the js and json files. Check out OpenCTM pression. You can also try gzip your files and deflate it onload.
At 3d modelling stage when creating the meshes, merge as much geometries as possible. Easiest way would be to identify all the meshes that have same/similar materials, merging those geometries, and assigning those geometries the same material. The lesser the number of geometries you have, the lesser the number of draw call going to be in the rendering pipeline. Hence, your performance will improve.
You can keep the track of your
drawcalls
usingrenderer.info
Keep the Texture file size at lower resolution. I generally remend less then 1K.
Material performance cost goes like this
MeshBasicMaterial
<MeshLambertMaterial
<MeshPhongMaterial
<MeshStandardMaterial
<MeshPhysicalMaterial
. So be careful when assigning the material to your geometries. Threejs doc clearly illustrate all the features for each materials. So, if you know that some property of the material is not required for your object, fallback to the cheaper material.Use
normalMaps
to fakegoemetries
. This will reduce your number ofvertices
required.If your scene is static use
aoMap
andLightMap
in your scene to eliminate the need of light sources and its cost of calculations.If your scene is static, stop the requestAnimationFrame and and render only when required. Example. if you are using orbitcontrol.js, use
onChange
method to render when user activity is triggered.Use chrome extension like Threejs Inspector and WebGL Inspector for debugging.
If removing anything from the scene dynamically, make sure to dispose the data properly.
300 mb file is insanely big. Make sure to reduce it to 30 mb or less, Ideally, less then 10 mb for best experience.
There is so much more that can be done, if you are able to achieve most of these point, you will be relieved from your current issue and can then focus on advance optimisation. I would highly remend to stick to the Threejs documentation.