Quake3World.com Forums
     Level Editing & Modeling
        Decal z-fighting on walls


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Decal z-fighting on walls

Commander
Commander
Joined: 05 Jun 2008
Posts: 125
PostPosted: 03-29-2014 05:30 AM           Profile Send private message  E-mail  Edit post Reply with quote


Decals are awesome,
but I run into one problem that I can't figure out why it happens. Dependant on the players vie angle, some decals in my map start to show z-fighting.
This usually only happens on axial walls and not on floors. Anyone has similar experience or in idea how to solve this?

Image

Here is the shader:

textures/amt-fs5_decal/cretebase3_decal
{
qer_editorimage textures/amt-fs5_decal/cretebase3_decal.tga
qer_trans 1
surfaceparm trans
surfaceparm nomarks
surfaceparm nonsolid
polygonOffset
{
map textures/amt-fs5_base/cretebase3.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
}
{
map $lightmap
rgbGen identity
blendFunc filter
}
}




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 03-29-2014 07:20 AM           Profile Send private message  E-mail  Edit post Reply with quote


polygonOffset works best with blendFunc add, filter, GL_DST_COLOR GL_ZERO (multiplicative), or GL_ZERO GL_ONE_MINUS_SRC_COLOR (inverse-multiplicative). So these blendFuncs are best for burn marks on walls, glowing bits, etc. It doesn't like multi-staged shaders with alpha-channels very much.

You can try using a sort value (try 6 or 7) and see if that works for you.

Otherwise, you might be better off leaving polygonOffset out and make the decal a "floater", sticking it on a detail brush or patch and floating the surface just above the wall behind it. You'll be venturing into less than 1 grid sizes, so if using a brush make sure to set it DETAIL.

Generally it's a good idea to add "surfaceparm detail" to your decal shaders anyway.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Commander
Commander
Joined: 05 Jun 2008
Posts: 125
PostPosted: 03-29-2014 09:28 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks for your suggestions. I tried different blend modes but the result was always too dark or it was fullbright.

The sort values have the problem that weapon marks will be drawn behind the decals.




Top
                 

Elite
Elite
Joined: 25 Mar 2000
Posts: 10054
PostPosted: 03-29-2014 12:50 PM           Profile Send private message  E-mail  Edit post Reply with quote


obsidian wrote:
Otherwise, you might be better off leaving polygonOffset out and make the decal a "floater", sticking it on a detail brush or patch and floating the surface just above the wall behind it. You'll be venturing into less than 1 grid sizes, so if using a brush make sure to set it DETAIL.


This is what I always did, worked fine for me. :ducky:




Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.