DirectX11

[DirectX11] Disney Diffuse

mstone8370 2023. 12. 12. 18:38

 
지금까지는 Diffuse로 램버트의 코사인 법칙만 적용했는데 디즈니의 BSDF에 사용되는 Diffuse 모델이 있어서 적용해봤다.
 
아래 내용들을 참고해서 적용했다.
https://lifeisforu.tistory.com/350

 

[ 번역 ] Physically-Based Shading at Disney

원문 : https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf 주의 : 번역이 개판이므로 이상하면 원문을 참조하세요. 주의 : 허락받고 번역한 것이 아니므로 언제든 내려갈 수 있습니

lifeisforu.tistory.com

https://schuttejoe.github.io/post/disneybsdf/

 

Rendering the Moana Island Scene Part 1: Implementing the Disney BSDF

$\newcommand{\i}{\textit{i}}$ $\newcommand{\o}{\textit{o}}$ $\newcommand{\n}{\textit{n}}$ $\newcommand{\h}{\textit{h}}$ $\newcommand{\v}{\textit{v}}$ $\newcommand{\x}{\textit{x}}$ $\newcommand{\y}{\textit{y}}$ $\newcommand{\ht}{\textit{h}_t}$ Intro The Dis

schuttejoe.github.io

https://illu.tistory.com/1465

 

PBR-BRDF-Disney-Unity-1

원문 : https://developpaper.com/pbr-brdf-disney-unity-1/ Disney BRDF source code : https://github.com/wdas/brdf/blob/main/src/brdfs/disney.brdf GitHub - wdas/brdf: BRDF Explorer BRDF Explorer. Contribute to wdas/brdf development by creating an account on

illu.tistory.com

https://cseweb.ucsd.edu/~tzli/cse272/wi2023/homework1.pdf
 
 
 


 
 
 
Diffuse 함수는 다음과 같다.
 

 

float3 DisneyDiffuse(float LdotH, float NdotL, float NdotV, float3 baseColor, float roughness)
{
    float FD90 = 0.5f + 2 * LdotH * LdotH * roughness;
    float LightScatter = 1 + (FD90 - 1) * pow(1 - NdotL, 5);
    float ViewScatter = 1 + (FD90 - 1) * pow(1 - NdotV, 5);
    return baseColor * LightScatter * ViewScatter / PI;
}



// ... 
float NdotV = saturate(dot(Normal, ViewDir));
float NdotL = dot(Normal, LightDir);
float LdotH = dot(LightDir, HalfDir);

float3 DD = DisneyDiffuse(LdotH, NdotL, NdotV, Diffuse, Roughness);

float3 LightAmount = saturate(NdotL) * PI;
float3 finalColor = LightAmount * DD;

Diffuse 함수에서 pi로 나누기 때문에 차이를 확인하기 위해서 빛의 세기로 pi를 지정했다.
 
결과는 다음과 같다.
Roughness는 0.5로 했다.
 

왼쪽: BaseColor, 오른쪽: Disney Diffuse

차이를 구해보면 이정도 차이가 난다.
 

Diff

 
이전에 구현했던 Specular를 더하면 이렇게 된다.
 

Diffuse + Specular