Gpu Gems 3 Chapter 24 The Importance of


























- Slides: 26
Gpu Gems 3 Chapter 24. The Importance of Being Linear http: //www. kindnap. pe. kr http: //cafe. naver. com/shader
Renderers Are Linear 보정후 / 보정전
�R 8 G 8 B 8_S
Manually Converting Color Values to a Linear Space �float 3 diffuse. Col = pow( f 3 tex 2 D( diff. Tex, tex. Coord ), 2. 2 ); Or (cheaper, but assuming gamma of 2. 0 rather than 2. 2) �float 3 diffuse. Col = f 3 tex 2 D( diff. Tex, tex. Coord ); �fuse. Col = diffuse. Col * diffuse. Col;
Last-Stage-Output Gamma Correction � float 3 final. Col = do_all_lighting_and_shading(); �float pixel. Alpha = compute_pixel_alpha(); �return float 4(pow(final. Col, 1. 0 / 2. 2), pixel. Alpha); � // Or (cheaper, but assuming gamma of 2. 0 rather than 2. 2) return float 4( sqrt( final. Col ), pixel. Alpha );
Test code � //Gamma Control Set Gamma value � v. Tex. Diffuse. rgb = � pow(abs(v. Tex. Diffuse. rgb), 2. 2 f) * v. Tex. Diffuse. rgb; � v. Tex. Diffuse 1. rgb = � pow(abs(v. Tex. Diffuse 1. rgb), 2. 2 f) * v. Tex. Diffuse 1. rgb; � v. Tex. Diffuse 2. rgb = � pow(abs(v. Tex. Diffuse 2. rgb), 2. 2 f) * v. Tex. Diffuse 2. rgb; � v. Tex. Diffuse 3. rgb = � pow(abs(v. Tex. Diffuse 3. rgb), 2. 2 f) * v. Tex. Diffuse 3. rgb; � v. Tex. Diffuse. rgb = lerp( v. Tex. Diffuse. rgb, v. Tex. Diffuse 1. rgb, v. Sp. Weight. x ); � v. Tex. Diffuse. rgb = lerp( v. Tex. Diffuse. rgb, v. Tex. Diffuse 2. rgb, v. Sp. Weight. y ); � v. Tex. Diffuse. rgb = lerp( v. Tex. Diffuse. rgb, v. Tex. Diffuse 3. rgb, v. Sp. Weight. z );
� PS_Render. Output_2 o; � o. f 40 = float 4( pow( abs(o. f 40. rgb), 1. 0 f/2. 2 f), 1. 0 f );
� //Run Gamma value � v. Tex. Diffuse = float 4( pow( abs(v. Tex. Diffuse. rgb), 1. 0 f/2. 2 f), 1. 0 f );
� v. Tex. Diffuse. rgb = /* v. Tex. Diffuse. rgb * */ pow(abs(v. Tex. Diffuse. rgb), 2. 2 f); � o. f 40 = float 4( pow( abs(o. f 40. rgb), 1. 0 f/2. 5 f), 1. 0 f );
참고자료 �http: //en. wikipedia. org/wiki/Gamma_correction �http: //jufoot. egloos. com/1960058 �http: //cagetu. egloos. com/5148378 �http: //www 1. devpia. com/Maeul/Contents/Detail. aspx ? Board. ID=51&MAEULNO=20&no=8350&page=1