开发者

Displacement mapping

开发者 https://www.devze.com 2023-02-05 15:49 出处:网络
What exactly are the benefits of displacement maps? Do they actually speed up rendering of higher count polys at all, or is it just a nifty trick for artists and in-engine tools to 开发者_StackOverflo

What exactly are the benefits of displacement maps? Do they actually speed up rendering of higher count polys at all, or is it just a nifty trick for artists and in-engine tools to 开发者_StackOverflow中文版temporarily lower the poly count? The only real thing I could see it used for is maybe level of detail algorithms, but only at much greater distances.


Well it can provide a more compact structure for rendering high poly models. A displacement map can contain as few as 1 byte per pixel. If you tesselate that up for displacement mapping then you are saving a HUGE amount of memory bandwidth on the GPU.

Image for a second a simple vertex struct.

struct Vert
{
    float x, y, z;
    float nx, ny, nz;
    float u, v;
};

That struct is 32 bytes in size. So if you imagine that you can quarter the number of vertices (and you ought to be able to do a HELL of a lot more than that) and replace all other vertices with a 1 byte height map then you the amount of memory used works out as follows:

100,000 poly object = 3,200,000 bytes using vertex struct alone.
25,000 polys + 100,000 entry height map = 900,000 bytes.

ie dispalcement mapping provides you with the same data in 28% of the memory. WIN! :D

If you store a normal map and use the w/a component for height then you use up 400000 bytes for the texture and you are now 1,200,000 bytes in size which is STILL 37.5% of the size. PLUS you can now remove 12 bytes for normal storage and you are really down to the same figure of 900,000 bytes.

You ought to be able to get SIGNIFICANTLY higher geometry compression rates than that. So, in summary, you get a better looking model for a fraction of the storage data.

As an added bonus, using the normal map/height map system you can also easily scale so that less powerful machines simply use the normal data and you still get reasonably good results.

0

精彩评论

暂无评论...
验证码 换一张
取 消