manual contains incorrect info?


(gareth) #1

The q3map2 shader manual (and the quake 3 shader manual) say that lightmaps use the blendfunc filter. This is incorrect? Dont they use blendfunc GL_DST_COLOR GL_SRC_COLOR so they can make textures brighter as well as darker? Then also in the section on detail textures it says that that blendfunc is the blendfunc filter.

Not that this really matters much anymore, but its strange nobody found this mistake until now.


(obsidian) #2

Not an error.

filter : Shorthand command that can be substituted for either blendFunc gl_dst_color gl_zero or blendFunc gl_zero gl_src_color. A filter will always result in darker pixels than what is behind it, but it can also remove color selectively. Lightmaps are filters.

All textures are created assuming 100% brightness and then darkened with a lightmap. GL_DST_COLOR GL_SRC_COLOR would in most cases end up washing colours out.

Same thing with detail textures, they are used to darken the base texture.

Additive blends are typically used to add glow effects, which you don’t want on normal surfaces.


(gareth) #3

…either way its got an error - it gives 2 different definitions for the blendfunc filter…

blendFunc GL_DST_COLOR GL_SRC_COLOR

This is also the simple blend function: blendFunc filter

filter : Shorthand command that can be substituted for either blendFunc gl_dst_color gl_zero or blendFunc gl_zero gl_src_color. A filter will always result in darker pixels than what is behind it, but it can also remove color selectively. Lightmaps are filters.

detail textures dont darken the base texture, on average they should leave it the same brightness.

gl_dst_color gl_src_color would allow textures to be more than the original brightness the downside would be a halfing in the range of brightness’s either side of that. also it would look washed out in some cases.

basically this confused me, thats why i bothered to post it here. :expressionless:


(obsidian) #4

blendFunc GL_DST_COLOR GL_SRC_COLOR

This is also the simple blend function: blendFunc filter

You could have spotted something here, but where did you find that quote, could you point out the exact section? That could use fixing but I can’t find it.

detail textures dont darken the base texture, on average they should leave it the same brightness.

Correct, which is why you have to twiddle around with the overall contrast of the detail texture to get it to average around 50%. In general you should use filter blends, but you don’t technically have to. Detail textures are just like any other texture stage except that it gives the user the option to toggle it on or off. So if a scrolling, additive blend of purple polka dots is the effect you are looking for, there isn’t anything to stop you from doing it.

gl_dst_color gl_src_color would allow textures to be more than the original brightness the downside would be a halfing in the range of brightness’s either side of that. also it would look washed out in some cases.

That has to do with colour ranges. If you add or subtract two values of colours, any values that falls outside of the total range of possible colours will get clipped off and be represented at either pure white or pure black, resulting in half the total number of colours that you would normally be able to get.

That’s why HDR is important for computer graphics because using floating point values, you can scale colour ranges far beyond the normal and prevent colours from getting clipped off. Most people confuse HDR with bloom and blur effects and totally miss the boat with regards to colour ranges. Bloom and blur has very little to do with HDR.


(gareth) #5

6 Stage Specific Shader Keywords -> Detail


(obsidian) #6

Thanks.