Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
// Writing to display services. 'ciChannelId' is the id associated with the 'Ci' channel.
RixDisplayServices* displayServices = integratorContext.GetDisplayServices();

// These point to the final contribution and alpha values we want to splat to the pixels.
RtColorRGB* finalContributions = ...;  // of size shadingContext->numPts
RtColorRGB* finalAlpha = ...;          // of size shadingContext->numPts

for (int i = 0; i < shadingContext.numPts; i++)
{
    displaySvc->Splat(ciChannelId, shadingContext.integratorCtxIndex[i], finalContributions[i]);
    displaySvc->WriteOpacity(ciChannelId, shadingContext.integratorCtxIndex[i], finalAlpha[i]);
}


Random Number Generation

TODO: Discuss RixIntegratorContext::rngCtx and how to correctly use to make sure stratification happens correctly. Discuss trajectory splittingYou can find more about using RixRNG here. This document will help you understand how to improve sampling strategies.

Indirect Rays

In addition to compute direct lighting (as described above), physically-based integrators also need to deal with indirect lighting. This is done by casting secondary rays from the camera hits, and performing a full lighting computing on the secondary hit points. Since this involves both computing direct and indirect lighting, this is a recursive process.

...

Code Block
RixIntegrator::Integrate(numSCtxs, sCtxs)
	ComputeLightTransport(numSCtxs, sCtxs)
	Splat results to display services

ComputeLightTransport(numSCtxs, sCtxs)
	For each shading context sCtx:
		ComputeDirectLighting(sCtx)
		ComputeIndirectLighting(sCtx)

ComputeDirectLighting(sCtx)
	InitializeLightingServices()
	GenerateLightSamples() 
	EvaluateBxdfSamples()
	Compute MIS weights
	GenerateBxdfSamples()
	EvaluateLightSamples()
	Compute MIS weights

ComputeIndirectLighting(sCtx)	
	iRays = CreateIndirectRays(sCtx)
	(numSCtxs, sCtxs) = TraceIndirectRays(iRays)
	ComputeLightTransport(numSCtxs, sCtxs)

...


Ray Differentials & Ray Spreads

...