相关疑难解决方法(0)

这种伪造的灯光如何作用于气动扭力?

我正在尝试阅读本教程:

https://aerotwist.com/tutorials/an-introduction-to-shaders-part-2/

但我无法跟进。基本上,代码使用直接在GPU上运行的着色器创建定向光。这是代码:

// same name and type as VS
varying vec3 vNormal;

void main() {

    // calc the dot product and clamp
    // 0 -> 1 rather than -1 -> 1
    vec3 light = vec3(0.5,0.2,1.0);

    // ensure it's normalized
    light = normalize(light);

    // calculate the dot product of
    // the light to the vertex normal
    float dProd = max(0.0, dot(vNormal, light));

    // feed into our frag colour
    gl_FragColor = vec4(dProd, dProd, dProd, 1.0);

} 
Run Code Online (Sandbox Code Playgroud)

具体来说,我不明白的这一行是:

float dProd = max(0.0, …
Run Code Online (Sandbox Code Playgroud)

lighting glsl light webgl three.js

2
推荐指数
1
解决办法
542
查看次数

标签 统计

glsl ×1

light ×1

lighting ×1

three.js ×1

webgl ×1