
74 II Rendering
float2 ComputeUV(
uint faceID , // From SV_PrimitiveID
float2 faceUV , // Position within the face
uint nLog2 , // Log2 of the resolution we want
int texWidth , // Atlas texture width
int resOffset , // Prefix sum for this resolution
int rowOffset , // Start of resolution block in atlas
int borderSize ) // Texel thickness of border on each face
{
// Here we assume a square aspect ratio .
// A non- square aspect would simply scale the height
// relative to width accordingly.
float faceWidth = 1 << nLog2;
float faceHeight = faceWidth;
float borderedFaceWidth = faceWidth + 2* borderSize;
float borderedFaceHeight = borderedFaceWidth;
int nFacesEachRow ...