gltf

How to cast a shadow with a gltf model in three.js?

喜夏-厌秋 提交于 2021-02-20 19:14:13
问题 Hey there i'm new to three js & was wondering how to cast a shadow with a gltf model? I can see it's possible as it's working here I assume i'm not structuring my code correctly- var model = new THREE.GLTFLoader(); model.load('https://threejs.org/examples/models/gltf/Duck/glTF/Duck.gltf', function(gltf) {scene.add(gltf.scene);}); model.castShadow = true; Here's the fiddle https://jsfiddle.net/steveham/ckpfwy24/87/ Cheers! 回答1: You need to set castShadow = true on each child mesh, like so: var

How to cast a shadow with a gltf model in three.js?

懵懂的女人 提交于 2021-02-20 19:14:11
问题 Hey there i'm new to three js & was wondering how to cast a shadow with a gltf model? I can see it's possible as it's working here I assume i'm not structuring my code correctly- var model = new THREE.GLTFLoader(); model.load('https://threejs.org/examples/models/gltf/Duck/glTF/Duck.gltf', function(gltf) {scene.add(gltf.scene);}); model.castShadow = true; Here's the fiddle https://jsfiddle.net/steveham/ckpfwy24/87/ Cheers! 回答1: You need to set castShadow = true on each child mesh, like so: var

I can't get the aoMap showing in three.js using a glb/gltf asset

流过昼夜 提交于 2021-02-11 08:58:22
问题 I’m having a hard time getting an aoMap working in three.js… I have a glb asset with an aoMap on the red channel or something. When I bring it into to the babylon viewer, I can see the ao just fine, but it wont show up in the three.js viewer or my project. I think this has something to do with a second set of uvs, but I can't find a resource that involves doing that on top of using the gltf loader… I really don't know what to do here. Any response would be greatly appreciated! Here is my code

glTF Are bone matrices specified in local or model space?

落爺英雄遲暮 提交于 2021-01-28 21:23:53
问题 So the official documentation says: Note that the node transform is the local transform of the node relative to the joint, like any other node in the glTF node hierarchy as described in the Transformation section. I am a bit fuzzy as to what exactly the distinction is between node and joint here. Assuming I can conflate the 2, go to the SimpleSkin exmaple int the models And look at the json: "nodes" : [ { "skin" : 0, "mesh" : 0 }, { "children" : [ 2 ], "translation" : [ 0.0, 1.0, 0.0 ] }, {

How do I load GLTFLoader from a cdn THREE.js

╄→尐↘猪︶ㄣ 提交于 2020-12-15 06:30:49
问题 I'm having some issues figuring out how to get GLTFLoader to work in THREE.js. I don't understand how to use a cdn site to host the file. I have tried using links from examples around the web but that hasn't done the job for me. I read on another post that the GLTFLoader file had to be the same versions the core THREE file I'm using (r121). I thought I could go to mrdoob github (not familiar with how to use github) and click raw file then use that link on a site like githack to generate a cdn