Skip to content

Implement Materials: Metal #31

@divyanshtiwari237

Description

@divyanshtiwari237

The material of a particular object determines the following:

  1. How/Whether the ray hitting an object is scattered.
  2. The level of attenuation in the scattered ray.

We already have a generic material class. Define a virtual function scatter in the material class.
Also, derive a class Metal from Material and implement the scatter function.

The scatter function can take in the following:

  1. A HitInfo object. This is implemented in this PR. This should provide all the necessary information needed.
  2. The initial ray.
  3. References to the attenuation color and the scattered ray.

In the case of metals, the scatter function is quite straightforward. Just obtain the reflected ray according to the laws of reflections. That will be the scattered ray.
Thus, update the scattered ray. The attenuation color in the case of metal can be any color.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions