浏览代码

Replace max(0, x) with saturate to save 1 VALU

/main
Evgenii Golubev 8 年前
当前提交
e3a00862
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl

4
Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl


out float3 L)
{
// Cosine sampling - ref: http://www.rorydriscoll.com/2009/01/07/better-sampling/
float cosTheta = sqrt(max(0.0, 1.0 - u.x));
float cosTheta = sqrt(saturate(1.0 - u.x));
float sinTheta = sqrt(u.x);
float phi = TWO_PI * u.y;

{
// GGX NDF sampling
float cosThetaH = sqrt((1.0 - u.x) / (1.0 + (roughness * roughness - 1.0) * u.x));
float sinThetaH = sqrt(max(0.0, 1.0 - cosThetaH * cosThetaH));
float sinThetaH = sqrt(saturate(1.0 - cosThetaH * cosThetaH));
float phiH = TWO_PI * u.y;
// Transform from spherical into cartesian

正在加载...
取消
保存