Saturate function in GLSL

参考:http://www.ozone3d.net/blogs/lab/20080709/saturate-function-in-glsl/

directx code:

float3 result = saturate(texCol0.rgb - Density*(texCol1.rgb));

GLSL equivalent:

vec3 result = clamp(texCol0.rgb - Density*(texCol1.rgb), 0.0, 1.0);


你可能感兴趣的:(Saturate function in GLSL)