three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Collada Loader Bugs

Open GuyGood opened this issue 13 years ago • 6 comments

in R62 and below, see here: https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/ColladaLoader.js#L841

first of all, the fov-value does not get parsed into a float. On a second note, the value does not exist because cparams only has xfov and yfov. Thus, the fix would be something like: parseFloat(cparams.xfov) or some method to decide what value should be used yfov or xfov. I could also create a PR but i thought as this is a minor issue, this could be quickly fixed directly... :)

GuyGood avatar Oct 22 '13 10:10 GuyGood

Also, when we are at it, in line 3171: https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/ColladaLoader.js#L3171

I think this sets opaqure material definitions to: "transparent = true," because due to the spec 1.4.1, transparency of (1,1,1) is equivalent to opaque?

http://www.khronos.org/files/collada_spec_1_4.pdf see page 224.

GuyGood avatar Oct 22 '13 14:10 GuyGood

so the fix for the transparency in line 3171 would be "if (transparencyLevel !== 1)" instead 0f "< 0" followed by just setting opacity = transparencyLevel instead of "1-transparencyLevel" i think.

GuyGood avatar Oct 23 '13 07:10 GuyGood

Well, ok. I think there is another problem with the transparency stuff in ColladaLoader and maybe I should add a PR if you agree with my findings. So if my above comments are ok and the transparency level is assumed to be set according to spec, then in Line 3220 https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/ColladaLoader.js#L3220 this condition and the following stuff prevent the ambient color of transparent materials from being set. Thus, if an ambient light is in the scene, transparent objects get an ambient reflectance color of (1,1,1) and get a ghostish like appearance or something like a grey haze? Anyway, according to WestLangley, ambient (reflectance) color is best set to the diffuse color value as posted here: http://stackoverflow.com/questions/14717135/three-js-ambient-light-unexpected-effect. The fix would be to remvoe the condition and create something simpler like: "if prop === emission" then set emissive, else just set the appropriate and already correctly named values with "props[ prop ] = cot.color.getHex();"

Please tell me if a PR is appreciated and I will try my best to do so :)

GuyGood avatar Oct 23 '13 08:10 GuyGood

Sure, give it your best shot.

See the Wiki article How to Contribute to three.js.

WestLangley avatar Oct 23 '13 14:10 WestLangley

Yup! A PR would be great :)

mrdoob avatar Oct 23 '13 14:10 mrdoob

OK, will take a few days but i will get something ready and learn how to contribute :)

GuyGood avatar Oct 23 '13 16:10 GuyGood