Weather Effects - Page 2

Weather Effects

Requests for features in the spring code.

Moderator: Moderators

user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

updated the image, to show a top down view, with the ui turned on, it hardly affects gameplay.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Weather Effects

Post by AF »

Is it affected by wind direction?
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

good idea, i havent thought of it, but does the GetWind synced function works in unsynced?

edit: it works, going to implement it.
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

should the calls DrawWorldReflection,Refraction,Shadow be used with the rain too?

i found a way to make a fog sphere, i modeled one then exported as obj,
which is an ASCII format, then just make the gl vertex calls.
eriatarka
Posts: 67
Joined: 26 Jan 2008, 18:50

Re: Weather Effects

Post by eriatarka »

GL has a fog effect built in, I wonder whether using that would work.

Using spheres probably won't look good because you will have sharp changes from one sphere to the next.
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

glFogcoord causes the game to crash, and glFog does no effect.

my plan is to make the sphere always get rendered around the camera, it will use normals, and shading to make the edges look a little better.

do you know a good way to draw a sphere using lua opengl?

the current way i am using is not very good, i have to write a big list with alot of vertex data, which makes it hard to edit later.
eriatarka
Posts: 67
Joined: 26 Jan 2008, 18:50

Re: Weather Effects

Post by eriatarka »

user wrote:glFog does no effect.
Well, of course, it only sets parameters for fog, and glFogCoord is not required by default. The fog itself has to be enabled with glEnable, but I guess you'd have to disable it for the GUI... I'm not sure if it can be done in a clean way from Lua.

do you know a good way to draw a sphere using lua opengl?
Look at lups/ParticleHeaders/spheres.lua in BA, it might help. Though I still think it won't look good as the change from one fog "level" to the next would be abrupt, not smooth; but go ahead and try.
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

i cant think of a better way to do this, and cubes wont look good,
fog sphere i mean a bunch of spheres, the first has a x size, the second is x + another value, the third is the second + another value.
Though I still think it won't look good as the change from one fog "level" to the next would be abrupt, not smooth; but go ahead and try.
the rain will take care of making it look smooth, the sphere is the best possible way to make fog in lua, there is no glEnable in lua.

maybe it could be done using GLSL, but some people wouldnt be able to use it, and my goal is to make it not require any special functions.
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

my sphere is working, i will post a screen soon.
zwARREN69
Posts: 40
Joined: 12 Feb 2008, 04:55

Re: Weather Effects

Post by zwARREN69 »

Does it have hard edges?
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

it does, but they wont be seen, the sphere will allways be on the camera position, with a large scale, so they cant be seen.

it is unsynced so player 1 cant see player 0 fog sphere, and player 0 cant see player 1 sphere.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Weather Effects

Post by Argh »

Hmm. Better question is whether whatever fog is created will get along with the default map fog... overall, this looks like it's going to be awesome, though.

Couple of questions:

1. How hard will it be to vary the amount of rain generated per-frame? I'm guessing you just use one variable to control that, but wanted to ask- that's something that could make it look a lot more realistic- variations over a few seconds would really make it feel very natural.

2. Can you manipulate the lighting on the map? I know we can't manipulate the sky directly, but it'd be awesome to hide the sky with some clouds up above, then make everything all dark and rainy-feeling, and then code in some lightning flashes coupled with thunder sounds...

At any rate, I'll happily code it into an example for World Builder when you're happy with it, this looks a lot cooler than what I was going to do!
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

creating varied rain is not a problem, just create an array of rain effects, about 16 should be ok, 0 has few rain, bigger number more rain.

the clouds, that is one thing i want to do, but i would have to find a way to easily convert models to lua, converting them by hand is not a good way, and 2d clouds wont look very good.

we could use DrawWorldPreUnit for it, but the clouds would have to be low poly, since DrawWorldPreUnit makes 3 times more lag than DrawWorld.

the lightnings could be big planes randomly spawned in the front of the camera when the camera is looking at random angles, it sounds like a bad idea, but it is a very good way to make lightnings.

this is not at its best version currently, it can be optimized, after i finish some changes, it will hardly cause lag.

and, should the draw reflection,refraction,shadow, calls be used in the widget?, by adding them, the objects will get drawn in water reflections, refractions, and they will have a shadow.
Last edited by user on 13 Feb 2008, 22:43, edited 1 time in total.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Weather Effects

Post by Argh »

How about using the shader that generates clouds in Spring, just feeding it different (lower) coordinates, and variable settings that make it look a lot cloudier?

Here's the shader, from clouds.fp (all of the shaders are in SpringContent.sdz, btw):

Code: Select all

!!ARBfp1.0
OPTION ARB_fog_exp;

PARAM detailMul = { 0.05, 0.0, 0.0, 0.1};
PARAM dp3sub = { -1, -1, -1, -1};
PARAM expStuff = {16, 1, 1, 0};
TEMP temp,temp2,temp3;
TEMP cloudColor,tempColor;
TEX temp, fragment.texcoord[2], texture[2], 2D;
TEX temp2, fragment.texcoord[1], texture[1], 2D;
MAD temp, temp, {2,2,2,1},dp3sub;
MAD temp2, temp2,{2,2,2,1}, dp3sub;
MUL tempColor, temp.x, program.env[10];
MUL cloudColor, tempColor,temp2.x;
MUL tempColor, temp.y, program.env[11];
MAD cloudColor, tempColor,temp2.y,cloudColor;
MUL tempColor, temp.z, program.env[12];
MAD_SAT cloudColor, tempColor,temp2.z,cloudColor;
TEX temp3, fragment.texcoord[3], texture[3], 2D;
MAD temp3.w, temp3.x, detailMul.x, temp.w;
MUL temp3.w, temp3.w, temp3.w;
MUL temp3.w, temp3.w, temp3.w;
MUL_SAT temp3.w, temp3.w, expStuff.x;
TEX temp, fragment.texcoord[0], texture[0], 2D;
LRP result.color, temp3.w, temp, cloudColor;
END
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

well, that would make lag, and some people would not be able to use it.

those things made using shaders can be made without them too, it is not hard.

there is a bunch of lua gl functions that can be made to make the clouds look smoother.

and, i just found a way to make 2d clouds look cool, just make a very big cloud plane, with varied cloud textures, and make it move when the camera moves, like spring clouds.

or a bunch of 2d clouds that rotate to face the camera, as the camera moves.

there are alot of solutions for this.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Weather Effects

Post by AF »

What happened to the code trepan wrote? the one where he had the krogoths in the hills popping out over the ground fog?
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

i never heard of it.
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

i have managed to attach the fog sphere to the camera, it looks really cool.

now i need to properly rotate the sphere, to follow camera rotation, and, the fog system will be done.

then i will make the lightnings.

then i will optimize it, to run faster, remove a few rain drops, maybe make the sphere have less polygons.

then make the clouds, should not be hard.

then make some more weather effects like: snow, or lava, whatever,
cool effects.

something that would be cool is day-night cycles, maybe using that same spheres?
zwARREN69
Posts: 40
Joined: 12 Feb 2008, 04:55

Re: Weather Effects

Post by zwARREN69 »

This is on track to be a very popular widget!
user
Posts: 452
Joined: 22 Jan 2008, 16:33

Re: Weather Effects

Post by user »

how is the sphere suposed to work:

a sphere is drawn in the front of the camera, just to change the ambient color,

then the next one is drawn at a certain distance, attached to the camera too, to make the fog, and maybe another at a bigger distance.
Post Reply

Return to “Feature Requests”