How to import geometry that I have already prepared


#1

Hello all,

I didn`t find tutorials of how can I import geometry that I modeled in some 3Dprogram, for example Rhino or 3DsMax on my web page,

Thank you for attention,

Kind regards Ivan.


#2

It depends on what file type you are working with. I think a good starting point would be this:

https://doc.babylonjs.com/how_to/load_from_any_file_type


#3

Just read this,

Could you send me sample of how write code if I want to import some GLTF!?

Thanks for attnetion.


#4

How is what he gave not samples? I see many demos covering GLTF

https://www.babylonjs-playground.com/#WGZLGJ


#5

Im asking about that simply because this demo didnt help me to understand why it dont work in my code, SIMPLY DONT work,

Thanks.


#6

Take a look here on the Resources section of the doc’ :

In the Blender to GLTF page, you have an example you can copy-paste :slight_smile:


#7

Hello, thank you but,

Could you send me part of code in which simply noted how to import simple mesh, those samples don`t show me excatly how do I need to write code in my case.

I don`t need demos or general samples, I need code with definitions for example:

x = my mesh.

y = my another mesh

z = my gltf

So your help could be for example:

BABYLON.SceneLoader.ImportMesh([“x”, “y”], “./”, “z”, scene, function (meshes, particleSystems, skeletons) {

/

});

Smth like that???


#8

OK I see what’s your need.

Let’s say you have seen from the doc’ that you want using BABYLON.SceneLoader.ImportMesh. Here steps I do to be sure about the ImportMesh parameters:

  • I take a look on the API
  • I search for SceneLoader 'cause it’s the “root” class name (not sure if “root” is the right name :slight_smile: )
  • when I’m on the SceneLoader page, I’m now able to see how to use the ImportMesh. Parameters with a ? (like here sceneFilename?) are optionnals.

#9

It seem very good explanation, but without code sample it is for nothing,

Could you explain me the same but with right code sample!?

Thank you.


#10

Hmm I don’t understand what kind of code you want. In the Blender to gltf page I linked above you have already a simple line as example: BABYLON.SceneLoader.Load("", "02_suzanne.gltf", engine, function (scene) {});. In combination with API all infos are available, is it not?

Not that you also have access to the playground search, or even some examples.

In short, I can write here that importmesh could be use like that
BABYLON.SceneLoader.ImportMesh("", rootUrl) but it’s just a copy paste from the API :slight_smile:


#11

This is my code, in which “interior scene.gltf” is my simple scene that was produced and converted to GLTF in 3DsMax by Babylon js plugin, that I want to add to current scene on my sample web page, but it dont work, and Im trying to figure out why, could you help me with that???

<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>
SAMPLE

#12

Can you share all your code?


#13

or even your webpage link if possible.


#14

I dont know why this website dont let me show all code, and don`t let me upload files!?


#15

just answer with code between ```


#16

<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>
SAMPLE
'

#17

lol but where is your code? I only see reference to scripts


#18

it don`t let me to show you all code…


#19

you can try to download it using this link

https://drive.google.com/drive/folders/1n8-1s4jJL1Luz8-gai-33LocaCIHwE9l?usp=sharing


#20

So you have your website, but not online, just in your local drive that’s it? (by the way your link is not public, it forces us to connect with a google account).

Do you run a local webserver if so? And what say your browser console? Have you tried to download and use locally the js files?