Three.js ColladaLoader bumpScale/weighting? Way to adjust bump map intensity

给你一囗甜甜゛ 提交于 2019-12-12 05:53:16

问题


In the current ColladaLoader.js I don't see anything that reads or applies the Collada standard's "weighting" value (0.0-1.0) that indicates bump intensity or "bumpScale" in Three.js Phong material. I noticed that when I export my collada from Blender it picks up the bump materials instantly in three.js (which is amazingly simple - YAY!) but my materials always get an exaggerated bumpScale of default 1.0. It gives the materials an exaggerated bumpiness.

I managed to edit my ColladaLoader a bit and try out my ideal value (0.05) but wonder if I'm missing something or doing this wrong? Anybody else try this? Note that I've not had good luck with json exports so I'm sticking with Collada for now.

Thanks


回答1:


You can set custom properties in the Collada callback. Use a pattern like this one:

loader.load( 'collada.dae', function ( collada ) {

        var dae = collada.scene;

        dae.traverse( function( child ) {

            if( child instanceof THREE.Mesh ) {

                child.material.bumpScale = value;

            }

        } );

        scene.add( dae );

} );

three.js r.71



来源:https://stackoverflow.com/questions/32224631/three-js-colladaloader-bumpscale-weighting-way-to-adjust-bump-map-intensity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!