## pbrt-v3 source code now available

Practical and theoretical implementation discussion.
cozdas
Posts: 2
Joined: Wed Dec 14, 2011 10:57 pm

### Re: pbrt-v3 source code now available

Great news! Thanks for this book Matt, it's a real gem.

I've got one request though: It'd be great if you can release the book in "print replica" format. The format of the existing (v2) edition generates hard-to-follow page layouts with disproportional elements in the page (sample page attached to demonstrate my point). Realtime Rendering is a good example of the "print replica" format. With pbrt's larger pages and smaller texts it might be tricky to do but I'd appreciate if you at least consider that.

ziu
Posts: 29
Joined: Sat Aug 17, 2013 8:46 pm

### Re: pbrt-v3 source code now available

Thanks a lot for the code Matt! I have been using the CPU HLBVH builder code and been throwing all test scenes at it and so far it seems to be holding ok. I only had an issue with scenes where I had infinite size primitives (e.g. half-spaces in an extension I added) so I ended up removing those prior to construction.

toxie
Posts: 118
Joined: Mon Nov 28, 2011 12:30 pm
Location: germany
Contact:

### Re: pbrt-v3 source code now available

In https://github.com/mmp/pbrt-v3/blob/mas ... brt.h#L235 and https://github.com/mmp/pbrt-v3/blob/mas ... brt.h#L249
the checks for +0.0 and -0.0 are not correct, as by IEEE754 +0.0 == -0.0 is true. So you want to check this special case with the uint you're getting below instead.

EDIT: oh, forget about it, the code of course still will do what is actually needed. time to stop staring at code now, i guess..

ziu
Posts: 29
Joined: Sat Aug 17, 2013 8:46 pm

### Re: pbrt-v3 source code now available

I did a change to the code. I had issues with some scenes with abnormal bounding boxes (too small) blowing up the program by triggering this assert :

Code: Select all

Assert(centroidBounds.pMax[dim] != centroidBounds.pMin[dim]);

https://github.com/mmp/pbrt-v3/blob/mas ... h.cpp#L527

So I changed the code in BVHAccel::buildUpperSAH to be like this:

Code: Select all

int mid;
if (centroidBounds.pMax[dim] != centroidBounds.pMin[dim]) {
// do the fancy split position finding method.
mid = pmid - treelet_roots;
} else {
mid = start + (end - start)/2;
}

I know its a bit of a hack, but at least it can still find a split point somewhere and generate a viable BVH.

Hope it helps,