- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
只是看不到导入到 three.js 场景中的模型。几何图形看起来不错,但无论我应用什么 Material ,模型都不会显示。
我是 WebGL 的新手,所以我很难诊断,但我猜是 JSONLoader 回调期间出了点问题。
感谢大家的帮助。
var camera, scene, renderer, mesh, loader;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
scene = new THREE.Scene();
loader = new THREE.JSONLoader();
loader.load( "scripts/model.js", function( geometry ) {
mesh = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial() );
mesh.scale.set( 10, 10, 10 );
mesh.position.y = 150;
mesh.position.x = 0;
} );
scene.add( mesh );
var ambientLight = new THREE.AmbientLight(0x555555);
scene.add(ambientLight);
var directionalLight = new THREE.DirectionalLight(0xffffff);
directionalLight.position.set(1, 1, 1).normalize();
scene.add(directionalLight);
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.05;
renderer.render( scene, camera );
}
最佳答案
您在模型完成加载之前将网格添加到场景中。
移动线
scene.add( mesh );
进入加载器回调函数。
关于json - 使用three.js JSONLoader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13655092/
当我创建一个 JSON 模型并使用 THREE.JSONLoader.load 加载它时,它的加载没有任何问题,但是当我尝试从中创建一个变量并将数据包含在主脚本中时,THREE.JSONLoader.
我不是 blender 专家(我得到了这个模型),我将它导出到JS,但纹理没有显示。当我删除纹理文件时,浏览器会给出一个错误,指出未找到“map.png”,因此它会加载,但不会显示它。 代码已上线:h
任何人都可以建议加载多个模型(从 blender 导出为 JSON 格式)的最佳方法是什么吗? 在下面的示例中,我使用的是 static_objects 数组,其中填充了一些预定义的对象数据,这也是存
我在 Blender 中制作了一个带有纹理的形状并将其导出。然后用 json loader 显示它。几乎一切都很好,几何形状很好,你可以在形状上看到纹理,但没有颜色。只是黑色和白色。如何显示纹理颜色?
现在 JSONLoader 已经被移除了,之前 JSONLoader 加载的模型怎么加载呢? 最佳答案 是的,JSONLoader已从 three.js 中删除与 R99 .但是加载器仍然可用 Leg
我下面有一个json编码的数据需要用pig解析。 {"arr":[1,2,3,4]} 根据 http://help.mortardata.com/technologies/pig/json#toc_4
我有 jsons,我想将它加载到 pig。每个 json 看起来像这样: {"timeStamp":1397718396509,"requestUid":"534F7D320007","result"
是否可以将从 blender 导出的场景(例如两个不同的立方体)加载到 json 并识别它们? 我需要区分它们,例如使一个旋转,另一个移动。 提前致谢! 登维 编辑+++ 谢谢您的回答! 所以如果我在
只是看不到导入到 three.js 场景中的模型。几何图形看起来不错,但无论我应用什么 Material ,模型都不会显示。 我是 WebGL 的新手,所以我很难诊断,但我猜是 JSONLoader
我正在尝试使用 THREE.JSONLoader 加载 JSON 文件。该文件不是 JSON 模型,而只是一个带有坐标的文件。 理想情况下,我正在尝试这样做: var loader = new THR
我正在使用 raycaster 查看我是否用鼠标(或触摸)击中了一个网格物体很薄,我可以增加任何可以与射线相交的大小。与游戏对象一样,(使用 three.js)我可以添加自己的碰撞网格,它显然不会渲染
当我处理重型模型时,我试图在加载 JSON 时动态显示加载百分比,因此我使用 loadAjaxJSON method 进行了粗略测试。 ... 下面的加载返回加载期间的百分比,但永远不会到达回调函数。
即使我已经有了computeVertexNormals,模型也始终显示在FlatShading中。模型以非法线导出进行优化,通过JsonLoader加载到3JS中,并转换为BufferGeometry
我正在使用 Three.js,在其中创建了一个对象。我创建了一些按钮,并且可以通过单击专用按钮来更改对象的 Material 颜色。 问题是:如何使用纹理 Material 完成相同的过程,因此如果我
我有以下需要使用 Pig 解析的数据 数据 { "Name": "BBQ Chicken", "Sizes": [ { "Size": "Large", "Price"
我修改了这个源代码的数据加载器https://github.com/techleadhd/chatgpt-retrieval让 ConversationalRetrievalChain 接受 JSON
我修改了这个源代码的数据加载器https://github.com/techleadhd/chatgpt-retrieval让 ConversationalRetrievalChain 接受 JSON
我正在尝试使用 Three.js 设置一个非常简单的场景,显示一个导入的网格旋转。我结合了 Three.js 文档中的几个示例并得出以下代码: var scene, camera, renderer;
在 blender 中制作房屋模型后,我将其作为单个对象导出为 Three.js json 格式,但将其添加到场景时,我显示了一半纹理,另一半只是灰色网格。 JSON URL(带有绝对纹理图像链接):
我正在使用 three.js 的 JSONLoader() 加载模型。加载工作正常,但模型看起来有点奇怪。我猜这是因为它会自动使用平滑着色而不是平面着色。我尝试了几种应用平面阴影的方法,但都没有用。
我是一名优秀的程序员,十分优秀!