I'm new and really struggling with 3D objects ( Blender, BabylonJS)

I’ve downloaded free objects from websites and import them into Blender. Everything looks normal.
I have installed a BabylonJS plugin for exporting 3D objects to my_object.babylon files. Looks normal.
I then load the babylon file in my Babylon scene, where it shows up. Looks normal.

But this is where I start to struggle.

I build code like:

async importCarMesh(){
    const importPromise = await SceneLoader.ImportMeshAsync(
        "", // root url
        "assets/blender/startercar_v1_2.babylon", // file name
        "", // scene name
        this.scene // the scene where the model will be added
      );

      return importPromise.meshes[0];
}

Here I already don’t really know what I’m doing, I’m just picking meshes[0] because this worked for some 3D models, but not for all. Why do I have an array of Meshes?
I basically just want “the” object after the import and do things with it. I don’t know why it’s divided in a meshes array.
Why does it work for one object, but another object goes like “nope, we’re not doing that today”

For some 3D models, just grabbing meshes[0] works fine enough and I can have the object move around. But for other 3D models, it’s only the tyres of the car, or the body. And there is no “whole object” I can find in the meshes array.

I’m not asking for a particular solution for a particular problem.

But here are my questions instead:

  1. Why is it all made so confusing and seemingly random? Why does the one babylon object exported from Blender behave so differently compared to another one?
  2. Is there some tool that I’m missing? Is there a way I can view my .babylon files more properly, with some tree or something that shows like "here are your meshes, and the entire object as a whole can be called just by this particular variable.
  3. I just can’t imagine that you professional devs, go loop through a meshes array to figure out what “the” one mesh is that is the entire car instead of just its wheels or sidepods. I must be missing something…

It’s a very steep learning curve and the behaviors of the object all seems so random.

I’ll give another example:
A mesh has a “lookAt” variable. That sounds intuitive, I make it “look at” vector3(50,0,50) for example. And instead of the car just rotating to that Vector, it suddenly is standing tilted on its side in an awkward position. It’s things like this that make me go like “how even does any of this work”, you understand my confusion?

Hi,
I can hear and understand your frustration :hugs: but on your side, you need to understand that making real time 3D on the web with simple js or ts language is also not just ‘a piece of cake’ :cake:. Many of us have spent years if not a decade or more learning about 3D, code, design and rendering engine.

BJS is already (I believe) the most straight-forward and comprehensive framework and rendering engine available today (my opinion only). It offers a lot of different Editors, Tools and a comprehensive doc and… the dedicated Team and the Community are always willing to help the best they/we can.

To give you a simple example about my experience (since I can only speak for me, not for the others), despite for having worked with 3D apps since 2005 and used a number of engine, it took me 6 months going through the BJS docs, PGs, etc… before I even started posting in the forum.

At first, like everyone, I wanted to dive straight into my project/my idea. Next thing I realized is that it would be more productive if I would first acquire some learning. There are lots of examples, samples, tutorials available from the doc. I can only advise that you would allow yourself a small time (1 or 2 hours per day or even per week) to choose a topic and try learn more about it. With that said, let me try answer some of your questions.

Each 3D app has its own format (often proprietary). Some use a right-handed system, others a left-handed system. Some export formats are supported, but not all provide the same result and limitations exist for all. There is no real ‘3D normalization/standard’ as with i.e. ISO or norms for colorprofiling. As of today, we still need to make with the different approaches, methods and gaps of each actor in business. But things are getting better. People like GLTF are making great efforts to provide with a new common format for sharing 3D. And, Blender, whether you like it or not, has also greatly improved this aspect.

Honestly, the Babylon.js ‘Inspector’ is a great tool. It might not display everything in the same way than you would find in your 3D app (but then, each 3D app is also different, I don’t know how many you use?) There’s a tree for ‘Nodes’ and a link to the material in use and to the textures. I don’t think many things are missing in there, although…there are. But then, this is all opensource and you are sure very welcomed to contribute. In fact, you are already contributing by sharing your experience so thanks for that :smiley: :hugs:

LoL me if you want but this is exactly what I have been doing for over a year until :shushing_face:… until @labris reminded me that there is also a picking mesh tool in the ‘Inspector’. Simply click on the ‘target icon’ next to ‘scene’ to the far right. With this active, you can click on any mesh in the scene and it will be selected.
Capture d’écran 2023-01-05 à 13.35.22

Here again, I would recommend you start by touring the doc a little. Understand better about world and local position, about rotation (and rotation values in BJS) and rotation quartenions and tools to convert… (sry I know that seems a lot but don’t be discouraged. Just take it step by step and I can assure you the doc is not all that boring to read and not all that hard to understand, trust me… My math skills are down to just about nothing and even I could (finally) nearly understand it :grin:
and then, about the lookAt function. The purpose of ‘lookAt’ is not really to rotate a mesh in the world or local space. It’s true purpose is to make a mesh ‘lookAt’ either another mesh or a point.

I hope you will continue with your efforts and not give up. Never give up. It might seem hard today but believe me, if you do just a little bit every day, we can talk about it again in 6 months and you will be amazed of all you have been able to achieve in just a few months.

And as I said, the team and the Community is always willing to help and explain so you’re not left on your own while learning this.

9 Likes

There is a lot of useful information in your reply, and I will be rereading it a few times today.
Thanks for that!

The “Inspector” is new to me, I haven’t heard of that tool yet, but sounds like one of those tools that I have been missing so far. Will get into that today.

I’m only into BabylonJS for about 2 weeks now but I’ve been very happy with my progress so far. I’ve already built some amazing (for me) things in that short time.
Today (and yesterday) is just the first moment I’m really starting to get stuck.

In the past 2 weeks, I’ve solely been doing BabylonJS and using the docs… I could always figure things out and build. Never got stuck for long times.

Today and yesterday, the part I’m getting stuck on is with working with external 3D models, importing them into BabylonJS and manipulating those… compared to the previous 2 weeks, this part is a bit of a nightmare.
So it’s not BabylonJS that frustrates me, it’s the free 3D models that all have their issues.
Just another example… i’ve just found another free 3D model (this one: RedBull RB6 - Download Free 3D model by luis.adrian.villagrana (@luis.adrian.designs3D) [40fac35] - Sketchfab ) and there I get an error that says assets/blender/Window1_nmap.png 404 file not found. As far as I understand, this file is just missing entirely from this free package… it’s stuff like that that are very confusing, because these models all seem to work only halfly… about 80 % of the ones I’ve downloaded seem to be “broken”. And then I think “is it my fault? what am i doing wrong?” but in this case it really looks that this file just wasn’t provided by the uploader. Very strange. Very strange that all these models seem to have these issues.
Oddly nobody complains in the comments on this models, but just state a “thank you!”

And yes they are free but I’m learning with free assets first to get things going before I will start paying a professional designer for the real project.

Sorry I’m digressing now but just want to share how the experience is.

Back to BabylonJS, I’m really happy so far. It’s just the external 3D models that behave strangely but, as you state in your reply, it’s really the lack of conventions that’s the issue here it seems.

If I succeed with my project in BabylonJS, I will be very happy to share it with the community here and hope to impress.

4 Likes

Got you there. Free models are a pain. Most of the time, it’s not for no reason that they are free :wink:
They all have missing parts. They are not maintained. Not properly checked on export. Honestly, I avoid using them. I prefer paying 10 or 15$ for a model I think is ok (from the user comments and number of downloads). Although even there and like with any template, you can never be 100% sure.

Whilst you are learning to handle models, I would recommend you start with using those provided with the BJS Assets or with models you create yourself (even simple ones). At least you will know what’s in there and can check back on your model.

Very likely. May be he renamed the texture after export (happens all the time) or simply forgot to include it (happens the rest of the time :wink:

Please do. I will be the first one to applause :clap:
Meanwhile, have a great day :sunglasses:

3 Likes

Why not working in right handed in this case ?

5 Likes

Oh, how nice. I love it :heart_eyes:
BtW, I didn’t say ‘all’, I said ‘most’… It’s true that there are some very good ones made with love and expertise. One would just need to know where to look for these. It’s often fan art to be found in communities, not just in a grand public ‘3D store’.

wow thank you for such a kind gesture.
I will definetly be trying your model for my learning experiments,
Beautifully made as well!

no worries , the post was mostly trying to just inform you about the state of things CG related and working with engines.

the main point was the notion that in some or other way, there will always be things to work around , things to learn , extra code to write etc. You can rant along the way, i do it from time to time as well but it wont change this fact.

I find it is better to embrace it and change your viewpoint of it all ( over and over again ) because this makes working everyday much more pleasant . Its all about how you frame it mentally.

1 Like

@Gamedev fellow “struggler” here. I’ve been playing with BJS for about a year now (just in my free time though …), coming from a solid webdev background but without any prior 3d experience. I still am a total beginner, but things have started falling into place – thanks to both the docs and this excellent forum. I guess the best thing to do is just sticking with it :slight_smile:
There have been more than enough moments of frustration for me, but making something finally work in 3d is priceless to me, and I don’t think I’ll stop exploring this exciting realm anytime soon.

I’d like to ask you a huge favour at this point. Please do keep in mind that BJS is a community project. And while the docs are certainly very helpful, they surely can be improved in many places, especially from a beginner’s perspective.
I’ve already made some small contributions to the docs when I thought something was off, or confusing, or simply missing. The process is really straightforward and everybody’s super helpful, so don’t hesitate to do it! It will help both your own understanding, and everybody who will read it.

On the topic of free 3d models: not sure what you’re up to, but for characters I can highly recommend https://www.mixamo.com/. They have free humanoid character models (about 100, different genres) and an incredible amount of animations for them (2000+). The quality of (almost all) models and animations is, at least to me, stunning.

Have fun :v:

3 Likes

And you are right. But I also want to stress out that it is not the purpose of a rendering engine to give all the insight on how to handle 3D (models, materials and environment). I don’t think we’ll ever make it to the point where the BJS doc can become a complete walkthrough from zero to Z on how to create a 3D and a real-time 3D environment. And if so, it would only become that much that it would start to be confusing for beginners and boring for the others. I think the BJS docs has a good ‘balance’ and I agree that it needs to be further and continuously improved.

Correct. I would never have engaged without this base. And I keep being amazed every single day of just how helpful, empathic and reactive the team and the community is.

3 Likes