hello,everyone!I want to add normal and rough textures to my OBJ model, but these two lines of code
actor.getProperty().setNormalTexture(normalTex);
actor.getProperty().setRoughnessTexture(roughnessTex);
don’t seem to work. Can anyone tell me specifically how to use them?
That should be correct. Are you creating the textures correctly, and are you using WebGPU or WebGL?
I referred to the official example to complete the texture mapping, and I am not sure if the following code is used correctly
createTexture(src) {
const _img = new Image();
_img.crossOrigin = "Anonymous";
_img.src = src;
const _tex = vtkTexture.newInstance();
_img.onload = () => {
_tex.setInterpolate(true);
_tex.setEdgeClamp(true);
_tex.setImage(_img);
};
return _tex;
},
const normalTex = this.createTexture(this.fileContents.img["own/Leather037_1K-JPG_NormalDX.jpg"]);
actor.getProperty().setNormalTexture(normalTex);
actor.addTexture(texture); this code is ok.Only “setNormalTexture”,this type of interface does not work
I would also check to make sure you are using the correct WebGPU renderer. I think those textures only work under WebGPU; I don’t think they work under WebGL.