Karl vom Berge wrote:Another technique is to directly raytrace the displaced geometry, this technique might be interesting (I'm no expert in displacement mapping though

):
Direct Ray Tracing of Displacement Mapped Triangles by Brian Smits, Peter Shirley and Michael M. Stark.
I ported my pbrt implementation of this technique a few months ago but I did not find time to do extensive testing. The few test I did indicate that it is significantly slower than subdividing in a preprocess (though i do not have any concrete numbers as Lux lacks the statistics system from pbrt AFAIK), I could do some test with my older pbrt code. At oblique angles on surfaces with large displacements, the number of microtriangles tested (and texture lookups) is very high (could be up to O(N) for a quad, i.e. 2 triangles, implicitely subdivided in NxNx2 triangles). The advantage is obviously that memory usage is very limited and the subdivision level can be chosen for each ray.
I see 2 solutions to this:
- combine it with a regular subdivision:
first subdivide the triangles (ex. with the current method) to avoid large differences in displacements on a single triangle
This should be quite simple to implement.
- use some kind of hierarchical variant of the proposed algorithm:
do not immediately test the smallest level but use some levels in between to discard entire regions
This will probably require a bit more work and I'm not convinced yet that it will be really usefull. A initial subdivision in a preprocess will certainly be much faster at discarding parts of the triangle and memory usage should be acceptable
I was planning on trying both ideas out myself, but as I'm a student I just lack the time (exams etc.) for this until July.
Anyway, I'll see if I can do a simple comparison with the current disp. mapping implementation tonight. It will probably be a simple plane with a rocks displacement map but if someone can provide other geometry (couldn't get blender to export uv coordinates on the monkey) or displacement maps, I'll also test them.