Detail Textures: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Gildoran (talk | contribs)
No edit summary
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 11: Line 11:
To blend the detail texture, add the following render pass to your material:
To blend the detail texture, add the following render pass to your material:
<pre>{
<pre>{
blend gl_dst_color, gl_src_color
    blend gl_dst_color, gl_src_color
map yourDetailTexture
    map yourDetailTexture
}</pre> You'll probably want to scale down the detail pass and maybe even rotate it. You can also apply more than one detail pass.
}</pre> You'll probably want to scale down the detail pass and maybe even rotate it. You can also apply more than one detail pass.
For an example using this method, download a [https://www.moddb.com/mods/the-dark-mod/addons/detail-texture-demo sample FM package] by Mortem Desino.


== Scaled Intensity Blending: ==
== Scaled Intensity Blending: ==
Line 33: Line 35:
     rgb detailAlpha/(2-detailAlpha)
     rgb detailAlpha/(2-detailAlpha)
}</pre>
}</pre>
In the above code, [i]detailAlpha[/i] would be the intensity of the detail texture, ranging from 0 to 1. You could use something like [i]parm3[/i] if you wanted to scale it on the fly. Again, it's possible to use more than one detail pass.
In the above code, ''detailAlpha'' would be the intensity of the detail texture, ranging from 0 to 1. You could use something like ''parm3'' if you wanted to scale it on the fly. Again, it's possible to use more than one detail pass.


I hope this tutorial helps anybody interested in doing detail textures!
[[Category:Textures]]

Latest revision as of 01:17, 15 April 2024

I think I've come up with a good way of blending detail textures. This method is designed to simulate the "soft light" blending of photoshop/GIMP. (it pretty much just modulates then scales by 2) The advantage over regular modulation is that a correctly designed detail texture won't change the average color of the material, whereas modulation will always darken the material. This means that if a player is far from a surface with a detail texture, you can switch the detail pass on/off without the player noticing any changes in brightness.

--Gildoran 17:00, 27 August 2006 (CDT)

Making the Detail Texture:

You need to make a greyscale detail texture. (actually, colored textures work just fine too - they'll tint the material) Middle-grey will leave the material unchanged. Darker colors will darken the material and lighter colors will lighten it. The average color of the detail texture should be middle grey, so that on the lowest mipmap level the detail texture doesn't noticably modify the material.

Simple Fixed Blending:

To blend the detail texture, add the following render pass to your material:

{
    blend gl_dst_color, gl_src_color
    map yourDetailTexture
}

You'll probably want to scale down the detail pass and maybe even rotate it. You can also apply more than one detail pass.

For an example using this method, download a sample FM package by Mortem Desino.

Scaled Intensity Blending:

The previous method has the disadvantage that the only way to control the intensity of the detail texture is to adjust the contrast of the image; it can't be tweaked per-material.

This method allows you to adjust the intensity of the detail image, at the expense of requiring an extra render pass. Also, the detail texture needs to be inverted. (though most detail textures would probably look fine without being inverted)

The render passes are as follows:

{
    blend gl_zero, gl_one_minus_src_color
    map yourDetailTexture
    rgb detailAlpha
    scale 2, 2 // or whatever
}
{
    blend gl_dst_color, gl_one
    map _white
    rgb detailAlpha/(2-detailAlpha)
}

In the above code, detailAlpha would be the intensity of the detail texture, ranging from 0 to 1. You could use something like parm3 if you wanted to scale it on the fly. Again, it's possible to use more than one detail pass.