AlphaMod Volume can get filtered away by -patchmeta


(WolfWings) #1

Long story short. I wanted some pillars fading to a constant colour, was using the same shader as Ydnar used in the posted ‘pillars with planks between them’ demo using AlphaMod Volume.

Specifically, I wanted the pillars unshaded for about 64 units, then shaded fully by about half-way down, then still solid and opaque to the floor of the ‘sky box’ where I had the pain trigger. A poor-man’s fog that didn’t actually use the fog, so I could still use global fog.

Well, when I did a -patchmeta compile as I usually do… it optimized away the ‘breaks’ I’d put into the pillar, so I only got a single blend from the top of the pillar to the bottom, which didn’t look good at all. :slight_smile:

So, thought I’d mention this. It’s somewhere between a bug, and not-a-bug, but folks should know about it at least. If you use -meta, -meta doesn’t take into account alpha-vertex values quite correctly, apparently, before deciding what polygons to merge. So be prepared to use some func_statics to work around things.


(ratty redemption) #2

good point and do func_groups get overridden by -patchmeta? I guess all adjacent tris from separate entities, left in the bsp after compiling, don`t get merged?


(WolfWings) #3

No, func_groups do not get overridden by -patchmeta. :slight_smile:

Oddly… it appears -patchmeta only looks at the vertices between patches, to determine if it can merge between patches. If they all line up in 3D space, and are part of the same entity… they can be merged, nothing else (trivial) appears to be considered that I could notice. I didn’t do an exhaustive test, just some quick tests changing little things to try to narrow it down, so I might be very far off. I’d imagine Ydnar will correct me at some point.


(ratty redemption) #4

understood :slight_smile:


(ydnar) #5

Use more than one patch mesh. Have one start where you want the blend to start.

y


(ratty redemption) #6

so they don`t even need to be separate func_groups? cool :slight_smile:


(WolfWings) #7

I did that, Ydnar. I can’t seem to ‘back up’ to that point of the .map file, but when I initially saw the ‘glitch’ I had a single 4x3 patch-mesh forming a cylinder with 3 slices, with two seams being where I wanted the blend to begin and end.

I’ll try to recreate the glitch to show you, but -patchmeta combined the entire cylinder into one smooth gradiant from top to bottom, while removing -patchmeta kept the blending I wanted.


(WolfWings) #8

Okay, got the bug recreated.


// entity 0
{
"classname" "worldspawn"
// brush 0
{
( 512 512 -2048 ) ( -512 512 -2048 ) ( -512 -256 -2048 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -1280 0 ) ( -256 -1280 0 ) ( -256 -1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 512 0 ) ( 1280 1280 0 ) ( 1280 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 1280 0 ) ( 256 1280 0 ) ( 256 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -256 0 ) ( -1280 -1024 0 ) ( -1280 -1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -512 512 -1792 ) ( 512 512 -1792 ) ( -512 -256 -1792 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( -512 -256 1536 ) ( -512 512 1536 ) ( 512 512 1536 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -1280 0 ) ( -256 -1280 0 ) ( -256 -1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 512 0 ) ( 1280 1280 0 ) ( 1280 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 1280 0 ) ( 256 1280 0 ) ( 256 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -256 0 ) ( -1280 -1024 0 ) ( -1280 -1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -512 512 1280 ) ( -512 -256 1280 ) ( 512 512 1280 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 2
{
( 512 512 -2048 ) ( -512 512 -2048 ) ( -512 -256 -2048 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -512 -256 1536 ) ( -512 512 1536 ) ( 512 512 1536 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -1280 -1280 0 ) ( -256 -1280 0 ) ( -256 -1280 -512 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 1280 512 0 ) ( 1280 1280 0 ) ( 1280 1280 -512 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -1280 -256 0 ) ( -1280 -1024 0 ) ( -1280 -1024 -512 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -256 -1024 0 ) ( -1280 -1024 0 ) ( -256 -1024 -512 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
// brush 3
{
( 512 512 -2048 ) ( -512 512 -2048 ) ( -512 -256 -2048 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -512 -256 1536 ) ( -512 512 1536 ) ( 512 512 1536 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -1280 0 ) ( -256 -1280 0 ) ( -256 -1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 512 0 ) ( 1280 1280 0 ) ( 1280 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 1280 0 ) ( 256 1280 0 ) ( 256 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1024 1280 0 ) ( 1024 512 0 ) ( 1024 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 4
{
( 512 512 -2048 ) ( -512 512 -2048 ) ( -512 -256 -2048 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -512 -256 1536 ) ( -512 512 1536 ) ( 512 512 1536 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 512 0 ) ( 1280 1280 0 ) ( 1280 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 1280 0 ) ( 256 1280 0 ) ( 256 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -256 0 ) ( -1280 -1024 0 ) ( -1280 -1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 256 1024 0 ) ( 1280 1024 0 ) ( 256 1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 5
{
( 512 512 -2048 ) ( -512 512 -2048 ) ( -512 -256 -2048 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -512 -256 1536 ) ( -512 512 1536 ) ( 512 512 1536 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -1280 0 ) ( -256 -1280 0 ) ( -256 -1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( 1280 1280 0 ) ( 256 1280 0 ) ( 256 1280 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1280 -256 0 ) ( -1280 -1024 0 ) ( -1280 -1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 0 ) ( -1024 -256 0 ) ( -1024 -1024 -512 ) shaderlab_1337/sky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 6
{
patchDef2
{
shaderlab_1337/conc_1
( 9 7 0 0 0 )
(
( ( -512 0 -1024 0 3 ) ( -512 0 -895.999878 0 2.500000 ) ( -512 0 -767.999878 0 2 ) ( -512 0 -639.999878 0 1.500000 ) ( -512 0 -511.999878 0 1 ) ( -512 0 -383.999908 0 0.500000 ) ( -512 0 -255.999878 0 0 ) )
( ( -512 -512 -1024 2 3 ) ( -512 -512 -895.999878 2 2.500000 ) ( -512 -512 -767.999878 2 2 ) ( -512 -512 -639.999878 2 1.500000 ) ( -512 -512 -511.999878 2 1 ) ( -512 -512 -383.999908 2 0.500000 ) ( -512 -512 -255.999878 2 0 ) )
( ( 0 -512 -1024 4 3 ) ( 0 -512 -895.999878 4 2.500000 ) ( 0 -512 -767.999878 4 2 ) ( 0 -512 -639.999878 4 1.500000 ) ( 0 -512 -511.999878 4 1 ) ( 0 -512 -383.999908 4 0.500000 ) ( 0 -512 -255.999878 4 0 ) )
( ( 512 -512 -1024 6 3 ) ( 512 -512 -895.999878 6 2.500000 ) ( 512 -512 -767.999878 6 2 ) ( 512 -512 -639.999878 6 1.500000 ) ( 512 -512 -511.999878 6 1 ) ( 512 -512 -383.999908 6 0.500000 ) ( 512 -512 -255.999878 6 0 ) )
( ( 512 0 -1024 8 3 ) ( 512 0 -895.999878 8 2.500000 ) ( 512 0 -767.999878 8 2 ) ( 512 0 -639.999878 8 1.500000 ) ( 512 0 -511.999878 8 1 ) ( 512 0 -383.999908 8 0.500000 ) ( 512 0 -255.999878 8 0 ) )
( ( 512 512 -1024 10 3 ) ( 512 512 -895.999878 10 2.500000 ) ( 512 512 -767.999878 10 2 ) ( 512 512 -639.999878 10 1.500000 ) ( 512 512 -511.999878 10 1 ) ( 512 512 -383.999908 10 0.500000 ) ( 512 512 -255.999878 10 0 ) )
( ( 0 512 -1024 12 3 ) ( 0 512 -895.999878 12 2.500000 ) ( 0 512 -767.999878 12 2 ) ( 0 512 -639.999878 12 1.500000 ) ( 0 512 -511.999878 12 1 ) ( 0 512 -383.999908 12 0.500000 ) ( 0 512 -255.999878 12 0 ) )
( ( -512 512 -1024 14 3 ) ( -512 512 -895.999878 14 2.500000 ) ( -512 512 -767.999878 14 2 ) ( -512 512 -639.999878 14 1.500000 ) ( -512 512 -511.999878 14 1 ) ( -512 512 -383.999908 14 0.500000 ) ( -512 512 -255.999878 14 0 ) )
( ( -512 0 -1024 16 3 ) ( -512 0 -895.999878 16 2.500000 ) ( -512 0 -767.999878 16 2 ) ( -512 0 -639.999878 16 1.500000 ) ( -512 0 -511.999878 16 1 ) ( -512 0 -383.999908 16 0.500000 ) ( -512 0 -255.999878 16 0 ) )
)
}
}
// brush 7
{
( 768 512 -1088 ) ( -512 512 -1088 ) ( -512 -768 -1088 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
( -512 -768 -704 ) ( -512 512 -704 ) ( 768 512 -704 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
( -320 -576 1536 ) ( 960 -576 1536 ) ( 960 -576 -2048 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
( 576 -960 1536 ) ( 576 320 1536 ) ( 576 320 -2048 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
( 320 576 1536 ) ( -960 576 1536 ) ( -960 576 -2048 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
( -576 960 1536 ) ( -576 -320 1536 ) ( -576 -320 -2048 ) common/alpha_0 0 0 0 0.500000 0.500000 0 13 0
}
// brush 8
{
( -704 1024 -64 ) ( -896 1024 -64 ) ( -896 -1024 -1088 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
( -896 1024 0 ) ( -704 1024 0 ) ( -704 -1024 -1024 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
( -704 -1024 -1088 ) ( -896 -1024 -1088 ) ( -896 -1024 -1024 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
( -704 1024 0 ) ( -704 1024 -64 ) ( -704 -1024 -1088 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
( -896 1024 -64 ) ( -704 1024 -64 ) ( -704 1024 0 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
( -896 1024 -64 ) ( -896 1024 0 ) ( -896 -1024 -1024 ) shaderlab_1337/wood_1 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 1
{
"angle" "45"
"origin" "-800 -800 -864"
"classname" "info_player_deathmatch"
}


(ydnar) #9

What part of “use more than one patch” don’t you understand?

A patch with colinear rows/cols will be collapsed, regardless of how many control points there are in between. Use two patches.

y


(WolfWings) #10

Apparently I took your wording too literally, and had a different base definition of the term ‘patch’ in my vocabulary. My definition was any 1x1 (3x3 in Radiant terms) patch mesh, possibly merged with other patch meshes into a single, easier-to-track component.

I’d thought a set of patch meshes would be treated the same by -patchmeta if they were 16 seperate 1x1 (3x3 in Radiant terms) patch meshes, or if they were a single 4x4 (9x9 in Radiant terms) patch mesh, as I try to take extra care to re-weld my patches together, using the plugins, into as few overall patch meshes as I can to guarantee that the patches all align seamlessly, even if I’m going to be using -patchmeta. Avoiding possible patch seams apparently conflicts with the new AlphaMod Volume brushes, and this wasn’t documented anywhere that I know of.

I didn’t know -patchmeta would automatically ‘stop merging’ at the physical boundary of a patch mesh, as the various documentation I’d read (and goodness knows there’s numerous sources of documentation on Q3map2 that don’t always agree since not everything is up to date on the newest version) hadn’t specified that fact. So the original results I was seeing, -patchmeta not paying attention to alpha values at the control points before determining if it could merge polygons, looked like a bug.

So I was trying to report it as such, or at least warn other mappers about what I thought was unexpected behaviour from Q3map2.


(ydnar) #11

Q3Map2 has no triangle reduction code beyond eliminating colinear verts in 1 patch mesh. It will always honor breaks between patch meshes.

y