浏览代码

Fixed comment and typo about line light function/calculation

/main
sebastienlagarde 7 年前
当前提交
6d6c47f8
共有 4 个文件被更改,包括 12 次插入10 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineMenuItems.cs
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalLightData.cs
  4. 16
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtils.cs

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineMenuItems.cs


}
else if (add.lightTypeExtent == LightTypeExtent.Line)
{
add.areaIntensity = l.intensity / LightUtils.CalculateLineLightArea(1.0f, add.shapeWidth);
add.areaIntensity = l.intensity / LightUtils.CalculateLineLightIntensity(1.0f, add.shapeWidth);
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs


break;
case LightShape.Line:
settings.intensity.floatValue = LightUtils.CalculateLineLightArea(m_AdditionalLightData.areaIntensity.floatValue, m_AdditionalLightData.shapeWidth.floatValue);
settings.intensity.floatValue = LightUtils.CalculateLineLightIntensity(m_AdditionalLightData.areaIntensity.floatValue, m_AdditionalLightData.shapeWidth.floatValue);
break;
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalLightData.cs


}
else if (lightTypeExtent == LightTypeExtent.Line)
{
light.intensity = LightUtils.CalculateLineLightArea(areaIntensity, shapeWidth);
light.intensity = LightUtils.CalculateLineLightIntensity(areaIntensity, shapeWidth);
}
}

16
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtils.cs


}
// convert intensity (lumen) to nits
public static float CalculateLineLightArea(float intensity, float lineWidth)
public static float CalculateLineLightIntensity(float intensity, float lineWidth)
// The area of a cylinder is this:
// float lineRadius = 0.01f; // 1cm
//return intensity / (2.0f * Mathf.PI * lineRadius * lineWidth * Mathf.PI);
// But with our current line light algorithm we get an insane gap in intensity
// following formula (fully empirical) give a better match to a rect light of 1cm of width.
// It is basically point light intensity / line width.
// Line lights in the shader expect intensity (W / sr).
// In the UI, we specify luminous flux(power) in lumens.
// First, it needs to be converted to radiometric units(radiant flux, W).
// Then we must recall how to compute power from intensity for a line light:
// power = Integral{length, Integral{sphere, intensity}}.
// For an isotropic line light, intensity is constant, so
// power = length * (4 * Pi) * intensity,
// intensity = power / (length * (4 * Pi)).
return intensity / (4.0f * Mathf.PI * lineWidth);
}
}
正在加载...
取消
保存