detail texture


(pazur) #1

I noticed that fueldump has a “detail” texture stage in the terrain shader:

{
	map textures/detail_sd/snowdetail.tga
	blendFunc GL_DST_COLOR GL_SRC_COLOR
	rgbgen identity
	tcMod scale 5 5
	detail
}

See the last line? It says “detail”. I added it to my terrain shader and thought that I might get a nice layer of detail… but I don’t see it. Is that limited to some video cards (I have an ATI)? I have the feature turned on in the system settings of ET as well. Has anyone used this “detail” parameter before?


(Dinius) #2

e.g. detail 2 would give double of normal detail! max is 10 I think :stuck_out_tongue:


(pazur) #3

Hmm… even detail 10 didn’t show any difference. I guess the crappy ATI Catalyst drivers can’t do the trick.


(Dinius) #4

owh LOL :smiley:
Thought some1 would’ve slapped me for misleading or something like that :stuck_out_tongue: After telling u that what I said was BS ofc :smiley:

The “detail” part in the shader =
http://www.heppler.com/shader/shader/section6.htm#6.9

In other words… Just remove it! :stuck_out_tongue:


(pazur) #5

Yea. I kicked that stage. Seems to be something really old, but I wonder why it’s in the fueldump terrain shader though.


(Dinius) #6

Because:

A texture whose scale has been increased beyond a 1:1 ratio tends not to have very high frequency content. In other words, one texel can cover a lot of real estate. Frequency is also known as “detail.” Lack of detail can appear acceptable if the player never has the opportunity to see the texture at close range. But seen close up, such textures look glaringly wrong within the sharp detail of the Quake III Arena environment. A detail texture solves this problem by taking a noisy “detail” pattern (a tiling texture that appears to have a great deal of surface roughness) and applying it to the base texture at a very densely packed scale (that is, reduced from its normal size). This is done programmatically in the shader, and does not require modification of the base texture. Note that if the detail texture is the same size and scale as the base texture that you may as well just add the detail directly to the base texture. The theory is that the detail texture’s scale will be so high compared to the base texture (e.g.; 9 detail texels fitting into 1 base texel) that it is literally impossible to fit that detail into the base texture directly.

For this to work, the rules are as follows:

A.) the lightmap must be rendered first. This is because the subsequent detail texture will be modifying the lightmap in the framebuffer directly;

B.) the detail texture must be rendered next since it modifies the lightmap in the framebuffer

C.) the base texture must be rendered last ;

D.) the detail texture MUST have a mean intensity around 127-129. If it does not then it will modify the displayed texture’s perceived brightness in the world

E.) the detail shader stage MUST have the “detail” keyword or it will not
be disabled if the user uses the “r_detailtextures 0” setting ;

F.) the detail stage MUST use “blendFunc GL_DST_COLOR GL_SRC_COLOR”. Any
other BlendFunc will cause mismatches in brightness between detail and non-detail views.;

G.) the detail stage should scale its textures by some amount (usually between 3 and 12) using “tcMod” to control density. This roughly corresponds to coarseness. A very large number, such as 12, will give very fine detail, however that detail will disappear VERY quickly as the viewer moves away from the wall since it will be MIP mapped away. A very small number, e.g. 3, gives diminishing returns since not enough is brought in when the user gets very close. I’m currently using values between 6 and 9.5. You should use non-integral numbers as much as possible to avoid seeing repeating patterns.

H.) detail textures add one pass of overdraw, so there is a definite performance hit .

I.) detail textures can be shared, so designers may wish to define only a very small handful of detail textures for common surfaces such as rocks, etc.
An example (non-existent) detail shader is as follows:

etc:P


(pazur) #7

This is very interesting and useful… but I simply don’t see any difference between having the detail stage and not having it.


(Detoeni) #8

The diffirence in look in q3/et is very slight, the only time I’v seen this function used to good effect is in “Mcgee’s Alice in Wonderland”. In that game the base textures were very small in size, also the detail overlays were very small, but the effect of the two merged looked great.