在第一节:https://blog.youkuaiyun.com/qq_37338983/article/details/80289631,讲了如何利用基本的着色器通道对地球模型进行渲染,文章里面只是单纯地用到了着色器通道,代码里也没有着色器代码的编写,本节将会使用着色器代码和着色器通道结合共同来渲染一个类似于太阳的模型,模拟太阳表面的流动效果。
所用贴图在上一篇文章里面有提到过下载方法,请读者自行下载:点击打开链接。
有关着色器相关知识可参考:https://blog.youkuaiyun.com/qq_37338983/article/details/78556063
下面先来看这个demo实现的效果:
<!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">
<title>shader_1</title>
<style>
body {
color: #ffffff;
font-family:Monospace;
font-size:13px;
text-align:center;
font-weight: bold;
background-color: #000000;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<div id="container"></div>
<script src="build/three.js"&g