Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
ShaderX5
   4.2 Multisampling Extension
    for Gradient Shadow Maps


                     ohyecloudyhttp://ohyecloudy.co...
Overview of Gradient Shadow Maps
Multisampling and PCF
Merging the Algorithms
Optimizing Texture Look-ups
Conclusion
• Slope-scale depth bias
  – gradient를 depth bias에 사용


• Fuzzy depth comparison
  – 1 or 0이 아니라 0~1 값을 쓴다.


• Linearly f...
float lightVisibility_GSM(float3 lightCoord)
{
  // get the magnitude of the gradient, by either method
  float gradient =...
Overview of Gradient Shadow Maps
Multisampling and PCF
Merging the Algorithms
Optimizing Texture Look-ups
Conclusion
float lightVisibility_PCF(float3 ligthCoord)
{
  float result = 0;

    for (int i = 0; i < n; ++i)
    {
      float3 off...
Overview of Gradient Shadow Maps
Multisampling and PCF
Merging the Algorithms
Optimizing Texture Look-ups
Conclusion
float lightVisibility_PCF_with_GSM(float3 lightCoord)
{
  float result = 0;

    for (int i = 0; i < n; ++i)
    {
      r...
incident light             incident light



                 surface                    surface




      shadow volume  ...
float lightVisibility_GSM_modified(float3 lightCoord,
float2 offset)
{
  // get the gradient, by either method
  float2 gr...
Overview of Gradient Shadow Maps
Multisampling and PCF
Merging the Algorithms
Optimizing Texture Look-ups
Conclusion
• depth map에 scalar depth 저장했을 때
 – gradient vector : texture loockup 3번


• 추가로 depth sampling 한번, PCF에서 4번

• 전체 PCF 영역에...
z    x 2  xy  1  z x 
 x     i                   i  i

 z   xy  y 2   z y 
   y    ...
8 PCF samples
float lightVisibility_unrolled_circluar8(float3 lightCoord)
{
  const float displace = .5 / depthMapResoluti...
Overview of Gradient Shadow Maps
Multisampling and PCF
Merging the Algorithms
Optimizing Texture Look-ups
Conclusion
• ShaderX4에서 봤던 Acne 제거 기술 복습
 – Slope-scale depth bias,
 – Fuzzy depth comparison,
 – Linearly filtered depth values


• ...
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
Upcoming SlideShare
Loading in …5
×

of

[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 1 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 2 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 3 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 4 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 5 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 6 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 7 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 8 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 9 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 10 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 11 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 12 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 13 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 14 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 15 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 16 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 17 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 18 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 19 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 20 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 21 [shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps Slide 22
Upcoming SlideShare
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
Next
Download to read offline and view in fullscreen.

2 Likes

Share

Download to read offline

[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps

Download to read offline

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps

  1. 1. ShaderX5 4.2 Multisampling Extension for Gradient Shadow Maps ohyecloudyhttp://ohyecloudy.com shader study http://cafe.naver.com/shader.cafe 2010.5.24
  2. 2. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
  3. 3. • Slope-scale depth bias – gradient를 depth bias에 사용 • Fuzzy depth comparison – 1 or 0이 아니라 0~1 값을 쓴다. • Linearly filtered depth values – point 샘플링이 아니라 보간 해서 사용. • 예) bilinear filter
  4. 4. float lightVisibility_GSM(float3 lightCoord) { // get the magnitude of the gradient, by either method float gradient = length(getGradientVector(lightCoord)); // get the difference between stored and interpolated depth // (depthMap should have LINEAR filtering enabled) float diff = tex2D(depthMap, lightCoord.xy).x – lightCoord.z; // replace the less-than operator with a smooth function // for diff >= 0 the result is 1 return saturate(diff/gradient + 1); }
  5. 5. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
  6. 6. float lightVisibility_PCF(float3 ligthCoord) { float result = 0; for (int i = 0; i < n; ++i) { float3 offCoord = lightCoord + offset[i]; result += lightCoord.z < tex2D(depthMap, offCoord.xy).x; } return result / n; }
  7. 7. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
  8. 8. float lightVisibility_PCF_with_GSM(float3 lightCoord) { float result = 0; for (int i = 0; i < n; ++i) { result += lightVisibility_GSM(lightCoord + offset[i]); } return result / n; }
  9. 9. incident light incident light surface surface shadow volume shadow volume PCF area PCF area
  10. 10. float lightVisibility_GSM_modified(float3 lightCoord, float2 offset) { // get the gradient, by either method float2 gradientVector = getGradientVector(lightCoord); float gradient = length(gradientVector); // calculate an offset coordinate // the z coord is moved along with the local gradient // (this is equivalent to having a local plane equation) float3 offCoord = float3( lightCoord.xy + offset, lightCoord.z + dot(offset, gradientVector)); // the rest is straightforward float diff = offCoord.z – tex2D(depthMap, offCoord.xy).x; return saturate(diff/gradient + 1); }
  11. 11. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
  12. 12. • depth map에 scalar depth 저장했을 때 – gradient vector : texture loockup 3번 • 추가로 depth sampling 한번, PCF에서 4번 • 전체 PCF 영역에서 평균 gradient를 근사 – 최소 제곱 근사값least squares approximation을 찾기 위한 선형회귀linear regression
  13. 13. z    x 2  xy  1  z x   x    i i i  z   xy  y 2   z y   y   i   i i  공(共)분산 행렬 covariance matrix  z   pi p i  T 1  zi pi  xy 제거   zi xi   z    x     xi2  z   zi yi    y     yi  2   
  14. 14. 8 PCF samples float lightVisibility_unrolled_circluar8(float3 lightCoord) { const float displace = .5 / depthMapResolution; const float displaceLong = 1.41421 * displace; float depths[8] = { tex2D(depthMap, lightCoord.xy + float2(-displaceLong,0)).x, tex2D(depthMap, lightCoord.xy + float2(displaceLong,0)).x, tex2D(depthMap, lightCoord.xy + float2(0,-displaceLong)).x, tex2D(depthMap, lightCoord.xy + float2(0,displaceLong)).x, tex2D(depthMap, lightCoord.xy + float2(-displaceLong,-displaceLong)).x, tex2D(depthMap, lightCoord.xy + float2(displaceLong,-displaceLong)).x, tex2D(depthMap, lightCoord.xy + float2(-displaceLong, displaceLong)).x, tex2D(depthMap, lightCoord.xy + float2(displaceLong, displaceLong)).x }; const float inverseCovariance = 1. / (1 + 1+ 2); float2 gradientVector = float2( depths[1] * 1.41421 + depths[5] + depths[7] -depths[0] * 1.41421 – depths[4] – depths[6], depths[3] * 1.41421 + depths[6] + depths[7] -depths[2] * 1.41421 – depths[4] – depths[5] ) * inverseCovariance; // continue with summation over PCF samples // using the average gradient }
  15. 15. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
  16. 16. • ShaderX4에서 봤던 Acne 제거 기술 복습 – Slope-scale depth bias, – Fuzzy depth comparison, – Linearly filtered depth values • 추가로 부드러운 그림자 가장자리(edge)를 만들기 위한 기술 – PCF – 샘플링 회수를 줄이기 위한 근사
  • nsdaler

    Aug. 18, 2013
  • DenisOvod

    Dec. 6, 2012

Views

Total views

2,424

On Slideshare

0

From embeds

0

Number of embeds

21

Actions

Downloads

23

Shares

0

Comments

0

Likes

2

×