Quake3World.com Forums
     Level Editing & Modeling
        True Decals vs This Method


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




Print view Previous topic | Next topic 
Topic Starter Topic: True Decals vs This Method

Trainee
Trainee
Joined: 22 Jun 2014
Posts: 49
PostPosted: 02-06-2015 09:29 AM           Profile Send private message  E-mail  Edit post Reply with quote


I'm using textures with alphas and this shader:
Code:
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.



_________________
KillPixel@YouTube


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 02-06-2015 10:51 AM           Profile Send private message  E-mail  Edit post Reply with quote


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:
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.




Top
                 

surfaceparm nomarks
surfaceparm nomarks
Joined: 10 Aug 2009
Posts: 1018
PostPosted: 02-06-2015 12:04 PM           Profile Send private message  E-mail  Edit post Reply with quote


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?



_________________
Portfolio
Twitter


Top
                 

Trainee
Trainee
Joined: 22 Jun 2014
Posts: 49
PostPosted: 02-06-2015 01:56 PM           Profile Send private message  E-mail  Edit post Reply with quote


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...



_________________
KillPixel@YouTube


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 02-07-2015 09:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.




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.