q3map2 Feature Request: AlphaMod nodraw auto-apply


(WolfWings) #1

Hard to cram the idea into the subject line, but it’s pretty simple, if it’s even possible. Could the BSP phase support some shaders being tagged with a q3map_ keyword that would indicate that the original brush face should have a different shader applied in the following two cases:

All vertices have an Alpha-value of 0.0.
All vertices have an Alhpa-value of 1.0.

I.E. Apply a ‘blending’ texture across a large and very wide sheet of terrain that you only need to blend between two textures over, or for Ratty’s ‘dithered’ decal-trick using AlphaVolume brushes, and Q3map2 can automatically replace the blending shader with either the upper or lower shader if only that shader would be applied?


(ydnar) #2

That’s an interesting idea.

TBH, unless you have large areas of each, then the additional surface, vertex and index data will outweigh any fillrate wins that gains you.

Think of it this way: triangles are like words, and surfaces are like sentences, so a 3-pass blending shader like a 3 syllable word. Forcing every triangle with either 0 or 1 alpha will save on syllables, but increase the number of sentences.

Imagine. Reading. A book. Like. This.

That make sense?

y


(WolfWings) #3

Yes, that does make sense, now that you’ve explained it.

But what about the case of terrain then, or very large-scale areas where the shader had a good chance of being applied to half of the screen on any given frame for a good chunk of the map? Would it be a win there to ‘texture out’ the unblended areas as an upper or lower-level shader?

Or have we all be blowing FPS from CPU-side calculations to try to save GPU-side fillrate by seperating out clumps of individual ‘blending’ triangles on terrain made with the newer AlphaMod Volume brushes?


(ydnar) #4

Well, if you have large areas that would make using a single/two pass shader worth it, consider that it looks boring and should be blended anyway… :slight_smile:


(WolfWings) #5

Thought about this idea a little more… and your comments made me think of something…

Would there be a way to add support for a secondary value per-vertex, that is tracked for use with a feature similair to the original idea (automatically re-texturing with different shader based on the value range over the current triangle) without being written to the BSP, and that could be manipulated in a way similair to the AlphaMod brushes? Somewhat akin to the original TeamArena-style terrain meta-shaders, but controlled fully inside the map on a vertex-by-vertex basis.

An semi-example:

Set up some brush terrain as usual, marked with a ‘generic’ terrain shader. The shader has a short list inside of alternative shaders, based on the minimum and maximum ‘Type’ values used for it’s vertices, with the alpha value automatically set and normalized to 0.0-1.0 between the minimum and maximum ‘Type’ value used on a given polygon. If a polygon doesn’t have a valid ‘replacement’ mapping, it is actually textured with the terrain shader, obviously.

This would allow for more complicated texturing using the AlphaMod-style texturing, without needing to re-texture individual areas with one shader or another or dealing with unique (or not so unique) qer_editorimage settings, etc. Just texture one really big area with one shader, then start marking off vertices as grass, rock, grass/rock dither point, whatever.