如何在不使用 Threejs 的情况下使用 WebGL 加载 glb 文件
How to load a glb file with WebGL without using Threejs
我是计算机图形学的新手,我一直在用 threejs 试验光照和阴影。现在我正在研究 WebGL,我想编写一些着色器来提高 glb 文件的图像质量。有没有不用Threejs的场景快速加载的方法?或者我应该混合使用 Threejs 和 WebGL 吗?
WebGL 不支持 .GLB 文件。 WebGL just draws triangles, points, and lines. Making a full .GLB viewer requires pretty much reproducing all of three.js. You can do it if you want. You'll need to write shaders that support various kinds of lights, shadows, likely physically based rendering, skinning, morph targets, environment maps, ambient occlusion, normal maps, and more. You'll need to make some kind of scene graph 加载它,因为 .GLB 使用场景图来组织场景。要支持阴影,您需要能够为每个灯光绘制一次场景以生成阴影贴图。您可能需要在运行时生成着色器以优化每个对象以仅使用它需要的功能。您还需要编写自己的纹理加载器,实现某种 material 系统和动画系统。您可能需要 post 处理,以便进行色调映射、发光和景深效果。
或者您可以继续使用 three.js,其中已经写好了。它是开源的,所以如果你想改进着色器然后开始编辑它。
我是计算机图形学的新手,我一直在用 threejs 试验光照和阴影。现在我正在研究 WebGL,我想编写一些着色器来提高 glb 文件的图像质量。有没有不用Threejs的场景快速加载的方法?或者我应该混合使用 Threejs 和 WebGL 吗?
WebGL 不支持 .GLB 文件。 WebGL just draws triangles, points, and lines. Making a full .GLB viewer requires pretty much reproducing all of three.js. You can do it if you want. You'll need to write shaders that support various kinds of lights, shadows, likely physically based rendering, skinning, morph targets, environment maps, ambient occlusion, normal maps, and more. You'll need to make some kind of scene graph 加载它,因为 .GLB 使用场景图来组织场景。要支持阴影,您需要能够为每个灯光绘制一次场景以生成阴影贴图。您可能需要在运行时生成着色器以优化每个对象以仅使用它需要的功能。您还需要编写自己的纹理加载器,实现某种 material 系统和动画系统。您可能需要 post 处理,以便进行色调映射、发光和景深效果。
或者您可以继续使用 three.js,其中已经写好了。它是开源的,所以如果你想改进着色器然后开始编辑它。