反射公式
reflect
//i是入射光线,n是归一化的法线
float3 reflect( float3 i, float3 n )
{
return i - 2.0 * n * dot(n,i);
}
Cesium实现
reflect(direction, normal) {
var n = Cesium.Cartesian3.dot(normal, direction);
var t = Cesium.Cartesian3.multiplyByScalar(normal, 2 * n, new Cesium.Cartesian3);
return Cesium.Cartesian3.subtract(direction, t, new Cesium.Cartesian3);
}