- Geometry Pass
Depth(xy), Normal(xy) Geometry Buffer(이하 G-Buffer) 저장 - Light Properties Pass
아래 최종 색상 식에 미리 계산된 항목을 Light Buffer(이하 L-Buffer)
최종 색상 = Ambient + Shadow * Att * (N.L * diffuseColor * diffuseIntensity * diffuseLightColor + R.V^n * specularColor * specularIntensity * specularLightColor )
Light Properties
- N.L
- LightColor (Diffuse, Specular)
- R.V^n
- Attenuation
Light Texture(A8R8G8B8 format)
- Channel 1 : diffuseLightColor.r * N.L * Att
- Channel 2 : diffuseLightColor.g * N.L * Att
- Channel 3 : diffuseLightColor.b * N.L * Att
- Channel 4 : R.V^n * N.L *Att
아래는 관련 Shader Code 입니다.half4 ps_main( PS_INPUT Input ) : COLOR
{
half4 G_Buffer = tex2D( G_Buffer, Input.texCoord );// Compute pixel position
half Depth = UnpackFloat16( G_Buffer.zw );
float3 PixelPos = normalize(Input.EyeScreenRay.xyz) * Depth;// Compute normal
half3 Normal;
Normal.xy = G_Buffer.xy*2-1;
Normal.z = -sqrt(1-dot(Normal.xy,Normal.xy));// Computes light attenuation and direction
float3 LightDir = (Input.LightPos – PixelPos)*InvSqrLightRange;
half Attenuation = saturate(1-dot(LightDir / LightAttenuation_0, LightDir / LightAttenuation_0));
LightDir = normalize(LightDir);// R.V == Phong
float specular = pow(saturate(dot(reflect(normalize(-float3(0.0, 1.0, 0.0)), Normal), LightDir)), SpecularPower_0);float NL = dot(LightDir, Normal)*Attenuation;
return float4(DiffuseLightColor_0.x*NL, DiffuseLightColor_0.y*NL, DiffuseLightColor_0.z*NL, specular * NL);
} - Geometry-2 Pass
G-Buffer와 L-Buffer에 값을 가지고 최종 색상을 계산
아래는 관련 Shader Code입니다.float4 ps_main( PS_INPUT Input ) : COLOR0
{
float4 Light = tex2D( Light_Buffer, Input.texCoord );
float3 NLATTColor = float3(Light.x, Light.y, Light.z);
float3 Lighting = NLATTColor + Light.www;return float4(Lighting, 1.0f);
} - Forward Rendering
Translucency Objects Rendering(back to front)
2011년 1월 14일 금요일
Light Pre-Pass Renderer
2011년 1월 10일 월요일
D3D이용 2D출력시 마법의 숫자 -0.5 에 대하여
원본 : www.gamza.net
|
피드 구독하기:
덧글 (Atom)
Mac에서 CapCut 캐시를 외장 SSD로 옮기는 방법 (저장공간 절약 + 속도 유지)
영상 편집을 하다 보면 CapCut 캐시와 프록시 파일 때문에 맥 저장공간이 빠르게 줄어드는 경우가 많습니다.특히 쇼츠나 영상 편집을 자주 하는 경우 100GB 이상 캐시가 쌓이는 상황 도 흔합니다. Mac에서는 심볼릭 링크(syml...
-
원본으로 이동 소요유 (2002-09-26 09:02:19) 흠~ 그 동네에서도 나오는 모양이군요. 입체각을 이해하기 위해서는 빛을 예로드는 것이 편리합니다. 랜턴을 안개낀 날 밤에 비추면 빛의 세기는 거리에 따라 제곱분에 일로 ...
-
2026 WBC에서 외국계 선수들이 한국 대표팀으로 출전할 수 있는 이유는 다음과 같습니다. 1. WBC는 국적뿐 아니라 혈통 기준도 인정 2. 부모 또는 조부모가 한국인이면 출전 가능 3. MLB 주도의 국제대회라 규정이 유연 4. 다른 국가들도 ...
-
React보다 Vue3를 더 많이 사용하는 이유? 실제 프로젝트에서 느낀 프레임워크 선택 기준 프론트엔드 개발을 이야기할 때 가장 먼저 떠오르는 라이브러리 중 하나가 바로 React 입니다. React는 글로벌 시장에서 매우 높은 점유율을 가지고 ...