Skip to content

12.1 Closest hit (raytrace.rchit) missing out value #78

@eidloi

Description

@eidloi

Hello,

I found an issue in the tutorial: The calculations to be added to the closest hit shader do not indicate the actual out value at the end of the code block.

So this block:

  // Vector toward the light
  vec3  L;
  float lightIntensity = pcRay.lightIntensity;
  float lightDistance  = 100000.0;
  // Point light
  if(pcRay.lightType == 0)
  {
    vec3 lDir      = pcRay.lightPosition - worldPos;
    lightDistance  = length(lDir);
    lightIntensity = pcRay.lightIntensity / (lightDistance * lightDistance);
    L              = normalize(lDir);
  }
  else  // Directional light
  {
    L = normalize(pcRay.lightPosition);
  }

should be extended with:

float dotNL = max(dot(worldNrm, L), 0.2);
prd.hitValue = vec3(dotNL);

There is also a weird sentence in the middle of the chapter that should be cleaned up: Those matrices are compute using the information provided we we set the TLAS and BLAS.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions