Difference between revisions of "Du/dv map"

From Valve Developer Community
Jump to: navigation, search
m (Added a new way to create du/dv maps)
(elaborated on tutorial a bit)
 
Line 1: Line 1:
[[Category:Material System]]
 
 
{{note|<code>$dudvmap</code> is now defunct and is replaced by the <code>[[Refract]]</code> shader. Though, the <code>[[Water_(shader)|Water]]</code> shader still uses a du/dv map for <code>[[$bumpmap]]</code>.}}
 
{{note|<code>$dudvmap</code> is now defunct and is replaced by the <code>[[Refract]]</code> shader. Though, the <code>[[Water_(shader)|Water]]</code> shader still uses a du/dv map for <code>[[$bumpmap]]</code>.}}
  
'''du/dv maps''' are used for [[DirectX Versions|DirectX 8]] refractions. If you're a Photoshop user, it's easy to create du/dv maps using [http://developer.nvidia.com/object/nv_texture_tools.html nVidia's texture tools]. But if you're using another program like PaintShopPro, you might have trouble getting the nVidia tools to work. Fortunately, a du/dv map can be easily created from a normal map in just two steps. You can also do this in Photoshop if you don't want to bother with the nVidia tools.  
+
'''du/dv maps''' are used for [[DirectX Versions|DirectX 8]] refractions. If you're a Photoshop user, it's easy to create du/dv maps using [http://developer.nvidia.com/object/nv_texture_tools.html nVidia's texture tools].
  
#Open the normal map. First go to Colors->Negative Image (PaintShopPro) or whatever inverses all the colors in your paint program.  
+
== Creating a du/dv map from a normal map ==
#Now go to Colors->Adjust->Brightness/Contrast (or your paint program's equivalent). Leave brightness at 0 (Photoshop tends to produce more accurate results with brightness set to -17), but raise contrast as high as it will go.  
+
A du/dv map can be easily created from a normal map in just two steps. You can also do this if you don't want to bother with the nVidia tools. {{note|Work from the source texture (such as a .tga) if possible.}}
  
DuDv maps with only pure yellow, green, red and black tend to have some artifacts ingame. There you should mix it up a bit with the original normal map. In Photoshop this is best done by puting the normal map as a layer on top of you dudv image set opacity to 50% and blending mode to hard light.
+
=== Photoshop ===
 +
#Open the normal map and invert the colours (''Image > Adjustments > Invert'' or {{Key|Ctrl|I}}).
 +
#Go to ''Colors > Adjust > Brightness/Contrast''.
 +
##Check "Use Legacy"
 +
##Set Brightness to -17
 +
##Set Contrast to 100
  
That's all! Just save and you're done.
+
=== Paint Shop Pro ===
 +
#Open the normal map and invert the colours (''Colors > Negative Image'').
 +
#Adjust the contrast as high as it will go.
  
 +
----
 +
 +
You now have a finished du/dv map. When converting to a VTF, set the [[Valve Texture Format#Image data format table|format]] to UV88.
 +
 +
<!--- This doesn't improve du/dv maps at all in my experience.
 +
DuDv maps with only pure yellow, green, red and black tend to have some artifacts ingame. There you should mix it up a bit with the original normal map. In Photoshop this is best done by puting the normal map as a layer on top of you dudv image set opacity to 50% and blending mode to hard light. -->
 
==See also==
 
==See also==
 
* [[Normal2dudv]] - utility to convert normal maps to dudv maps
 
* [[Normal2dudv]] - utility to convert normal maps to dudv maps
 
* [[Height2Normal]] - utility to convert height maps to normal maps
 
* [[Height2Normal]] - utility to convert height maps to normal maps
 
* [http://www.filterforge.com/filters/9557.html Filter Forge]
 
* [http://www.filterforge.com/filters/9557.html Filter Forge]
 +
 +
[[Category:Material System]]

Latest revision as of 19:50, 22 July 2011

Note.png Note: $dudvmap is now defunct and is replaced by the Refract shader. Though, the Water shader still uses a du/dv map for $bumpmap.

du/dv maps are used for DirectX 8 refractions. If you're a Photoshop user, it's easy to create du/dv maps using nVidia's texture tools.

Creating a du/dv map from a normal map

A du/dv map can be easily created from a normal map in just two steps. You can also do this if you don't want to bother with the nVidia tools.

Note.png Note: Work from the source texture (such as a .tga) if possible.

Photoshop

  1. Open the normal map and invert the colours (Image > Adjustments > Invert or Ctrl+I).
  2. Go to Colors > Adjust > Brightness/Contrast.
    1. Check "Use Legacy"
    2. Set Brightness to -17
    3. Set Contrast to 100

Paint Shop Pro

  1. Open the normal map and invert the colours (Colors > Negative Image).
  2. Adjust the contrast as high as it will go.

You now have a finished du/dv map. When converting to a VTF, set the format to UV88.

See also