View unanswered posts | View active topics It is currently Wed Oct 18, 2017 12:32 am



Reply to topic  [ 13 posts ] 
 Ground reflection tutorial 
Author Message
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Ground reflection tutorial
Fri Mar 18, 2011 6:32 am
GoldSource doesn't come with a whole pack of visual effects, since the engine is really old and outdated it almost only covers the most basic graphical effects a game can have, meaning that if you want to use one of those shiny good looking effects you see in games nowadays you gotta edit the engine's renderer yourself, BUT with a bit of imagination you can actually fake some effects, all through level design only. In this tutorial we are going to take a look at how to create a reflective surface that "reflects" the geometry it is facing at, no programming, just mapping, here is a comparison between a normal room and the same room but with the reflection effect:

Before:

Image


After:

Image

Pretty neat I suppose?

This effect is very easy to achieve, I bet that just by looking at it you can guess what you actually have to do, but lets go through it anyway.
Okay, so lets begin shall we?

How to:

First of, open your desired map, in my case the living room map.

Image

Then select every brush inside the room except the floor by using the auto-selection feature or simply by selecting them manually holding the "ctrl" key.

Image

Once you have selected all the required brushes, copy them (using the "ctrl+c" combination) and paste them (using the "ctrl+v" combination), align the new brushes with the original ones and flip them vertically by using the "Flip objects" tool in the menu "Tools>Flip objects" or by simply rotating them manually, at first the "Flip objects" feature will not be available, to use it you have to click the selected brushes on the SIDE 2D view, only then you can use the tool, but make sure you do it in the SIDE view or else once you flip the objects you are not going to get the correct result, if you are having problems doing this just rotate the brushes manually.

Image

Do not leave any gap between the original room and the upside down room, don't mind if the floor brush overlaps with the flipped brushes once this is complete you wont notice any visual bug.

Now just make the floor brush a "func_wall" and select the "Texture" render mode and a "FX Amount" of 200, as far as I am concerned here you can type any value you want between 0 and 255, the bigger the value the less transparent the brush will be.

That should be it for now, try to compile the map and see if any errors pop up, if it does, then its probably a leak, check the map for any mistakes you might have made or anything you forgot to complete.

You can finish this now or you can further work on it to make it less heavy, if you wish to do so, keep reading.

Optimization:

This is not strictly necessary, however I can only recommend doing it because this method we just used to fake this effect isn't exactly wise, in fact its as cheap as it can get but we didn't have any other choice, if you are working on a big map, you should always take care of the optimization work, but if the map is small then I guess its not important. Anyway, optimization is carried out to "optimize" the maps for better performance and to save memory, we can optimize this effect we made by doing some simple tricks, here's how you do it:

First, select every upside down brush except for the walls and ceiling, and tie them to world brushes, then select any brushes textured with the "clip" texture and delete them.

Image

Image
Delete any unnecessary objects like this ashtray, since its not visible theres no point on letting it be, erase the fucker.

Next, select all the upside down brushes again except for the walls and ceiling and make everything a "func_illusionary".

Image

Basically what we are doing here is to save up CPU load by decreasing the clipnode count, clipnodes are the collisions that make brushes solid, and do not allow the player to walk through them like if they were not even there, by decreasing clipnode count you are handling less calculations to the CPU and therefore you are increasing performance, the "func_illusionary" entity is passable, thats why its called illusionary, it doesn't have any clipnodes and its just perfect for this job, why aren't we saving clipnodes on the walls and ceiling? well, if we did that means they would be turned into a brush entity, and that would cause a leak in the map, so we just leave them part of the world brushes. You may also notice that we deleted some "clip" textured brushes a while ago, those brushes were entirely covering some objects, I did that because when you have a object inside a clip textured solid the whole space inside it will be filled and discarded from the hull, meaning that the object inside will also be spared of clipnode creation, I usually do this to very small or complex objects because if you let those create clipnodes for every face, it will rape performance really bad, not to mention it can cause clipnode or vis bugs, if you wish to use this method on world solids, just cover the desired brushes in a "clip" textured solid, if you wish to do it for brush entities, use the same method BUT make the clip brush part of the brush entity you wish to cover or it will not work. So why were we deleting those clip brushes a while ago? because those brushes are clearly creating clipnodes, thats why I use the CLIP texture on them, but if we assign those brushes to a "func_illusionary" we are clearly creating a conflict worse than dividing by zero, because we are asking the engine to create clips, and then we ask for the deletion of those clips at the same time, the whole thing will explode right on your face and you might die :srsfac: so be careful.

Now apply the "BEVEL" texture to the backside of the floor using the "Toggle Texture" tool, the "BEVEL" texture does the same thing as the "NULL" texture. except that "NULL" only deletes the face, "BEVEL" deletes both the face and the clipnode, so its recommended for places that the player shouldn't reach, and since the backside of the floor texture isn't even visible in-game, there is no point on having that face consume texture data.

Image

Note:
If you don't have the "BEVEL" texture, use "NULL";
"BEVEL" and "NULL" are textures present in the zhlt.wad, if you are using Zoner's Half-Life compile tools, then you should have access to this wad file.

And at last, cover the whole upside down room with a clip brush.

Image

Image

We are doing this so that even the upside down walls and ceiling are spared of clipnodes for max performance.

Thats just about it, we simplified clipnode count on the mirrored geometry to save CPU load, and we erased any unnecessary backfaces, that should improve performance a little bit and will eventually let you create bigger maps, since we saved some unused clipnodes and some texture data. Now compile your map and enjoy the ha-piness.

All credit goes to me for the creation of the map, special thanks to hl_freak, for the original one.


As a little gift, I am going to provide the original map I used for the creation of this tutorial, it contains prefabs and textures created by me and some textures created by Awkook for the use in the mod Half-Life Episode Two, use them for your own purposes, I am not going to ask for credit over this minor thing but I hope you will be at least thankful if you do, this is also the kind of design I am going for in the creation of my hospital maps, if you check the pictures in the ModDB profile you will notice the similarities.


Attachments:
reflection.rar [646.97 KiB]
Downloaded 310 times

_________________
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: Ground reflection tutorial
Fri Mar 18, 2011 8:58 am
Great tutorial and I appreciate you taking the time to re-do my map, write up a tutorial and add screenshots. Your room that you 'reflected' looks really swish!

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


Profile WWW

Joined: Tue Mar 15, 2011 4:16 pm
Posts: 4
Reply with quote
Post Re: Ground reflection tutorial
Mon Mar 21, 2011 11:16 pm
If you are feeling masochistic about performance you can also bevel/null all the sides of the furniture that are facing away from the floor or are against a wall.

P.s. minor detail, bevel does create clip notes, it just doesn't extrude them and there fore creates less. (extrusion is what creates the player size, with out it the player physically is just a dot).


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: Ground reflection tutorial
Tue Mar 22, 2011 7:09 am
Yeah that is correct, but that is something not even I would bother much too make, depends on the situation, and thanks about that info on the BEVEL texture, I didn't know that.

_________________
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 Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post Re: Ground reflection tutorial
Tue Mar 22, 2011 3:28 pm
Doesn't Half-Life cull any faces that are not facing the player? I've found that a lot of the time removing faces with the null/bevel texture doesn't reduce the w_poly count. One definite difference it does make is reducing file size. Those faces have lightmaps just like everything else and really don't need to.

_________________
Image


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: Ground reflection tutorial
Tue Mar 22, 2011 3:51 pm
No, the engine cannot assimilate brushes of different types, if you have a world brush connecting to a brush entity no faces will be removed in between the junction of both, but if you have a world brush connected to a world brush, or a brush entity connected to a brush entity, the engine will cull out any unnecessary faces.

_________________
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 Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post Re: Ground reflection tutorial
Tue Mar 22, 2011 6:59 pm
What I mean is faces that are facing away from the player, I think the term for this is backfaces. Like if you have a block and are looking at it from a corner, only three of its six faces would be rendered. I'm sure the engine does this; when you take a look at a .bsp file in a program like Crafty, the w_poly counts are always higher than in HL when you have culling off.

_________________
Image


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: Ground reflection tutorial
Wed Mar 23, 2011 8:19 am
Yes like I told you, backfaces between brush entities and between world brushes are culled out, but backfaces between brush entities and world brushes are not, you gotta do it manually.

_________________
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 Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post Re: Ground reflection tutorial
Wed Mar 23, 2011 12:07 pm
I don't mean the removal of intersecting faces, I mean any faces that are facing away from the player. Like if you have a block in Half-Life (it being a world or entity brush is irrelevant):
Image

And you turn gl_wireframe to 2:

Image

Only the three faces that are facing the player get rendered. That line going through the middle is just the edge of the room's walls; If you got rid of the walls, the w_poly count never goes above 3.

_________________
Image


Profile
User avatar

Joined: Tue Aug 31, 2010 2:52 pm
Posts: 158
Reply with quote
Post Re: Ground reflection tutorial
Wed Mar 23, 2011 12:35 pm
They are not rendered if they aren't facing to the player, but they are still there, which means they will be rendered if necessary, by applying a NULL or BEVEL on those faces will permanently tell the engine to not render them and that might help performance.

If this still isn't what you are talking about then I guess I am obviously still not getting it.

_________________
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 Admin
Site Admin
User avatar

Joined: Wed Oct 06, 2010 2:38 pm
Posts: 94
Reply with quote
Post Re: Ground reflection tutorial
Thu Mar 24, 2011 3:34 pm
Yeah that's what I meant :barn:. What I was trying to say was that for the most part, faces that are facing down in that reflection map won't be rendered anway. There probably is at least some performance gain to be gotten from it, though. Every little helps :otis1:.

_________________
Image


Profile
User avatar

Joined: Thu Nov 03, 2016 9:37 am
Posts: 23
Location: Malta
Reply with quote
Post szldppt
Fri May 26, 2017 10:46 am
schnupper
avondjeuitbommelerwaard
aapan
allergoo
agrico
banexx
bessetterealestate
sri5
ekushey
boundtoburn
malang
6kidsand6packsplus2
airbtk
momoirorin
saf
youaremine
la2enjoy
khaastech
ungtalk
pove
wiki
odock
coogomezplata
forum
brooksonlineenglish
lawlessminecraft
bethlehemtravel
s221798444
labolsadetavares
localnews24by7
minecraftgamesminionline
ahanbartar
flucoin
temp
main
cardiacash
globalmimar
forum
ksdermatologist
stbmanager
picnicrestaurant
karisan
microwebsocial
yrotika
savaryislandpiecompany
tushowmadrid
thedentisthub
leadmagnetsplus
196
thegossiptwins


Profile ICQ YIM WWW
User avatar

Joined: Wed Nov 02, 2016 12:59 am
Posts: 20
Location: Malta
Reply with quote
Post judceyq
Fri May 26, 2017 1:47 pm
sooguide
ns1
revistakan
thetruthaboutmercedes
orscelikkapi
biggerbreast
mis
crystarium
sawiki
arabtravelersforums
wiki
research
tradedirectory
xn--2i0bs2s77f
keyghost
me
macaw
tsk-web
jra
acebartech
myclassifiedads
docz
ctroygrupp
vpstrust
proimecltda
clowescourt
computer-service
cohimar
cachacasbylaardt
forums
kabar47
benlambpoker
speerp
admission
karisan
greateredu
dev
tattoocoin
laundryhub
dagostinocommunication
smartbox
anpicem
nipponcasinos
hmwiki
ibeautiesonline
flashpelit
campertrailertrader
sgd-clan
koreatech21
tekom-lease


Profile ICQ YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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