MCPcopy Create free account
hub / github.com/RenderKit/embree / renderPixelFunction

Function renderPixelFunction

tutorials/pathtracer/pathtracer_device.cpp:1474–1602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1472}
1473
1474Vec3fa renderPixelFunction(const TutorialData& data, float x, float y, RandomSampler& sampler, const ISPCCamera& camera, RayStats& stats, const RTCFeatureFlags features)
1475{
1476 /* radiance accumulator and weight */
1477 Vec3fa L = Vec3fa(0.0f);
1478 Vec3fa Lw = Vec3fa(1.0f);
1479 Medium medium = make_Medium_Vacuum();
1480 float time = RandomSampler_get1D(sampler);
1481
1482 /* initialize ray */
1483 Ray ray(Vec3fa(camera.xfm.p),
1484 Vec3fa(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz)),0.0f,inf,time);
1485
1486 DifferentialGeometry dg;
1487
1488 /* iterative path tracer loop */
1489 for (int i=0; i<data.max_path_length; i++)
1490 {
1491 /* terminate if contribution too low */
1492 if (max(Lw.x,max(Lw.y,Lw.z)) < 0.01f)
1493 break;
1494
1495 /* intersect ray with scene */
1496 RayQueryContext context;
1497 InitIntersectionContext(&context);
1498 context.tutorialData = (void*) &data;
1499
1500 RTCIntersectArguments args;
1501 rtcInitIntersectArguments(&args);
1502 args.context = &context.context;
1503 args.flags = (i == 0) ? data.iflags_coherent : data.iflags_incoherent;
1504 args.feature_mask = features;
1505#if USE_ARGUMENT_CALLBACKS && ENABLE_FILTER_FUNCTION
1506 args.filter = nullptr;
1507#endif
1508
1509 rtcTraversableIntersect1(data.traversable,RTCRayHit_(ray),&args);
1510 RayStats_addRay(stats);
1511 const Vec3fa wo = neg(ray.dir);
1512
1513 /* invoke environment lights if nothing hit */
1514 if (ray.geomID == RTC_INVALID_GEOMETRY_ID)
1515 {
1516 //L = L + Lw*Vec3fa(1.0f);
1517
1518 /* iterate over all lights */
1519 for (unsigned int i=0; i<data.ispc_scene->numLights; i++)
1520 {
1521 const Light* l = data.ispc_scene->lights[i];
1522 //Light_EvalRes le = l->eval(l,dg,ray.dir);
1523 Light_EvalRes le = Lights_eval(l,dg,ray.dir);
1524 L = L + Lw*le.value;
1525 }
1526
1527 break;
1528 }
1529
1530 Vec3fa Ns = normalize(ray.Ng);
1531

Callers 1

renderPixelStandardFunction · 0.70

Calls 15

make_Medium_VacuumFunction · 0.85
RandomSampler_get1DFunction · 0.85
InitIntersectionContextFunction · 0.85
RTCRayHit_Function · 0.85
RayStats_addRayFunction · 0.85
negFunction · 0.85
Lights_evalFunction · 0.85
Material__preprocessFunction · 0.85
Material__sampleFunction · 0.85
RandomSampler_get2DFunction · 0.85
Lights_sampleFunction · 0.85

Tested by

no test coverage detected