Transparency 가 뭔가 ? Deferred Rendering 의 단점인 Transparency. 그래서 , DRT 알고리즘 개발
Transparency, Deferred Rendering, DRT
깊이 , 노말 그리고 스페큘라 요소들이 확산광과 반영반사를 계산하기 위해 사용되고 , 나중에 albedo 색과 조합되어 최종 이미지를 만든다
Geometry phase 오브젝트 메쉬 데이트를 사용하는 유일한 phase. objects, color, position, normal, 그리고 추가적인 lighting factor 들이 Render Target 에 쓰여짐 Lighting phase Light 들은 screen-space 에서 적용됨 Composition phase G-phase 에서의 Color buffer 와 L-phase 에서의 lighting 이 조합됨 . Post-processing phase 다양한 효과들이 최종 이미지를 만들어 내기 위해 적용됨 . Motion blur, Volumetric fog, DOF, HDR 등 .
Deferred Rendering 에서의 Transparency 는 대게 렌더링 파이프라인을 2 부분으로 나눠서 해결한다
[ wikipedia ] Alpha to coverage is a multisampling computer graphics technique useful for situations where dense foliage or grass must be rendered in a video game . This technique uses the alpha channel of textures as a coverage mask for anti-aliasing . Alpha to coverage multisampling is based on regular multisampling, except that the alpha coverage mask is ANDed with the multisample mask. Alpha-to-coverage converts the alpha component output from the pixel shader to a coverage mask. When the multisampling is applied each output fragment gets a transparency of 0 or 1 depending on alpha coverage and the multisampling result. http://forum.beyond3d.com/showthread.php?t=21414 http://kyruie.tistory.com/88#footnote_link_88_1
Normal rendering with 2xAA | Alpha-to-Coverage with 2xAA ----------------------+----------------------- Normal rendering with 6xAA | Alpha-to-Coverage with 6xAA
[ Lighting glitch ] 이 현상이 맞나 몰겠네요… 같이 보면서 의논 필요 . http://www.youtube.com/watch?v=VlCGEq0jwS4 이런 이미지도… http://img525.imageshack.us/img525/3210/hairlightingbugsxo5.jpg
모든 투명 픽셀들은 interlace 되어 렌더링 홀수 horizontal line 들만 렌더되고 픽셀 알파 값은 알파 채널에 저장됨 간단한 픽셀 쉐이더와 알파가 0 인 홀수 라인들만을 걸러내는 알파 테스트
현재 픽셀과 이것의 바로 위의 픽셀의 최소 알파값을 구함 최소 알파 값이 1 보다 작다면 , 양 픽셀은 서로 블렌드되고 de-interlaced 됨
여기서 기술된 내용은 픽셀쉐이더 3 를 기반으로 하지만 2 로도 쉽게 적용될 수 있다 . 또 , 수평 라인에 대한 transparency blend 를 수행하지만 , 수직 또는 지그재그 패턴 역시 구현 가능하다 . G-buffer 생성 phase 에서 모든 투명 / 불투명 오브젝트를 그린다 . 이때 알파 소트 필요없고 , 투명 오브젝트를 나눠서 그리지 않는다 . 하지만 front to back 정렬은 항상 유용하다 . current H/W 는 매우 빠르게 reject 가능하기 때문 . 알파 테스팅을 활성화 시킴 . 알파가 0 인 odd line 을 걸러내기 위함 . 픽셀 쉐이더에서 ... 홀수 라인의 투명 픽셀들의 값을 zero 로 설정하여 알파테스트에서 걸러지도록 . 짝수 라인은 변경되지 않는다 이 방법은 최종 이미지에서 조합될 interlaced transparent object 들을 생성한다 . 이 phase 후에 , deferred rendering 에서 하던 데로 lighting pass 를 수행한다 .
이 phase 에서 , color 와 lighting render target 들이 최종 이미지로 조합된다 . 픽셀 쉐이더는 투명 오브젝트를 백그라운드와 de-interlace 시키고 blend 시킨다 . 모든 픽셀들이 처리됨을 명시 , 그렇지 않으면 투명 오브젝트는 de-interlaced 될 수 없다 . 픽셀 쉐이더는 2 위치에서 샘플링한다 . 현재 픽셀과 이것의 바로 위 픽셀의 color 와 light 이 두 컬러의 최소 알파값이 . 두 픽셀을 블렌드하기 위해 사용된다 .
두 픽셀만을 취하면 알파 블렌드 되는 부분의 경계에서 artifacts 가 발생함 바로 위 뿐만이 아니라 바로 아래에서도 한 번 더 샘플링하여 해결
두 픽셀만을 취하면 알파 블렌드 되는 부분의 경계에서 artifacts 가 발생함 바로 위 뿐만이 아니라 바로 아래에서도 한 번 더 샘플링하여 해결
normal deferred rendering 과 비교해서 약 2.2% 의 Speed Hit 만이 있을 뿐
간단한 구현으로 높은 퍼포먼스의 투명 / 불투명 오브젝트간 lighting consistency 를 보여주는 알고리즘 제공