More Related Content
Similar to [0326 박민근] deferred shading
Similar to [0326 박민근] deferred shading (20)
More from MinGeun Park (20)
[0326 박민근] deferred shading
- 23. Deferred Shading for each objectdo G-buffer= lighting properties of object; for each light do framebuffer+= light_model(G-buffer,light);
- 80. Diffuse 값과, Specular 값은 별도로 저장한다.For each light: diffuse += diffuse(G-buff.N, L)) specular += G-buff.spec* specular(G-buff.N, G-buff.P, L)
- 82. Per-Pixel Lighting float4 PointLightingPS(VS_OUTPUT1 In) : COLOR { half4 diffuseTex = tex2D(MRT0Sampler, In.TexCoord); half4 normalTex = tex2D(MRT1Sampler, In.TexCoord); half z = tex2D(MRT2Sampler, In.TexCoord); //unpack half3 albedo = diffuseTex.xyz; … //reconstruct original view-space position … //normalize … //diffuse lighting half NdotL = dot(normal, lightVec); half selfShadow = (NdotL > 0) ? 1 : 0; half3 diffuse = albedo * NdotL * selfShadow * LightColor;
- 83. Per-Pixel Lighting float4 PointLightingPS(VS_OUTPUT1 In) : COLOR { (앞페이지…) //compute half angle half3 halfAngle = normalize(lightVec + eyeVec); half3 specular = max(pow(dot(halfAngle, normal), SpecularExponent), 0) * selfShadow; … (후략) }