[Mobile shader] Dual Lobe GGX works

Unity3D URP

Dual Lobe GGX works

preview

Dual Lobe Debug view.

// Specular term
	half perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
	half roughness = PerceptualRoughnessToRoughness(perceptualRoughness);

	half a = roughness;
	half a2 = a*a;

	half d = nh * nh * (a2 - 1.h) + 1.00001h;
	half specularTerm = a2 / (max(0.1h, lh*lh) * (roughness + 0.5h) * (d * d) * 4);
	
	float Lobe0Roughness = max(saturate(specularTerm ), 0.002f);
	float Lobe1Roughness = clamp(specularTerm, 0.0, 100.0) *  _LobeWeight;
	
#if defined(DUAL_LOBE_GGX)
    float sAO = saturate(-0.3f + nv * nv);
    sAO =  lerp(pow(ao, 8.00f), 1.0f, sAO);
	half SpecularOcclusion = sAO;
	specularTerm = (Lobe0Roughness / 2 + Lobe1Roughness) * SpecularOcclusion ;
	return half4(specularTerm.xxx,1);
#else
	specularTerm = clamp(specularTerm, 0.0, 100.0); // Prevent FP16 overflow on mobiles
#endif

Liked it? Take a second to support leegoonz on Patreon!

One Comment on “[Mobile shader] Dual Lobe GGX works

  1. Pingback: Advanced Skin Shader for Next-Gen Mobile games. – leegoonz technical art director

댓글 남기기

%d 블로거가 이것을 좋아합니다: