Add an Interactive 3D Model to Your Website // Three.js Tutorial for Beginners

Ғылым және технология

In this Three.js tutorial, I'll teach you how to add an interactive 3D model to your website!
Like my videos? Support the channel on Patreon ❤️ / dangreenheck
✅ GITHUB REPOSITORY: github.com/dgreenheck/threejs...
✅ LIVE DEMO: dgreenheck.github.io/threejs-...
✅ THREE.JS DOCS: www.threejs.org
✅ MILLENIUM FALCON MODEL: sketchfab.com/3d-models/mille...
0:00 Intro
0:15 File Formats
0:54 Finding a 3D Model
1:37 Project Structure
3:27 Setting up the Scene
8:18 Adding 3D Model
10:17 Orbit Camera Controls
12:19 Shadows
14:38 Final Product

Пікірлер: 48

  • @Araknidu92
    @Araknidu928 ай бұрын

    Really good tutorial, well explained. Was a bit confused at first because I did not see my model, but then figured out it was just too big. Thanks a lot !

  • @shahinshahbazi7541
    @shahinshahbazi75418 ай бұрын

    Perfect. thank you sooooo much. I have searched to find a way to import, and I could find in this tutorial 😍

  • @losrobbosful
    @losrobbosful11 ай бұрын

    Excellent tutorial. Finally I got my shadows in the scene! Thanks a ton! Turned out, ambient lighting is a silly idea when trying to cast shadows :D Thank you for bringing me on track with the SpotLight

  • @dangreenheck

    @dangreenheck

    11 ай бұрын

    Glad it helped!

  • @WESLAOyt
    @WESLAOytАй бұрын

    what a good tutorial man, thanks so much teacher!

  • @mayaahmed
    @mayaahmed3 ай бұрын

    Thank you. Simply superb.

  • @wireinet
    @wireinet3 ай бұрын

    VERY THANKS! ITS REALY HELPS

  • @ManojChauhan-kl3dh
    @ManojChauhan-kl3dh11 ай бұрын

    hi sir I watch your videos they all are very useful and I liked it so much .would you please post very long video for that cover whole process from start to end .like how gltf model export from 3ds max or blender with individual animation clip for the same model and then transfer to threejs work with multiple animation clip and then apply highlighting on individual part with labeling feathure when mouse hover on individual part that means when mouse hover on idividual part it shows higlight part and also shows label .If not possible then make a tutorial series for same please sir !!!

  • @subhashmandal9525
    @subhashmandal95256 ай бұрын

    How to open glb file by QR code in any website? Please guide me.

  • @pondokkoding5023
    @pondokkoding502311 ай бұрын

    how to load collada file .dae in three js?

  • @eliosaleh9492
    @eliosaleh94922 ай бұрын

    you just won a subscriber right here! love your content, if you could send all the codes in a text format file, it would be wonderful, thank you in advance! cheers

  • @dangreenheck

    @dangreenheck

    2 ай бұрын

    Thanks! Link to source code is in the description.

  • @harrymason6654
    @harrymason66542 ай бұрын

    Very good explain. I'm looking for a tutorial on how I can use 3D model on AR and interact with that object by clicking/ touch certain area of the 3D object to make some action, but only find tutorials to click on the first 3D object on the scene. Some 3D models have differents parts like buttons and I'm interested on how do that.

  • @dangreenheck

    @dangreenheck

    2 ай бұрын

    You need to build a hierarchy of objects, with the button and interactive elements being separate objects that are children of the main object. Then you can raycast against these separately.

  • @azushi3122
    @azushi3122Ай бұрын

    i know its been a while since this vid came out but ive encountered an issue where the 3d model is just plain white the colors arent there

  • @NikhilHande030490
    @NikhilHande0304908 ай бұрын

    This is soo good. Have been searching over internet for a good overview, I dont think is any other which gives this much clear explanation. Had a quick query: I wanted to build a 3D viewer which is inside a container of a flutter web application. Is it possible to embed this viewer inside a flutter web app? I have tried using packages like model viewer and babylon dart and they dont work on flutter web app. Could you guide here please if this is possible?

  • @dangreenheck

    @dangreenheck

    8 ай бұрын

    Thanks for the feedback. Sorry, I am not familiar with Flutter.

  • @snowyowl776
    @snowyowl7762 күн бұрын

    hello i've been struggling with a project where i need to load a 3D model of "Hannibal Barca " (Carthaginian general ) where he appears in a video call with a user and interacts with him can someone help me i have a deadline of 2 weeks

  • @igoreksazonov
    @igoreksazonov9 ай бұрын

    great tutorial! Im try to add an functional to hover on mesh and highlight and on click on a mesh store a mesh info to console. Is it possible? Thanks in advance!

  • @dangreenheck

    @dangreenheck

    9 ай бұрын

    Yes. Checkout out the “Implementing Raycasting” chapter of my 3D paint app video: kzread.info/dash/bejne/oYKM2Zezgcyvkrw.html

  • @user-op7bz3ig4y
    @user-op7bz3ig4y5 ай бұрын

    HI Dan. Watched your helpful tutorial. What is the website url to see the finished site?

  • @dangreenheck

    @dangreenheck

    5 ай бұрын

    You can find the links to the source and demo in the video description.

  • @MaggieMags0
    @MaggieMags0Ай бұрын

    Hello. Thank u, I did it. Now I want to know how to put the model and the camera on the center of the renderer. The mesh.postion.set() is confusing for me and I have tried so many coordinates

  • @dangreenheck

    @dangreenheck

    Ай бұрын

    You need to set the target of the orbit camera to the position of the mesh.

  • @TR360O
    @TR360O7 ай бұрын

    Great tutorial! However I'm running into one problem. Almost all of the gltf files I want to use stay completly black, even after adding the lights. One of the models I'm using doesn't have this problem. Do you know what could be causing this problem?

  • @dangreenheck

    @dangreenheck

    7 ай бұрын

    It's difficult to know without looking at the files. Do they appear correctly in another tool, like Blender? I always start with MeshBasicMaterial to make sure the mesh is coming in correctly, then switch to a material that supports lighting after. If one mesh appears fine and another does not (and you are using identical lighting for both), then it's likely an issue with the mesh itself. For example, the normals could be flipped. The spotlights are also finnicky to setup (e.g., intensity too low, pointing in wrong direction, etc.). Hope this helps!

  • @bestapps4709
    @bestapps470910 ай бұрын

    Hello buddy, I have made a model in nomad sculpt app, model.gltf and this model has PBR painting materials. With three js can I see these materials? Can your code in this video help?❤

  • @dangreenheck

    @dangreenheck

    10 ай бұрын

    It should. Three.js supports PBR materials (see MeshStandardMaterial)

  • @bestapps4709

    @bestapps4709

    10 ай бұрын

    I will try it💖 Thanks buddy! 💓

  • @KnOtoUt
    @KnOtoUt10 ай бұрын

    So i want to create a helper function that returns the loaded model and put that function in a separate file. But the returned value of the function is always undefined... help ?

  • @dangreenheck

    @dangreenheck

    10 ай бұрын

    Models are loaded asynchronously so that approach will not work. The model is returned in the `onLoad` callback function (threejs.org/docs/?q=gltf#examples/en/loaders/GLTFLoader).

  • @KnOtoUt

    @KnOtoUt

    10 ай бұрын

    @@dangreenheck So, can we wait for the load function to complete and on the onLoad callback store the loaded asset into different globally scoped variable? nvm the implementation might make the code complex and defeat the purpose of separating the function in the first place, right?

  • @dangreenheck

    @dangreenheck

    10 ай бұрын

    @@KnOtoUt Something like that! Doesn’t need to be globally scoped if you are using ES6 modules.

  • @unrealopenworld
    @unrealopenworld9 ай бұрын

    It's all on my PC. How do I get it online to my website? Is it enough to upload the project to the web server?

  • @dangreenheck

    @dangreenheck

    9 ай бұрын

    You use Vite to create a build and you deploy that on your server.

  • @unrealopenworld

    @unrealopenworld

    9 ай бұрын

    @@dangreenheck Thanks for the reply. How does that work exactly? Do you have instructions?

  • @elchungo7055
    @elchungo70554 ай бұрын

    Is anyone else having trouble loading the model? I downloaded the project from github, but the webpage seems to get stuck and only shows 'LOADING 0/100'

  • @dangreenheck

    @dangreenheck

    4 ай бұрын

    Thanks for your comment. There was a breaking change in Three.js v155 that changed how spotlight intensities work. I've updated the code and the demo. I also reduced the textures so it should load faster.

  • @elchungo7055

    @elchungo7055

    4 ай бұрын

    @@dangreenheck Thank you so much!!

  • @elchungo7055

    @elchungo7055

    3 ай бұрын

    @@dangreenheck I'm really sorry too keep annoying you with this, but could it be possible that there's still a mistake? I'm now getting a screen that says "Engaging hyperdrive...". Could it be an error on my side?

  • @dangreenheck

    @dangreenheck

    3 ай бұрын

    Both the demo and a fresh local copy are working for me.

  • @chinese-FX

    @chinese-FX

    3 ай бұрын

    @@elchungo7055 i have the same problem

  • @Usman.dev3D
    @Usman.dev3D Жыл бұрын

    Where is the next ep of sim city?

  • @dangreenheck

    @dangreenheck

    Жыл бұрын

    Stay tuned…

Келесі