3D render from blender

Hello to everyone,
I have one question regarding the loaders. I have tried all of the troubleshoot solution, but nothing seems to work for me in order to load my 3d model from blender on the web. I was wondering whether I have to create a scene first + the webGL renderer and after that write down the code for the GLTFLoader.

This is how my code looks currently.

Thank you in advance!!

Your camera, if to believe the code from the screenshot, is in the center of the scene. Try to shift it along z-axis, for example, camera.position.z = 20;
But more important, there is no renderer.render(scene, camera); line in the code, neither on its own nor in animation loop.

Hey, thanks for the reply! I tried changing the position of the z-index, but that does not seem to do the trick. Regarding the renderer.render(scene, camera); line, isn’t that what loader.load does? If not where in my code do I have to write it down?

Thanks, again!

it just loads your object, then you add it to the scene, and then you have to render the content of the scene with your camera via renderer.render(scene, camera);
Add a render loop at the end of your script:

renderer.setAnimationLoop(() => {renderer.render(scene, camera);});

Oh, and don’t forget to add light source(s) to the scene. Otherwise you’ll get just a black screen.

Will look it up! Thanks for your help

An example may help you.

From the Collection of examples from discourse.threejs.org

A model is loaded here.



See also BeginnerExample step 3


Thank you for this! It actually helped me a lot with rendering my object.