Page 1 of 1

Decals

Posted: Tue May 22, 2012 9:29 am
by Eraser
Ok, bit of a newbie question, but what does a decal shader and texture look like again? I want to create a set of decals I can place in my map on existing surfaces to break up the monotony of a large textured face a bit. You know, stuff like stains and blood spatters and such.

Re: Decals

Posted: Tue May 22, 2012 9:38 am
by cityy

Re: Decals

Posted: Tue May 22, 2012 9:44 am
by Eraser
That is awesome bro. Thanks a lot!

Re: Decals

Posted: Tue May 22, 2012 2:05 pm
by obsidian

Re: Decals

Posted: Tue May 22, 2012 2:43 pm
by Eraser
Just a tip for those wishing to use the decals in cityy's ZIP file. The decal shaders in there will causes your brushes to cast shadows. Just add "surfaceparm trans" to fix that. Also, obsidian suggested adding q3map_bounceScale 0 to prevent the brush from reflecting radiosity light:

Code: Select all

textures/_MAP_/tab_decal_stain_a
{
   noPicMip
   polygonOffset
   surfaceparm nonsolid
   surfaceparm nomarks
   surfaceparm trans
   q3map_bounceScale 0
   {
      map textures/_MAP_/tab_decal_stain_a.tga
      blendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR
   }
}
There's also some great decal textures over at cgtextures. Note that you'll have to invert the colors and add a black background before you can use them with the supplied shaders though.

Re: Decals

Posted: Tue May 22, 2012 3:18 pm
by CZghost
Wow, thanks for the decal textures, maybe I'll use it in my next map for MavComp#4...
EDIT: If I use the _decal projection, the range is from _decal patch and info_null entity but as the _decal patch is large or small, the decal will be also projected only in this size or the patch size is unimportant?

Re: Decals

Posted: Tue May 22, 2012 4:49 pm
by CZghost
Tried the _decal projection in my EP testing map for tagret_gravity, doesn't work... I've captured few screenshots from a game and two from editor, how it looks like.

Editor screenshots:
Image
Image

In-game screenshots:
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_01.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_02.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_03.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_04.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_05.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_06.jpg[/lvlshot]
[lvlshot]http://dl.dropbox.com/u/76484093/Quake%203/Quake%203%20World%20screenshots/issues/ep_gravitytest/decals_07.jpg[/lvlshot]

In the robotrenegade page is written:
Make a simple patch mesh (it can be bent, but the quads in Radiant must be rectangular), select it and use the right-click context menu to turn it into a _decal entity. Target an info_null below the _decal entity and compile. Everything between the decal patch and the info_null will have a decal projected onto it.
Dou you can to specify what axis should be in use and how is calculated the distance?

Re: Decals

Posted: Tue May 22, 2012 5:33 pm
by obsidian
If it's just a flat wall, just paste a normal decal patch on it and be done with it.

Decal entities are only if you want to project a decal onto complicated/multiple geometry that would normally be restrictive with a single patch. You have the entire entity/target facing the wrong way, the patch can "float" anywhere it and it targets an info_null that should be placed behind the surface you want it to project onto. The texture will be projected on everything between the patch and the info_null.

There is no distance value, it will literally project on every surface between the patch and target. You specify axis by moving the target/rotating the patch.

Re: Decals

Posted: Tue May 22, 2012 6:28 pm
by Eraser
Is there some benefit to using a patch instead of a nodraw brush that has one face textured with the decal shader?

Re: Decals

Posted: Tue May 22, 2012 7:58 pm
by obsidian
No, that will work too. Patch is maybe easier to move around, identify and filter as a decal.

Some textures (like the blood streaks used in Doom 3) are easier to stretch and bend as a patch.

Re: Decals

Posted: Tue May 22, 2012 8:12 pm
by Theftbot
Dont forget to make brush detail if you do

Re: Decals

Posted: Wed May 23, 2012 8:20 am
by CZghost
So I've done it wrong. the target_null may be behind surface to project and distance doesn't matter...
If it's brush, it may be detail. Patches are detailed automaticaly?

I'll try it as I'll get home from school...

Re: Decals

Posted: Wed May 23, 2012 9:24 am
by Eraser
CZghost wrote:Patches are detailed automaticaly?
The short answer is yes.

Re: Decals

Posted: Wed May 23, 2012 1:34 pm
by CZghost
Eraser wrote:
CZghost wrote:Patches are detailed automaticaly?
The short answer is yes.
And the long answer? Because when I've tried to add a detail keyword to the decal shaders, it was floating in air and displaing dummy texture. Then I've removed the detail keyword. Shaders now was displaing right textures, but again floating in air...

So I'm asking, what's wrong? The target_null is now behind the decals and the _decal before the decals... _decal patch have nodraw common texture, is it this wrong? Will the _decal entity display in game when use solid texture?

If it's possible, make me please screenshot from editor and from game with and without tris, how it may look like... I'm using Radiant 1.5

In the robotrenegade page are in-game screenshots, but not the radiant sceens... Does ydnar still develope the q3map2 and make maps?

Re: Decals

Posted: Wed May 23, 2012 1:54 pm
by Eraser
- Create a brush.
- Place an info_null entity behind it.
- Place a patch in front of it and give this patch the decal shader you want.
- Turn the patch into a _decal entity
- Have the patch target the info_null entity.
- Compile.

As I understand it, that is what you need. The shader applied to the patch will be projected on the brush between the patch and the info_null entity.

I'm not sure what the difference is between the "detail" surfaceparm and the "trans" surfaceparm. The shader manual says basically the same thing about both of them. I don't think you ever need to use the "detail" surfaceparm as you can make brushes detail in the editor (hit CTRL+M when having a brush selected). I know that the "trans" surfaceparm stops the surface from blocking light, so maybe it does both or perhaps it has no effect on VIS and the shader manual is wrong. Someone should test this.

But I digress. What you need to do is follow the steps I put at the beginning of this post and forget about detail brushes because patches have no effect on the VIS stage of compiling your map so in that sense, patches are similar to detail brushes.

Re: Decals

Posted: Wed May 23, 2012 2:11 pm
by obsidian
[lvlshot]http://zero.robotrenegade.com/imgdump/decalentity.jpg[/lvlshot]

Re: Decals

Posted: Wed May 23, 2012 3:03 pm
by CZghost
Very thx, it's functionable now... I'll sketch the _decal usage ;)