Page 1 of 5
Weather Effects
Posted: 12 Feb 2008, 19:29
by zwARREN69
Possible in current engine? I don't think it is, but I am not 100%.
I would think just rain/snow could add to a levels atmosphere. I realize this brings up a whole set of other questions/issues, like dynamic weather, sync issues(maybe), lag, effects on energy sources(wind, sun, tides). So for simplification, lets simply say a weather effect thats always on(map creator implements) and has no effect on energy sources. Would this be pretty difficult or impossible given engine?
Sorry if this has been brought up before.
Re: Weather Effects
Posted: 12 Feb 2008, 19:41
by Argh
Yes, it's possible. I was going to put a random-weather generator into World Builder, and I have the basic conceptual stuff done, but time constraints have been getting into the way.
Re: Weather Effects
Posted: 12 Feb 2008, 19:58
by zwARREN69
Great to hear. Any interesting tidbits about the generator?
Re: Weather Effects
Posted: 12 Feb 2008, 19:58
by user
weather effects are easy to make, i have made a widget that makes animated water, and one that makes rain, and they dont use any special functions, so anyone can use them, other effects can easily be made.
Re: Weather Effects
Posted: 12 Feb 2008, 21:00
by zwARREN69
Have you released this widget?
Re: Weather Effects
Posted: 12 Feb 2008, 21:32
by user
not yet, the rain widget doesnt makes a good rain, because things drawn using lua gl get removed on the next frame.
Re: Weather Effects
Posted: 12 Feb 2008, 22:06
by zwARREN69
So how could it be implemented then? I only dabble in programming on occasion. Is there no function to carry the animation through multiple frames?
Re: Weather Effects
Posted: 12 Feb 2008, 22:20
by user
rain falls very fast, animation is not needed, i am working on a way to generate lots(probably more than 200) rain drops for every call to the rain function, it works, but the rain effects get removed on the next frame.
making them be created lots of times with an animation to stop it from being removed is not a solution, it causes alot of lag.
making a wait() function causes the game to crash.
the only way is using multiple rain drops for the display list, i am working on it, should be done soon.
Re: Weather Effects
Posted: 12 Feb 2008, 22:48
by zwzsg
I recall viewtopic.php?f=23&t=10474 but the links in here have gone 404.
Re: Weather Effects
Posted: 12 Feb 2008, 22:57
by user
they require hardware that supports glsl, my widget doesnt, and im sure mine is faster.
my goal with all those widgets that i made, is to allow the most cool graphics work without any special hardware.
Re: Weather Effects
Posted: 12 Feb 2008, 23:07
by Argh
You don't need to show individual raindrops, imo, that's overkill.
It'd be enough to have a quad with a tiling, animated texture of streaming rain, repeated a few times at different scales and angles beneath a "cloud". Just run a new offset every frame, and presto, you have rain. I was going to do this with CEGs, because it's not very hard to do that way and it'd look fairly good. I suspect that your LUA animated water might do the trick, if it used the alpha channel in the image to handle transparency.
Re: Weather Effects
Posted: 12 Feb 2008, 23:22
by user
raindrops without textures dont cause too much lag, display lists reduce lag by alot too, using display lists the data is passed directly to the GPU, every call to the rain() function generates about 87616 raindrops and 87616 hit effects(effect when it hits something), i used it for some time without any lag.
i tried tiled textures, it looks really bad at certain angles, and offsets,
they are not hard to make, just use a bunch of glTranslate() calls.
my animated water is very simple, it creates lots of 256x256 blocks using a display list, display lists are really good for graphics.
the rain is a big display list with 87616 lines that go from 0 height to 2000, the line width is 1.5, the list is called on the function rain(),
which is called from DrawWorld(faster than DrawWorldPreUnit).
Re: Weather Effects
Posted: 12 Feb 2008, 23:42
by user
is the hit effect important?, i think i will remove it and make some thing else like drawing a point as effect.
we could use heightmap texture, that thing, to make a dynamic rain drop effect, but first i need to learn how to use it, does it requires GLSL?
the effect could be like a point spawned at around 2000-3000 height
that falls down really fast, and does a cool hit effect, and stays in the ground for some time, and goes down slopes, is this possible with heightmap texture?
Re: Weather Effects
Posted: 13 Feb 2008, 03:27
by zwARREN69
I'm glad you decided not to do the textures, they do look bad if the camera is moved and from unintended angles. I know the GTA games used textures for rain. It looked alright most the time, but there were moments it looked pretty bad. Your script sounds awesome. I hope it works out well.
Re: Weather Effects
Posted: 13 Feb 2008, 11:56
by user
it looks good at the moment, textures makes things drawn with lua gl really slow, even if using display lists.
currently i am making it generate the rain effects only on playable map areas, because most of the time half of the drops are outside.
i will post a screen soon, it looks really good.
Re: Weather Effects
Posted: 13 Feb 2008, 13:52
by user
i will post a screen to show how it looks from different angles and options, all the screens show a battle, to show how rain affects battles.
this rain effect doesnt requires GLSL and no special functions, it was all made in a way that everyone can use it.
it doesnt lags much, on a 16x16 map, normal rain will have 6400 rain effects being displayed every frame.
some things that still need to be done: fog, and clouds, because in maps with a sunny skybox and no clouds, rain will look really bad.
clouds i know how to make, but how do i make fog in lua?
surely, this could be tweaked to make other effects, such as snow,
or whatever.
for the clouds, i will model a bunch of 3d clouds then find a way to load them with lua.
should i use textures for the clouds, or just colors?
how should the clouds look like?
right click to enlarge
does it look good?
Re: Weather Effects
Posted: 13 Feb 2008, 14:32
by Forboding Angel
Well tbh, anything that is always animated will normally not get the full effect in a screenshot. TBH a 5 second movie would be really nice to see.
Re: Weather Effects
Posted: 13 Feb 2008, 15:24
by user
i know, but the screen shows the difference for the animated water, normal water is very transparent, and its texture is hard to see sometimes, maybe i make a small movie.
about the fog, i found how to make it in lua, not a very good way, but i think it will work.
there is the unsynced Spring.GetCameraPosition function that returns a
xyz position, i could make it create a few big transparent spheres, or cubes, so that things that are close can easily be seen, when it gets more distant, it gets hidden outside the sphere view.
but i dont know how to draw a sphere using lua gl.
Re: Weather Effects
Posted: 13 Feb 2008, 16:14
by AF
More to the point, none of those viewpoints are normal playing angles, a top down view would be better. And short movies ftw
Re: Weather Effects
Posted: 13 Feb 2008, 16:33
by user
ok, i will get a screen showing a top down view, you will see that it is not bad for gameplay.
i will try to make some movies.
from those views, does it look good?
about the fog:
does anyone know how to draw a sphere using lua open gl?
i am trying to use some sample code that i found.