xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.15k stars 264 forks source link

GLTFModel does not set Texture encoding correctly for PBR materials #289

Open xeolabs opened 5 years ago

xeolabs commented 5 years ago

Textures loaded by GLTFModel should be sRGB when they are for PBR materials, and GLTFModel attempts to set the encoding property as such, however that property is read only. Therefore, they are always linear.

https://github.com/xeolabs/xeogl/blob/master/examples/js/models/glTFModel.js#L876

yihoo commented 5 years ago

When I use "pbrMetallicRoughness" in my model.gltf, it shows this following error: Cannot set property encoding of # which has only a getter. or TypeError: Attempted to assign to readonly property.

----------------model.gltf--------------------------------- "materials" : [ { "name" : "160802_mia337_001149_finalOBJ", "pbrMetallicRoughness" : { "baseColorFactor" : [ 0.6400000190734865, 0.6400000190734865, 0.6400000190734865, 1.0 ], "baseColorTexture" : { "index" : 0 }, "metallicFactor" : 0.0 } } ],

So I'm wondering that my issue is relevant of your notification. Can you give me some advice to fix it?