pbr_shaders

Functions

basic_pbr_shader(vertex_location, vertex_normal, albedo_color, camera_location, light_origin, light_color, light_intensity, ambient_light_intensity, smoothness=0.5, metallicness=0.5)[source]

Implements a simplified physics-based rendering shader, using smoothness and metallicness to define diffuse and specular lighting.

Parameters:
  • vertex_location ((np.ndarray)) – The 3D location of the vertex to be shaded.

  • vertex_normal ((np.ndarray)) – The surface normal vector at the vertex point (need not be normalized).

  • albedo_color ((np.ndarray)) – The albedo/base RGBG color of the material.

  • camera_location ((np.ndarray)) – The 3D location of the camera/viewer.

  • light_origin ((np.ndarray)) – The 3D location of the point light source.

  • light_color ((np.ndarray)) – The RGB color of the light.

  • light_intensity (float) – The intensity/brightness of the light source.

  • ambient_light_intensity (float) – The intensity of ambient scene lighting, ranges from 0 (no light) to 1.

  • smoothness ((float)) – The smoothness of the material [0, 1]. 0=rough, 1=smooth.

  • metallicness ((float)) – The metallicness property of the material [0, 1]. 0=dielectric, 1=metal.

Returns:

The final computed RGB color for the vertex.

Return type:

np.ndarray

default_shader(vertex_location, vertex_normal, albedo_color, camera_location, light_origin, light_color, light_intensity, ambient_light_intensity)[source]

Implements just diffuse lighting.

Parameters:
  • vertex_location ((np.ndarray)) – The 3D location of the vertex to be shaded.

  • vertex_normal ((np.ndarray)) – The surface normal vector at the vertex point (need not be normalized).

  • albedo_color ((np.ndarray)) – The albedo/base RGBG color of the material.

  • camera_location ((np.ndarray)) – The 3D location of the camera/viewer.

  • light_origin ((np.ndarray)) – The 3D location of the point light source.

  • light_color ((np.ndarray)) – The RGB color of the light.

  • light_intensity (float) – The intensity/brightness of the light source.

  • ambient_light_intensity (float) – The intensity of ambient scene lighting, ranges from 0 (no light) to 1.

Returns:

The final computed RGB color for the vertex.

Return type:

np.ndarray

null_shader(vertex_location, vertex_normal, albedo_color, camera_location, light_origin, light_color, light_intensity, ambient_light_intensity)[source]
Parameters:
  • light_intensity (float)

  • ambient_light_intensity (float)