Original Post
I'm working on my planetary renderer, which is currently calculating vertex positions, displacement and normal vectors on the cpu.
Given the scale I'm working at, this is quite slow. (about 250ms on an i7-2600k per update for high lod levels)
I want to attempt to gradually move calculations over to the GPU, but I'm a bit puzzled as to how to generate my normal vectors if I do so.
On the GPU I'll only have access to the current non-displaced vertex position and a heightmap for the current terrain patch.
I have generated normal vectors on the GPU before using this technique: http://www.catalinzima.com/2008/01/converting-displacement-maps-into-normal-maps/
But unfortunately this technique and similar ones assume that the terrain is horizontal, which mine is not.
I thought about using a rotation matrix per patch to transform the generated normal vectors, but I can only see that working at very high levels of detail, where the (non-displaced) terrain is nearly flat.
Any ideas how I could do this?
Cheers,
Hyu
Given the scale I'm working at, this is quite slow. (about 250ms on an i7-2600k per update for high lod levels)
I want to attempt to gradually move calculations over to the GPU, but I'm a bit puzzled as to how to generate my normal vectors if I do so.
On the GPU I'll only have access to the current non-displaced vertex position and a heightmap for the current terrain patch.
I have generated normal vectors on the GPU before using this technique: http://www.catalinzima.com/2008/01/converting-displacement-maps-into-normal-maps/
But unfortunately this technique and similar ones assume that the terrain is horizontal, which mine is not.
I thought about using a rotation matrix per patch to transform the generated normal vectors, but I can only see that working at very high levels of detail, where the (non-displaced) terrain is nearly flat.
Any ideas how I could do this?
Cheers,
Hyu