html 黄色光线着色器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 黄色光线着色器相关的知识,希望对你有一定的参考价值。
<script name="yellowray" type="x-shader/x-fragment">
precision mediump float;
varying vec3 I;
varying vec3 N;
const float edgeFalloff = 1.0;
const float intensity = 1.0;
const float ambient = 0.2;
void main() {
vec4 color = vec4(1.0, 1.0, 0, 1.0);
float opacity = abs(dot(normalize(-N), normalize(-I)));
opacity = ambient + intensity*(1.0-pow(opacity,edgeFalloff));
gl_FragColor = opacity * color;
gl_FragColor.a = opacity;
}
</script>
<script name="yellowray" type="x-shader/x-vertex">
attribute vec3 vertexPosition;
attribute vec3 vertexNormal;
varying vec3 I;
varying vec3 N;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 normalMatrix;
void main() {
vec4 vp4 = vec4(vertexPosition,1.0);
vec4 P = modelViewMatrix * vp4;
I = P.xyz - vec3(0);
N = vec3(normalMatrix * vec4(vertexNormal,0.0));
gl_Position = modelViewProjectionMatrix * vp4;
}
</script>
以上是关于html 黄色光线着色器的主要内容,如果未能解决你的问题,请参考以下文章
自定义着色器不接收光线
模糊边缘的着色器,或如何绘制光线
GLSL 计算着色器闪烁块/正方形伪影
[Unity] Shader(着色器)之纹理贴图
threejs 复杂模型光线效果怎么调
OpenGL4.0教程 计算着色器简介