diffrp.materials.gltf_material#

class diffrp.materials.gltf_material.GLTFMaterial(base_color_factor: Tensor, base_color_texture: GLTFSampler, metallic_factor: float, roughness_factor: float, metallic_roughness_texture: GLTFSampler, normal_texture: GLTFSampler | None, occlusion_texture: GLTFSampler | None, emissive_factor: Tensor | None, emissive_texture: GLTFSampler, alpha_cutoff: float, alpha_mode: Literal['OPAQUE', 'MASK', 'BLEND'])#

Bases: SurfaceMaterial

A standard PBR material coherent with GLTF 2.0 Specifications.

__init__(base_color_factor: Tensor, base_color_texture: GLTFSampler, metallic_factor: float, roughness_factor: float, metallic_roughness_texture: GLTFSampler, normal_texture: GLTFSampler | None, occlusion_texture: GLTFSampler | None, emissive_factor: Tensor | None, emissive_texture: GLTFSampler, alpha_cutoff: float, alpha_mode: Literal['OPAQUE', 'MASK', 'BLEND']) None#
alpha_cutoff: float#
alpha_mode: Literal['OPAQUE', 'MASK', 'BLEND']#
base_color_factor: Tensor#
base_color_texture: GLTFSampler#
emissive_factor: Tensor | None#
emissive_texture: GLTFSampler#
metallic_factor: float#
metallic_roughness_texture: GLTFSampler#
normal_texture: GLTFSampler | None#
occlusion_texture: GLTFSampler | None#
roughness_factor: float#
shade(su: SurfaceUniform, si: SurfaceInput) SurfaceOutputStandard#

The interface for implementing materials. It takes a fragment batch specified as SurfaceUniform and SurfaceInput.

You shall not assume any order or shape of the fragment batch. In other words, the method should be trivial on the batch dimension, that is, the method should return batched outputs equivalent to concatenated outputs from the same batch of input but split into multiple sub-batches.

Most functions implemented with attribute accesses, element/vector-wise operations and DiffRP utility functions naturally have this property.

class diffrp.materials.gltf_material.GLTFSampler(image: torch.Tensor, wrap_mode: Literal['repeat', 'clamp', 'mirror'] = 'repeat', interpolation: Literal['point', 'linear'] = 'linear')#

Bases: object

__init__(image: Tensor, wrap_mode: Literal['repeat', 'clamp', 'mirror'] = 'repeat', interpolation: Literal['point', 'linear'] = 'linear') None#
image: Tensor#
interpolation: Literal['point', 'linear'] = 'linear'#
sample(uv: Tensor)#
wrap_mode: Literal['repeat', 'clamp', 'mirror'] = 'repeat'#