(nrm, wi, wo, linearRoughness)
| 62 | ################################################################################ |
| 63 | |
| 64 | def 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 |
no test coverage detected