View unanswered posts | View active topics It is currently Mon May 29, 2017 6:22 am



Reply to topic  [ 11 posts ] 
 How to create realistic looking shadows (ZERO coding!) 
Author Message
Site Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post How to create realistic looking shadows (ZERO coding!)
Wed Oct 27, 2010 9:51 am
I don't think I've ever seen a tutorial/discussion about this before, so hopefully it will be useful :).

____________________________________________________________________________

One of the limitations of the Gold Source engine is its weakness with shadows. Without making your own renderer (which is complex and can result in high hardware requirements) good looking shadows are very hard to achieve. Even harder still is casting shadows from models. Half-Life originally had a shadow system for models, but it was buggy and didn't look good. Using this method I discovered recently, you can create very realistic looking shadows for world geometry and models. The main downside to this is that it can only create static shadows, I've tried a few different methods but can't seem to get decals to work on moving brushes. If anyone is able to do this, please do tell me.

Image
Looking good, huh? This effect has virtually zero impact on performance.

The way it's done is by using decals. Decals are the things that stick to the walls and floors of a map, like blood and explosion scorch marks.

How it's done
It's easy to create shadow decals. First of all you need a screenshot of the thing you want to make a shadow for or the original texture. For the grate I simply located the texture in halflife.wad using Wally. To make things easier make sure that the image you're going to create the shadow from is against a plain background (if you're doing this for a model, take the screen shot inside Half-Life Model Viewer). In the next few steps I'm using Photoshop, though I'm sure it can be done in other, free, photo editors like GIMP and Paint.net.

  • Load the image into Photoshop.
  • Go to Select>Colour Range...
  • Click on the colour you don't want to be part of the shadow (as in, the parts you want invisible)
  • Click OK and you should find all of the background is selected now.
  • Use the brush tool to paint the area white (255 255 255).
  • Press Ctrl +Shift + I to invert the selection
  • Now paint the selection grey. What shade depends on how intense you want the shadow to be. 128 128 128 usually works best. Don't use any colours; we can set the colour of the decal later on.
  • Apply a gaussian blur (Filters>Blur>Gaussian blur) to the image. How much blurring depends on how soft you want the shadow to be. In real life the closer an object is to a surface, the sharper the shadow is (try it out on a sunny day or in front of a lamp). Apply this rule to the blurring.
  • It is very likely the image will need resizing. This is one of the limitations of this method. You cannot change the size or orientation of the decal in Hammer/in game (the brush's texture scale and rotation also affects the decal. A texture scaled down to 0.5x0.5 will result in the decal being half size.)
  • Now you have your finished decal, copy and paste it into Wally. You need to save it inside the decals.wad file, otherwise it won't show up in-game. It's a good idea to use a naming scheme for these, for example {sh_xxxxx (remember to always put { before the texture name)
  • We need to change the decals palette because the one Wally has given it will not work. Find another decal with a palette that looks like this:
    http://captainbo.info/images/hlshadows2.jpg
    Image
  • Now, with that decal open, go to Colors>Save Palette and save the .act file somewhere. Now go back to your shadow decal and load that palette by going to Colours>Load Palette.
  • Currently your decal will cast a grey/black shadow. If you want a coloured shadow go to Colors>Edit Palette and double click on the last colour in the grid (bottom right). Change to a colour of your choice. Avoid using bright colours as these won't look realistic.
  • You're done! Save it all and open Hammer Editor. Use the Apply Decals tool to place your decal whereever you want. Compile the map and admire your handywork!

Another example of the realistic effect that can be achieved:

Image

Possible Problems
  • If Half-Life was open during all of this, restart it.
  • Make sure your decal is using the right palette. It should look like the one above.
  • Make sure you saved it inside decals.wad (you can find this inside the valve folder.


____________________________________________________________________________

If anyone isn't sure about a certain bit please say so and I will try to clear the tutorial up.

_________________
Image


Last edited by Doommarine23 on Sun Dec 19, 2010 8:52 am, edited 1 time in total.

I just fixed your formating.



Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Thu Oct 28, 2010 4:46 am
Really good tutorial.

_________________
Half-Life Episode Two official page:
http://www.hunkguerrius.webs.com/

Half-Life Episode Two ModDB profile:
http://www.moddb.com/mods/half-life-episode-two


Profile
Site Moderator
User avatar

Joined: Mon Nov 01, 2010 10:47 am
Posts: 107
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Mon Nov 01, 2010 10:53 am
That is a sweet effect, looks really good!

_________________
HL Freak's Half-Life Site
http://digitality.comyr.com/hl/


Profile WWW
Site Admin
User avatar

Joined: Tue Aug 31, 2010 2:46 pm
Posts: 121
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Fri Nov 05, 2010 2:51 am
This is a very good tutorial, perhaps we should add it to the main site as an article.


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Fri Nov 05, 2010 7:35 am
I already did, but there was no need to make the article, just link to this thread.

_________________
Half-Life Episode Two official page:
http://www.hunkguerrius.webs.com/

Half-Life Episode Two ModDB profile:
http://www.moddb.com/mods/half-life-episode-two


Profile
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Sat Nov 06, 2010 5:49 pm
Really good tutorial!

About this "fake" shadows at moving entities, it can be done using func_illusionary with combination of MoveWith in SoHL. At least, it's what I used, I guess. I gotta recheck on it, and I'll write tutorial then.

Also, the GL shadows /old, HL's one/ can be cleaned from "transitions" by using some stencil GL functions. I got it somewhere saved, though, it'd need OpenGL32.dll in HL dir, but, still, these have I guess no impact on performance. They will still look kinda wrong on stairs and stuff, though.

Again, nice work!


Site Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Mon Nov 08, 2010 3:12 pm
Mr.Nameless wrote:
About this "fake" shadows at moving entities, it can be done using func_illusionary with combination of MoveWith in SoHL. At least, it's what I used, I guess. I gotta recheck on it, and I'll write tutorial then.


While I was writing this tutorial I tried SoHL because I read in its manual or somewhere that the env_sprite it offers can be used with movewith. I sort of managed to get it to work. I could make it put the normal HL sprites onto a moving object (blood, bullet holes etc) though HL can do that anyway (like if you shoot a door or train the decal can move with the brush). It kept crashing when I tried custom sprite files though, not sure why.

_________________
Image


Profile
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Tue Nov 09, 2010 3:22 pm
Well, SoHL itself is kinda buggy, I use my own version for my mod, with fixed alot of bugs around. About movewith, you can use it on every entity that has MoveWith in options. Like I said, I'll write tutorial for this stuff, I'm just missing time now.


Site Admin
User avatar

Joined: Tue Aug 31, 2010 2:46 pm
Posts: 121
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Fri Dec 10, 2010 11:15 am
I am considering to reformat and convert this to a tutorial on the website itself instead of just a link to the thread.

Would you be okay with this? And what does everyone else think.

Scratch that, I got a better idea. Just give me awhile. ;)


Profile
Site Admin
User avatar

Joined: Tue Aug 31, 2010 2:46 pm
Posts: 121
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Sun Dec 19, 2010 8:51 am
There, I completely overhauled the article hunk did. 8-)

http://www.halflifezone.com/index.php?o ... g&Itemid=3


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: How to create realistic looking shadows (ZERO coding!)
Fri Dec 09, 2011 8:36 pm
This is how real man do it:

Image

_________________
Half-Life Episode Two official page:
http://www.hunkguerrius.webs.com/

Half-Life Episode Two ModDB profile:
http://www.moddb.com/mods/half-life-episode-two


Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
Localized by MaĆ«l Soucaze © 2010 phpBB.fr