我从第二次生命中保存了一个collada文件,并使用3js和colladaloader2渲染它。除了使用透明纹理文件的部分外,图像看起来很好。该文件是一个透明的png。透明部分呈现为白色。
我正在使用REVISION:" 78" of three.js
这是代码段
<script src="js/three.min.js"></script>
<script src="js/ColladaLoader2.js"></script>
<script src="js/Detector.js"></script>
<script>
var container;
var camera, scene, renderer;
var group;
var targetRotation = 0;
var targetRotationOnMouseDown = 0;
var mouseX = 0;
var mouseXOnMouseDown = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
var loader = new THREE.ColladaLoader();
loader.options.convertUpAxis = true;
loader.load('models/collada/ASB1/American_Saddlebred.dae', function(collada) {
dae = collada.scene;
dae.scale.x = dae.scale.y = dae.scale.z = 100.0;
dae.updateMatrix();
init();
animate();
function init() {
container = document.createElement('div');
document.body.appendChild(container);
var info = document.createElement('div');
info.style.position = 'absolute';
info.style.top = '10px';
info.style.width = '100%';
info.style.textAlign = 'center';
info.innerHTML = 'Drag to spin';
container.appendChild(info);
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.set(0, 50, 800);
scene.add(camera);
var light = new THREE.AmbientLight( 0xFFFFFF ); // soft white light
camera.add(light);
renderer = new THREE.WebGLRenderer( { antialias: true, alpha: true} );
renderer.setClearColor( 0x333333, 1);
renderer.setClearAlpha = 0.003;
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild( renderer.domElement );