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

Function pbr_bsdf

model/render/renderutils/ops.py:355–386  ·  view source on GitHub ↗

Physically-based bsdf, both diffuse & specular lobes All tensors assume a shape of [minibatch_size, height, width, 3] or broadcastable equivalent unless otherwise noted. Args: kd: Diffuse albedo. arm: Specular parameters (attenuation, linear roughness, metalness). po

(kd, arm, pos, nrm, view_pos, light_pos, min_roughness=0.08, bsdf="lambert", use_python=False)

Source from the content-addressed store, hash-verified

353 return _get_plugin().pbr_bsdf_bwd(kd, arm, pos, nrm, view_pos, light_pos, ctx.min_roughness, ctx.BSDF, dout) + (None, None, None)
354
355def pbr_bsdf(kd, arm, pos, nrm, view_pos, light_pos, min_roughness=0.08, bsdf="lambert", use_python=False):
356 '''Physically-based bsdf, both diffuse & specular lobes
357 All tensors assume a shape of [minibatch_size, height, width, 3] or broadcastable equivalent unless otherwise noted.
358
359 Args:
360 kd: Diffuse albedo.
361 arm: Specular parameters (attenuation, linear roughness, metalness).
362 pos: World space position.
363 nrm: World space shading normal.
364 view_pos: Camera position in world space, typically using broadcasting.
365 light_pos: Light position in world space, typically using broadcasting.
366 min_roughness: Scalar roughness clamping threshold
367 bsdf: Controls diffuse BSDF, can be either 'lambert' or 'frostbite'
368
369 use_python: Use PyTorch implementation (for validation)
370
371 Returns:
372 Shaded color.
373 '''
374
375 BSDF = 0
376 if bsdf == 'frostbite':
377 BSDF = 1
378
379 if use_python:
380 out = bsdf_pbr(kd, arm, pos, nrm, view_pos, light_pos, min_roughness, BSDF)
381 else:
382 out = _pbr_bsdf_func.apply(kd, arm, pos, nrm, view_pos, light_pos, min_roughness, BSDF)
383
384 if torch.is_anomaly_enabled():
385 assert torch.all(torch.isfinite(out)), "Output of pbr_bsdf contains inf or NaN"
386 return out
387
388#----------------------------------------------------------------------------
389# cubemap filter with filtering across edges

Callers

nothing calls this directly

Calls 1

bsdf_pbrFunction · 0.85

Tested by

no test coverage detected