0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

1,596

Published on

Published in: Technology, Education
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
1,596
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
15
0
Likes
2
Embeds 0
No embeds

No notes for slide

### Transcript

• 2. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
• 3. • Slope-scale depth bias – gradient를 depth bias에 사용 • Fuzzy depth comparison – 1 or 0이 아니라 0~1 값을 쓴다. • Linearly filtered depth values – point 샘플링이 아니라 보간 해서 사용. • 예) bilinear filter
• 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. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
• 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. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
• 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. incident light incident light surface surface shadow volume shadow volume PCF area PCF area
• 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. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
• 12. • depth map에 scalar depth 저장했을 때 – gradient vector : texture loockup 3번 • 추가로 depth sampling 한번, PCF에서 4번 • 전체 PCF 영역에서 평균 gradient를 근사 – 최소 제곱 근사값least squares approximation을 찾기 위한 선형회귀linear regression
• 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. 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. Overview of Gradient Shadow Maps Multisampling and PCF Merging the Algorithms Optimizing Texture Look-ups Conclusion
• 16. • ShaderX4에서 봤던 Acne 제거 기술 복습 – Slope-scale depth bias, – Fuzzy depth comparison, – Linearly filtered depth values • 추가로 부드러운 그림자 가장자리(edge)를 만들기 위한 기술 – PCF – 샘플링 회수를 줄이기 위한 근사