GPU Gems 3 Chapter 13. Volumetric Light Scattering as a Post-Process. http://www.kindnap.pe.kr http://cafe.naver.com/shader. introduction. 간단한 후처리 방법으로 대기중의 그림자에 반응하는 volumetric light scattering 효과를 구현해본다 . Figure 13-1 Volumetric Light Scattering on a Highly Animated Scene in Real Time.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Figure 13-1 Volumetric Light Scattering on a Highly Animated Scene in Real Time
Example 13-1. Post-Process Shader Implementation of Additive Sampling
float4 main(float2 texCoord : TEXCOORD0) : COLOR0
// Calculate vector from pixel to light source in screen space.
half2 deltaTexCoord = (texCoord - ScreenLightPos.xy);
// Divide by number of samples and scale by control factor.
deltaTexCoord *= 1.0f / NUM_SAMPLES * Density;
// Store initial sample.
half3 color = tex2D(frameSampler, texCoord);
// Set up illumination decay factor.
half illuminationDecay = 1.0f;
// Evaluate summation from Equation 3 NUM_SAMPLES iterations.
for (inti = 0; i < NUM_SAMPLES; i++)
// Step sample location along ray.
texCoord -= deltaTexCoord;
// Retrieve sample at new location.
half3 sample = tex2D(frameSampler, texCoord);
// Apply sample attenuation scale/decay factors.
sample *= illuminationDecay * Weight;
// Accumulate combined color.
color += sample;
// Update exponential decay factor.
illuminationDecay *= Decay;
// Output final color with a further scale control factor.
return float4( color * Exposure, 1);
- 동영상 -