WebGL 2 : 041 : Load Meshes / Skeletons from GLTF

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 19

  • @АлександрХохлов-э2м
    @АлександрХохлов-э2м 6 ปีที่แล้ว +2

    those numbers like target in bufferView or componentType in accessor are GL constants. You can find meaning for some of them here: github.com/mattdesl/gl-constants/blob/master/1.0/numbers.js
    so 34963 means ELEMENT_ARRAY_BUFFER
    34962 - ARRAY_BUFFER
    5123 - UNSIGNED_SHORT
    and so on

    • @SketchpunkLabs
      @SketchpunkLabs  6 ปีที่แล้ว

      thank you. Sure that'll help in the future when I try to play around with loading the data from a JS Arraybuffer right into a GL buffer without converting to Float32 or Uint32 arrays first.

    • @laughingskullmusic
      @laughingskullmusic ปีที่แล้ว

      Thanks, that was really helpful.

  • @ara7546
    @ara7546 6 ปีที่แล้ว

    Hey, is it better create Mesh in blender and import as GLTF file or create UBO directly ,is there any performance difference ?

    • @SketchpunkLabs
      @SketchpunkLabs  6 ปีที่แล้ว

      What do you mean create UBO Directly?

    • @ara7546
      @ara7546 6 ปีที่แล้ว

      like in 22s video, u created mesh

    • @ara7546
      @ara7546 6 ปีที่แล้ว

      sorry for my english, i am not a native speaker

    • @SketchpunkLabs
      @SketchpunkLabs  6 ปีที่แล้ว

      So the question is whats better, model a mesh or create one procedurally. Well, neither is better really because it depends on what your trying to do. If you have a humanoid character with a skeleton that you want to animate, you will def want to do all that work in blender then import it into any engine you want, it would be nightmare to do it any other way. But let say you want dynamic terrain based on noise or height maps, then it might be better to do it procedurally, which means you write code that generates the mesh for you. Then of course you can mix the two, like you can built pieces of mesh in blender then import your meshes, then you write code that will stitch the pieces together in different ways to create unique meshes. There is also things like Blend Shapes and Morph Targets you can setup in blender then bring into your engine that you then have to write code to use that data. Morph targets for example you see in games that you can customize a characters body where you have a skinny mesh and a muscle mesh, by using morph target data you can blend then two meshes to create new ones, like a body that is a little skinny but also a little muscular, like blending colors between white and black.
      The short answer is, neither. Each way is a tool, use which ever method that helps you get the end result you're looking for. :)

    • @ara7546
      @ara7546 6 ปีที่แล้ว

      thank you so much !
      will you also make a video where you add that pirate girl mesh , and make it move on key presses maybe also do some colision between objects ?

  • @rishianands8472
    @rishianands8472 5 ปีที่แล้ว

    Thank you for sharing so many things.. Can you please explain how to export a sculpted object from blender to three.js using gltf. When i load that either I miss the texture or miss the sculpted shape. I dont know what am i doing wrong. I would like to create a game in three.js then convert to android game .. Thanks a lot

    • @SketchpunkLabs
      @SketchpunkLabs  5 ปีที่แล้ว +1

      In blender 2.8, there is a GLTF export by default. Ideally you want to make sure you export it as a bin+gtlf file for easier importing into other systems. Now loading GLTF into three.js is a pain, there is one import object you can find online but for my needs its not very good. You can try to use my GLTF loader to get all the binary data as Float32 and Int Arrays, but you'll need to manually create the buffers in three.js.
      Mind you, in this series I'm not using three.js for any of the webgl stuff.

    • @rishianands8472
      @rishianands8472 5 ปีที่แล้ว +1

      @@SketchpunkLabs yes i tried that.. may be i will get it solved ... and i see your class is really advanced and indetail stuff.. hats off to ur hardwork.. and patience.. why dont u create a game by yourself.. ? Are u working somewhere... just out of curiosity...

    • @SketchpunkLabs
      @SketchpunkLabs  5 ปีที่แล้ว

      @@rishianands8472 I have some code using my GLTF to load objects in THREE.JS, that I used for work. I'll see if I can put together a simple example.
      Yes, I would like to make a game. Two things I'm slowly building with this series at the moment. One is a WebVR experience of driving the fortnite baller. Right now its just a regular 3rd person view as I go through the spring physic tutorials and use the results to add animation and controls over the vehicle. You can demo the current version here : fungi.sketchpunk.com/demo/baller/test.html
      The other thing I'm hoping to put together is an 3rd person arena fighter. I would like to model myself (or find someone to do it) a female version of Goblin Slayer and have the character fight against waves of different goblins from other games, like the bokoblins from breath of the wild. If that works out, maybe I'll expand it to a procedurally generated dungeon crawler.
      Hoping to keep it all webbased, but I may transition over to Rust & WebAssembly from Javascript. WIth the hopes of being able to make the web games compiled down to desktop games using OpenGL too. Hopefully the desktop version would support modding and... MAYBE... in the far future online co-op.
      So yea... I have plans but as a single person with only being able to do a few hours a week, its gonna take years i'm afraid to get to a real fun part. But till then, I'm content learning, experimenting and creating tutorials at every step of the way.

    • @rishianands8472
      @rishianands8472 5 ปีที่แล้ว

      @@SketchpunkLabs will surely check ur game when i start my night development work. I just saw it in my mobile.. hope u finish it soon. My case is same like u. I am alone working on game. I have created a game may be 2 years before and placed it in itch.io . I spent almost 1 year.. 3 to 4 hours sleep only .. and the game lookd like this rish.itch.io/maddy
      You may check that out. No need to purchase . Will send u the full game when i get time.. and after its failure i created a multiplayer football android game and its there in play store.. its called football freak.. it has a major issue and its a failure too.. it was developed using phaser 3..
      Now i am planning to build a 3d game in android using blender and three.js.. lots of work and no enjoyment.. happy to find a similar person.. hope u will have a good time in near future

    • @SketchpunkLabs
      @SketchpunkLabs  5 ปีที่แล้ว +1

      @@rishianands8472 www.patreon.com/posts/28395927 Here u go. As bare bones as it can be to setup, Three JS, Download and Parse a single mesh out of GLTF. Dumping the data into Geometry buffers, then into a mesh with a material which gets plopped onto the scene. For icing, I animate the rotation of the object in simple render loop. The GLTF parser is something i wrote, is super bare bones, just two functions. Depending on your level of experience in programming, you can take that parser and rewrite it in a way the suits how you want to handle GLTF. If you want a peek at my current parse which also gets skin and armature data, think also animation data (cant remember, I've rewritten it like 3 times, forget which version has what now).
      github.com/sketchpunk/Fungi/blob/master/fungi.misc/GLTF.js

  • @hongjiangji5626
    @hongjiangji5626 6 ปีที่แล้ว

    F Amazing! Cute...

    • @SketchpunkLabs
      @SketchpunkLabs  6 ปีที่แล้ว

      Later videos I load animations from GLTF and create an armature animator. Recently I have something I modeled and animated working in webgl. Need to iron some bits out before i make a video on it. Hopefully soon after that I'll work on transitioning between two different animations, like lerping between walking and running :) twitter.com/SketchpunkLabs/status/968612591462506497