[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
-
Upload
- -
Category
Technology
-
view
3.490 -
download
1
Transcript of [shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
4.2 Eliminating Surface Acne with Gradient Shadow Mapping
ohyecloudy(http://ohyecloudy.com)
shader study(http://cafe.naver.com/shader.cafe)
2010.4.26
The Phenomenon of Surface Acne Depth Bias to the Rescue
Depth Gradient
Depth Comparison as a Fuzzy Function
Conclusion
Light
Sampled surface 깊이 맵에서 샘플링 된 깊이 값.
Surface 렌더링하는 오브젝트 표면
False Shadow
The Phenomenon of Surface Acne
Depth Bias to the Rescue Depth Gradient
Depth Comparison as a Fuzzy Function
Conclusion
Light
Light
Depth Bias 평면에선 문제가 없다.
false nonshadowing 지나친 depth bias로 그림자가 생겨야 할 곳에 안 생긴다.
곡면에선 문제
곡면에선 적절한 Depth Bias가 Depth Gradient마다 다르다.
The Phenomenon of Surface Acne
Depth Bias to the Rescue
Depth Gradient Depth Comparison as a Fuzzy Function
Conclusion
Light
Depth Bias Depth Gradient
• depth map에서 이웃 샘플갂 차이
• 입사각의 탄젠트와 비례한다.
• bias scale에 사용 가능.
// gradient calculation
float pixeloffset = INVPIXEL / 2;
float4 depths = float4(
tex2D( ShadowSampler, shadowP + float2( -pixeloffset, 0 ) ).x,
tex2D( ShadowSampler, shadowP + float2( +pixeloffset, 0 ) ).x,
tex2D( ShadowSampler, shadowP + float2( 0, -pixeloffset ) ).x,
tex2D( ShadowSampler, shadowP + float2( 0, +pixeloffset ) ).x );
float2 differences = abs( depths.yw - depths.xz );
float gradient =
min( GradientClamp, max( differences.x, differences.y ) );
difference
The Phenomenon of Surface Acne
Depth Bias to the Rescue
Depth Gradient
Depth Comparison as a Fuzzy Function
Conclusion
1
uncertainty region
Fuzzy depth comparison unbiased depth comparison
// visibility function
float delta_z = centerdepth + gradient * ShadowGradientScaleBias - In.ShadowmapCoord.z;
float visibility = saturate( 1 + delta_z / ( gradient * ShadowFuzzyWidth ) );
The Phenomenon of Surface Acne
Depth Bias to the Rescue
Depth Gradient
Depth Comparison as a Fuzzy Function
Conclusion
• 왜 acne가 생기는지 알아봤다.
• surface acne를 없애기 위한 기술
– depth bias
– gradient-scaled bias
– fuzzy function