three加载三维人脸模型实现各种表情动画效果代码

代码语言:html

所属分类:三维

代码描述:three加载三维人脸模型实现各种表情动画效果代码,通过GLTFLoader加载人脸头部模型,在结合ktx2loader进行人脸分片控制表情动画。

代码标签: three 三维 人脸 模型 各种 表情 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
	<head>
	
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

		<style>
			body {
				background-color: #666666;
			}
		</style>
	</head>
	<body>

	

		<!-- Import maps polyfill -->
		<!-- Remove this when import maps will be widely supported -->
		<script async type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.3.6.js"></script>


		<script type="importmap">
			{
				"imports": {
					"three": "//repo.bfw.wiki/bfwtool/build/three.module.js"
				}
			}
		</script>

		<script type="module">

			import * as THREE from 'three';

			import Stats from '//repo.bfw.wiki/bfwtool/examples/jsm/libs/stats.module.js';

			import { OrbitControls } from '//repo.bfw.wiki/bfwtool/examples/jsm/controls/OrbitControls.js';

			import { GLTFLoader } from '//repo.bfw.wiki/bfwtool/examples/jsm/loaders/GLTFLoader.js';
			import { KTX2Loader } from '//repo.bfw.wiki/bfwtool/examples/jsm/loaders/KTX2Loader.js';
			import { MeshoptDecoder } from '//repo.bfw.wiki/bfwtool/examples/jsm/libs/meshopt_decoder.module.js';

			import { RoomEnvironment } from '//repo.bfw.wiki/bfwtool/examples/jsm/environments/RoomEnvironment.js';

			import { GUI } from '//repo.bfw.wiki/bfwtool/examples/jsm/libs/lil-gui.module.min.js';

			init();

			function init() {

				let mixer;

				const clock = new THREE.Clock();

				const container = document.createElement( 'div' );
				document.body.appendChild( container );

				const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 20 );
				camera.position.set( - 1.8, 0.8, 3 );

				const scene = new THREE.Scene();

				const renderer = new THREE.WebGLRenderer( { antialias: true } );
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( window.innerWidth, window.innerHeight );

				renderer.toneMapping = THREE.ACESFilmicToneMapping;
				rendere.........完整代码请登录后点击上方下载按钮下载查看

网友评论0