Page 1 of 1
True Decals vs This Method
Posted: Fri Feb 06, 2015 5:29 pm
by KillPixel
I'm using textures with alphas and this shader:
Code: Select all
textures/wtest1/slime
{
surfaceparm nonsolid
surfaceparm trans
{
map $lightmap
map textures/wtest1/slime.tga
blendFunc blend
}
}
this is put on a brush with a thickness of 1 unit and placed against a wall to be used as a sort of decal. The other sides of the brush have nodraw, trans, nonsolid, etc.
I haven't tried proper decals yet, I can't really find a hard and fast tutorial on decals specifically so I wrote that little shader. Just from what I've seen, it seems decals use lengthy shaders, polygonOffset, an editor entity and are "projected" onto a surface. I've seen some posts where people get weird lighting because the decals bounce light as well.
Is there something fundamentally wrong with my method? Would using proper decals be more beneficial? My shader is small compared to others, so I feel like it must be lacking in some way...
As I said, I haven't used real decals yet, but I can't imagine them being any easier than this method.
edit: switched to using patch meshes instead of brushes.
Re: True Decals vs This Method
Posted: Fri Feb 06, 2015 6:51 pm
by AEon
As you mention the real decals use
polygonOffset, letting you place them flush with the brush you apply them to. Your 1u offset method has the advantage that you will always be able to properly see the shader in GTKradiant, i.e. there is no Z-fighting or worse disappearing of the face you want to plaster on the walls/floors. On the down side, you will have to fiddle with brushes sticking out by 1u.
In my current experimental map
AEmod, I am torn between giving my decals a 1u offset from the walls and floors to be able to see them properly in the editor, or place the decals flush on the walls, but having issues with the visuals in Radiant. Presently I solved the issue in part by making all the walls floors etc.
structural and all my
decals detail... so that I can switch off the decals when texturing the structural walls/floors... or turn off the structural brushes to check that I have decals on all the faces... alas this is not very elegant though.
Here the decal shader code I use on my
32bit (i.e. with alpha)
TGA decal textures (maybe it helps):
Code: Select all
textures/aemod/aemod_decal_48x64_cube
{
qer_editorimage textures/aemod/aemod_decal_48x64_cube.tga
qer_trans 0.99
surfaceparm nolightmap
surfaceparm nonsolid
surfaceparm nomarks
surfaceparm trans
polygonoffset
{
clampmap textures/aemod/aemod_decal_48x64_cube.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen Vertex
}
}
I am very interested in seeing how all this works out for you. Alas I am no expert on shaders, hopefully obsidian can shed some light on them.
Re: True Decals vs This Method
Posted: Fri Feb 06, 2015 8:04 pm
by cityy
Regarding this topic: QL decal shaders always use polygonOffset in combination with sort 6. I'm not exactly sure what the deal is with that. Maybe it's supposed prevent decals from drawing over hit marks?
Re: True Decals vs This Method
Posted: Fri Feb 06, 2015 9:56 pm
by KillPixel
I see. I appreciate the input.
Currently, I think I've "settled" on using patch meshes. They're simple to use, no z-fighting in radiant, hit crtl-p to hide/show and the shader script is brief.
As I said, I haven't used proper decals yet (and i don't know wtf I'm doing in general) and I don't really want to make a decision before trying all my options, but this is working out well so far.
Here's pics of a test map:
http://www.killpixel.com/test/decal_test.jpg
Everything looks fine, if you look very closely you can see the 1u offset (last pic, grime under protruding brick). However, it's only very evident in this case because of the very low pixel density.
I think I'm going to continue with this method unless some major flaw is brought to my attention.
Should probably add nomarks to the shader...
Re: True Decals vs This Method
Posted: Sat Feb 07, 2015 5:46 pm
by AEon
Using patches for the decals... in some cases a good thing... though I always tend to be weary of using patches, fearing sparklies.
So I use brushes for the simple cases, i.e. flat spawn decals on floors or deco on walls, and if a more complicated (following something other than a flat surface) decal needs to be applied a patch.