Completed Metal implementation
This commit is contained in:
@@ -29,9 +29,9 @@ void closestHit(inout RayPayload hitValue, in BuiltInTriangleIntersectionAttribu
|
||||
|
||||
float3 normalLight = dot(vert.normal, WorldRayDirection()) < 0 ? vert.normal : -vert.normal;
|
||||
|
||||
MaterialParameter mat; // TOOD:
|
||||
|
||||
hitValue.depth++;
|
||||
MaterialParameter mat = pParams.materialData[m.materialIndex];
|
||||
float3 emissive = mat.emissive_type.xyz;
|
||||
|
||||
float3 localAccRad = float3(0);
|
||||
float3 rnd = rand01(uint3(vertexIndex0, vertexIndex1, vertexIndex2));
|
||||
//float kt = ka + ks;
|
||||
@@ -103,7 +103,7 @@ void closestHit(inout RayPayload hitValue, in BuiltInTriangleIntersectionAttribu
|
||||
localAccRad += mat.shade(vert.normal, -WorldRayDirection(), normalize(l), pParams.pointLights[i].color);
|
||||
}
|
||||
}
|
||||
hitValue.light += localAccRad;
|
||||
hitValue.light += localAccRad + emissive;
|
||||
// Indirect Illumination: cosine-weighted importance sampling
|
||||
if(hitValue.depth < 12) {
|
||||
float r1 = 2 * PI * rnd.x, r2 = rnd.y, r2s = sqrt(r2);
|
||||
|
||||
Reference in New Issue
Block a user