目前Web端的相关数字孪生项目大部分都是用threejs 实现的,建议先考虑threejs, webgpu 可参考的案例相对较少
D
Davidyanlong
@Davidyanlong
-
来个大佬的建议 -
管路制作问题自动生成管路,你需要自定义shader, 根据管道的形状参数,或者说是sharp, 以及要生成管子的顶点密度,构建自己的输入顶点参数, 在WebGPU和WebGL中是没有GeomtryShader的,在vertex shader中构建管子的三角面,基本思路就是这样的,或者通过compute shader计算
-
LitMaterial 与 PhysicMaterial 两个材质有什么区别?似乎都是PBR材质 -
LitMaterial 与 PhysicMaterial 两个材质有什么区别?似乎都是PBR材质LitMaterial 与 PhysicMaterial 两个材质有什么区别?似乎都是PBR材质
-
这段代码感觉性能消耗有点大,影响首屏的时间public initDefault() { console.time('texture') this.normalTexture = this.createTexture(32, 32, 255 * 0.5, 255 * 0.5, 255.0, 255.0, 'default-normalTexture'); this.maskTexture = this.createTexture(32, 32, 255, 255 * 0.5, 255.0, 255.0, 'default-maskTexture'); this.whiteTexture = this.createTexture(32, 32, 255, 255, 255, 255, 'default-whiteTexture'); this.blackTexture = this.createTexture(32, 32, 0, 0, 0, 255.0, 'default-blackTexture'); this.redTexture = this.createTexture(32, 32, 255, 0, 0, 255.0, 'default-redTexture'); this.blueTexture = this.createTexture(32, 32, 0, 0, 255, 255.0, 'default-blueTexture'); this.greenTexture = this.createTexture(32, 32, 0, 255, 0, 255, 'default-greenTexture'); this.yellowTexture = this.createTexture(32, 32, 0, 255, 255, 255.0, 'default-yellowTexture'); this.grayTexture = this.createTexture(32, 32, 128, 128, 128, 255.0, 'default-grayTexture'); let brdf = new BRDFLUTGenerate(); let brdf_texture = brdf.generateBRDFLUTTexture(); let BRDFLUT = brdf_texture.name = 'BRDFLUT'; this.addTexture(BRDFLUT, brdf_texture); this.defaultSky = new HDRTextureCube(); this.defaultSky.createFromTexture(128, this.blackTexture); Reference.getInstance().attached(this.defaultSky, this); Reference.getInstance().attached(brdf_texture, this); Reference.getInstance().attached(this.normalTexture, this); Reference.getInstance().attached(this.maskTexture, this); Reference.getInstance().attached(this.whiteTexture, this); Reference.getInstance().attached(this.blackTexture, this); Reference.getInstance().attached(this.redTexture, this); Reference.getInstance().attached(this.blueTexture, this); Reference.getInstance().attached(this.greenTexture, this); Reference.getInstance().attached(this.yellowTexture, this); Reference.getInstance().attached(this.grayTexture, this); this.defaultGUITexture = new GUITexture(this.whiteTexture); this.defaultGUISprite = new GUISprite(this.defaultGUITexture); this.defaultGUISprite.trimSize.set(4, 4) this.defaultMaterial = new LitMaterial(); console.timeEnd('texture') }
测试的结果是 9毫秒
-
WebGPU小白入门(一): 零基础创建第一个WebGPU项目老师,想获得该系列培训的PPT,在哪里可以下载到?
-
组件中可以再添加组件吗? -
组件中可以再添加组件吗?// 新建对象 const obj = new Object3D(); // 为对象添 MeshRenderer let mr = obj.addComponent(MeshRenderer); // 设置几何体 mr.geometry = new BoxGeometry(5, 5, 5); // 设置材质 mr.material = new LitMaterial();
这段代码中,
BoxGeometry
与LitMaterial
可以也作为组件的方式加入,例如:// 新建对象 const obj = new Object3D(); // 为对象添 MeshRenderer let mr = obj.addComponent(MeshRenderer); // 设置几何体 let geo = mr.addComponentnew(BoxGeometry); geo.init(5, 5, 5); // 设置材质 let mat = mr.addComponentnew(LitMaterial);
-
Orillusion打造3D文件Converter目前web端通用的格式是GLTF/GLB格式,FBX格式,或者USDZ格式