Difference between revisions of "Parallax map"
(categories) |
(CategoryTextureTypes) |
||
Line 82: | Line 82: | ||
---- | ---- | ||
− | [[Category:Texturing]] [[Category:BumpMap]] | + | [[Category:Texturing]] [[Category:TextureTypes]] [[Category:BumpMap]] |
Revision as of 10:13, 31 July 2010
Contents
Parallax Map
Parallax mapping is a technique for real-time approximation of displacement mapping, sometimes called "virtual displacement mapping." Each pixel's texture coordinates are adjusted at render-time to create an illusion of depth as the viewer's eye moves across a scene.
The virtue of parallax mapping is efficiency. It is the cheapest real-time technique for displacement mapping. The drawback is image quality. Parallax mapping doesn't look as nice as more expensive techniques such as "parallax occlusion mapping" and "relief mapping", see Methods below. Those techniques are similar to parallax mapping, but provide better image quality at a cost of additional texture lookups.
Parallax mapping uses a grayscale heightmap. Exactly where it goes will depend on your specific game engine, but it's pretty common to put it in the alpha channel of the normal map. Check the documentation for your engine to make sure.
Methods
There are more than a half-dozen versions of parallax mapping:
- Offset, and offset with limiting (both are your basic parallax)
- Parallax occlusion
- Relief
- Cone step
- Steep parallax
- Pyramidal displacement
- Iterative parallax
- etc.
All except offset and iterative use more advanced rendering calls, only now becoming feasible on current-gen hardware.
If anyone is looking for a good rendering cost/visual effect tradeoff, look at iterative parallax, it is probably your best bet. Newer versions of parallax occlusion and cone mapping provide the best visual fidelity. And for the cheapest, parallax mapping is a couple extra instructions and a texture channel, almost negligible nowadays.
The staircases in Mass Effect probably have a specific parallax shader written for them; a generic parallax mapping solution would probably not give as believable an effect.
Uses
As a rule, parallax mapping looks good on walls and floors. Any mesh with a relatively large surface viewed from non-oblique angles could be a decent candidate for parallax mapping. Parallax works well for smooth curves, like rocks and carvings. It's not good for steep edges, because of the distortion.
In your heightmap, try to avoid sharp/steep edges and tall high-frequency details. Those can cause texture-stretching and rendering artifacts.
Use sparingly on any surface that is not relatively large. Be especially careful where the edges of a mesh are visible. Parallax mapping doesn't extend past the visible edges of a mesh. That can look weird. You may want to augment your parallax map with actual geometry at visible edges. (eg. bricks on the corner of a building might use actual geometry while the other bricks can be created by parallax mapping.)
Mass Effect uses parallax in an interesting way, to create stairs as a parallax indentation on what is basically just a flat plane.
<<Anchor(UsageExamples)>>
[[attachment:masseffect_20070301_screen005.jpg|Media:ParallaxMap/attachments/masseffect_20070301_screen005.jpg | width=600}} | [[attachment:oblivion_parallax_06B.jpg|{{attachment:oblivion_parallax_06B.jpg |
A parallax-mapped staircase in Mass Effect.< >Image by BioWare |
[[attachment:crysis_parallax_occlusion_mapping.jpg|Media:ParallaxMap/attachments/crysis_parallax_occlusion_mapping.jpg | width=600}} | [[attachment:steep-parallax_stalker.jpg|{{attachment:steep-parallax_stalker.jpg |
Parallax occlusion mapping in Crysis< >Image by Crytek |
<<Anchor(HowToCreate)>>
How To Create
CrazyBump
Using CrazyBump to generate a parallax map from a normal map:
- If necessary, grab the CrazyBump demo from www.crazybump.com
- Make sure that CrazyBump's axis orientation preferences are set correctly for your normal map.
- Open your normal map in CrazyBump.
- Make sure that "parallax displacement" is turned on in CrazyBump's preview window.
- Select the "displacement" tab from CrazyBump's user interface.
- Adjust the "displacement map" sliders until your model has the desired appearance.
- If you notice shimmering artifacts, try increasing the "soften" slider.
- You're all done! Save the displacement map, and use it for parallax in your game engine.
- If your engine expects height in the alpha channel of the normal map, CrazyBump has a toggle for that on the preferences page. Just turn on the setting, open your normal map, and re-save it.
CrazyBump can also generate a parallax map from a photograph.
3ds Max
Use 3ds Max Render To Texture to bake from high-poly geometry.
- Setup the projection for the low-poly model as usual.
- In the NormalsMap element in the render to texture dialog activate the checkbox "render height map to alpha channel".