MCPcopy Create free account
hub / github.com/3DAnimals/3DAnimals / bsdf_frostbite

Function bsdf_frostbite

model/render/renderutils/bsdf.py:64–79  ·  view source on GitHub ↗
(nrm, wi, wo, linearRoughness)

Source from the content-addressed store, hash-verified

62################################################################################
63
64def bsdf_frostbite(nrm, wi, wo, linearRoughness):
65 wiDotN = _dot(wi, nrm)
66 woDotN = _dot(wo, nrm)
67
68 h = _safe_normalize(wo + wi)
69 wiDotH = _dot(wi, h)
70
71 energyBias = 0.5 * linearRoughness
72 energyFactor = 1.0 - (0.51 / 1.51) * linearRoughness
73 f90 = energyBias + 2.0 * wiDotH * wiDotH * linearRoughness
74 f0 = 1.0
75
76 wiScatter = bsdf_fresnel_shlick(f0, f90, wiDotN)
77 woScatter = bsdf_fresnel_shlick(f0, f90, woDotN)
78 res = wiScatter * woScatter * energyFactor
79 return torch.where((wiDotN > 0.0) & (woDotN > 0.0), res, torch.zeros_like(res))
80
81################################################################################
82# Phong specular, loosely based on mitsuba implementation

Callers 2

frostbite_diffuseFunction · 0.85
bsdf_pbrFunction · 0.85

Calls 3

_dotFunction · 0.85
_safe_normalizeFunction · 0.85
bsdf_fresnel_shlickFunction · 0.85

Tested by

no test coverage detected