so i'm working on trying to emulate as much of the UE4 tech paper that was released a little while back.
http://www.unrealengine.com/files/downloads/2013SiggraphPresentationsNotes.pdf
so far i've gotten the BRDF working, it's really nice, and it works with cubemap blurring. i'll be making a bunch of custom/pre-filtered cubemaps to go with it soon. but in the mean time the biggest thing that's missing is the image based lighting to go with it.
the biggest issue i'm having, is the way it samples the cubemap texture. it uses something called "hammersley" as one of its values. i did some research and i found what that is.
it's a numeric pattern to generate sampling points on a hemisphere. it also generates matching coordinates in 2d.
http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html#sec-PointsOnSphere
i am quite literally tearing my hair out trying to get that value working in udk. once i have it working, *vadervoice* the circle is complete.
Replies
Regardless of if it was fed a constant or variable for number of loops.
This pretty well precludes the entire importance sample and gather functions and rather destroys the idea of implementing that in identical fashion within the existing UDK framework.
Best thing I can recommend within UDK's present limits is to either use one or more pre-blurred cubemaps and interpolate between them based on your roughness, or use one of the cubemap blurring routines that have shown up here on Polycount.
My method (basic node based, non mipmap reliant)
DrAlex789's method. (custom node based, mip-reliant)
and i was already using one of those methods
thanks!
Sorry its not a "here's how to do it" solution. If we COULD utilize a for loop we'd have so many nice effects possible. (of course we'd have lots of crashy shaders along the way too.. loop constructs can be problematic)
Also from the looks of things I'd go with DrAlex's method. It looks to be cheaper since its a MIP lookup rather than an analytic blur.
If you convert that first function to a udk custom node, then the second function as either its own custom node or an equivalent set of UDK nodes you'll have what you need to calculate the points to sample from.
To get the domain to pick from, just use a texcoord node and turn it into a stepped gradient. you can then plug (i) into the radicalInverse function as above to get the Y(orGreen) value for the point to sample. X coord is i/N. Put them together with an append vector node.
Now as far as where to go from here.. I'm running into a bit of a mental brick wall. Don't have UDK accessible at the moment to do actual testing.
maybe we can work together on getting this in. =]