How to : create semi - realistic fog / Haze
This will cover how to create a matrix for your fogfield, setup your render style, sprite and any effects you want to add to it. This way is fine although with variations of the effect needed.
Also it will explain how you can achieve high quality fog by the (CPU CONSUMING) per pixel method. and I will explain a work around for lowering cpu consumption. |
Please read through this and test it before attempting a per pixel method.....
Part one. ------------------------------------------------------------------------------------ In the attemp to create a new fog / haze /smoke for a pluging im working on / FFX for some effects I had added in I just recently. I was playing around with a matrix for some angle calculations ( GO HERE FOR THE ANGLES HOW TO ) it struck me that there was an easy uniform way to create fog/smoke which was more realistic than what is currently availalbe in hl1. First you will need some origins you can either grab the origin from a player_entity // map.ini // entity // ect.. Code:
needs to be a non float number Now we will decide on a box/rectangle type, a circle type,or a sphere type. We need to define the size of our area now use a matrix. We'll decide. for mediumsprites Code:
Code:
----------------------------------------------------------------------------------- Now lets define the number of sprites we will create (lower number less quality / more performance) This is how many sprites per area ""( xyz ) = total area "" Lets say our area size is 100 and we have a perfect box now we need a good sprite... Good sprite is the key... I will provide a few samples. We will say about 70 sprites.. // the amount the sprite will need to be lets say.. medium = 6 Code:
amount = (( fogfieldsize * 2 + height / ( height )) / z_layers == amt ).. For circle the whole format changes Next : Creating your matrix |
Now that we have our information right we will set up a function to create the inital information.
Code:
Now what we just did was set up our entities fogfield. -------------------------------------------------------------------------- refernece Code:
args[0] = fog number / countSo with all of that in done now lets start creating the entity new timer = 0 Code:
Code:
set a task for this every second and end it when you odnt want it any more. for high quality the function is easier but the cpu usage is high Code:
The only big difference is it add a fully packed field |
Example comming soon.
with spherical field added. |
| All times are GMT -4. The time now is 19:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.