Weather Effects
Moderator: Moderators
Re: Weather Effects
updated the image, to show a top down view, with the ui turned on, it hardly affects gameplay.
Re: Weather Effects
Is it affected by wind direction?
Re: Weather Effects
good idea, i havent thought of it, but does the GetWind synced function works in unsynced?
edit: it works, going to implement it.
edit: it works, going to implement it.
Re: Weather Effects
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.
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.
Re: Weather Effects
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.
Using spheres probably won't look good because you will have sharp changes from one sphere to the next.
Re: Weather Effects
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.
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.
Re: Weather Effects
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.user wrote:glFog does no effect.
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.do you know a good way to draw a sphere using lua opengl?
Re: Weather Effects
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.
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.
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.
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.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.
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.
Re: Weather Effects
my sphere is working, i will post a screen soon.
Re: Weather Effects
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.
it is unsynced so player 1 cant see player 0 fog sphere, and player 0 cant see player 1 sphere.
Re: Weather Effects
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!
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!
Re: Weather Effects
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.
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.
Re: Weather Effects
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):
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
Re: Weather Effects
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.
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.
Re: Weather Effects
What happened to the code trepan wrote? the one where he had the krogoths in the hills popping out over the ground fog?
Re: Weather Effects
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?
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?
Re: Weather Effects
This is on track to be a very popular widget!
Re: Weather Effects
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.
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.