12
$\begingroup$

This type of snowfall looks nice:

enter image description here

If that example was made in Blender Internal or Cycles, I'd say particles were used - but particles clearly don't work in the BGE. How can a weather effect such as that be achieved in the Blender game Engine?

$\endgroup$
  • 3
    $\begingroup$ slowly making a good answer... $\endgroup$ – X-27 the fluffy unicorn Dec 22 '16 at 3:06
  • 1
    $\begingroup$ Take your time, I'm sure it will be worth it $\endgroup$ – VRM Dec 22 '16 at 3:59
15
+500
$\begingroup$

What a great question! It was actually surprisingly simple to make.

The texture:

I started by modeling a few snowflakes, and then used them as the display objects for a particle system. I then rendered out one frame with the screen covered nicely in snow:

enter image description here

Using the texture:

I then took that texture, and put it on a large transparent plane. The texture repeats way more than any normal should, but in this case it turned out fine. This plane is the most important part, and the settings are kind of hard to get right.

enter image description here

First, the face orientation must be set to Halo. This will make the plane track (along it's local X axis) to the player's camera. Second (but probably more importantly) the face's normal must be aligned to the object's local X axis so that it will face the camera correctly.

Now, regardless of the object's position or rotation, (because it only has one face with these settings) the face will always appear to the camera as if it were straight on.

The texture for this plane is a simple transparent texture. The Material's Z Transparency has an alpha of 0, and the texture's alpha influences the texture's transparency 100%. In this case, I have the snow texture influencing the material's color 10%, so that the base white color of the material is mostly used.

The physics settings and logic for this object is very simple. Physics type of no collision. Logic: Always - And - Motion (negative along the Z)

enter image description here

The snow plane is now done! if we press play, it should drop slowly, while facing the camera at all times.

The Empties to drop the plane

Now that we have a nice large snow plane, we can drop a few of them into the scene. We will basically be building a pseudo particle system, except that each particle has many, many flakes, instead of each particle being a single snowflake. (This is FAR less computationally expensive)

Now - we will need a few empties to periodically drop the snow planes. Use more empties packed closer together for more dense snowfall, fewer empties scattered further apart for less snowfall.

enter image description here

The empties have super simple logic: Random - And - Add Object (the snow plane.) Depending on how high up your empties are, you'll need a longer time for the snow to fall before being removed. There should be a long enough delay for the snow to fall entirely below the ground plane, as it looks really bad having snow falling from the sky and vanishing near the ground. While the difference is hardly noticeable, it helps to set a different seed for each empty, to make the randomness a little bit more random.

Positioning the Empties

These empties don't need to be scattered over the entire scene - that would waste computational power. It is enough to have the empties just above the character. Enter edit mode on your charter, and add a vertex at the character's object origin. Then, vertex parent all the empties to that vertex. (In this case to do a vertex parent, select the empties you want to parent, then select the object. Enter edit mode on that object. Select that one vertex, Press Ctrl + P, and click "vertex parent" Now, regardless of the character's location or rotation, the empties will stay in a fixed position relative to the character. If your character's physics type is set to dynamic or character, and there is no way it will ever rotate other than along the Z-axis, you can just use a normal parent for the empties.

The World Itself

You'll need fog set just right to make this effect go from nice to AWESOME. In this scene the following settings work, but depending on how dense you want to make your snowfall, you may want to tweak the fog settings to create the desired amount of visibility.

enter image description here

Of course, you'll also need a nice snow texture for the ground. It is kind of hard to get a good texture for this - I'm using a texture of ice to partially influence the material's color. This same texture controls the bump map. I have a sky texture with the mapping set to reflection, also partially influencing the material's color.

All the important settings for the material:

enter image description here

And the snow plane in the scene:

enter image description here

Add in the snow, falling from a bunch of empties in the sky:

enter image description here

This is the very same method that was used to create the scene in the question. Settings are slightly different from those used in the following scene. To make lower visibility, make the fog end closer to the camera, and make the snow more dense:

Finished Scene

quack

When combined with some wonderful explosions, the environment becomes Amazing.

enter image description here

$\endgroup$
  • $\begingroup$ One plane per snowflake, yes this is pretty close to particles. Good Answer $\endgroup$ – Monster Dec 22 '16 at 7:47
  • 1
    $\begingroup$ I'm using one plane with a bunch of snowflakes on it, as one plane for each and every different flake of snow would need waaayyy too much power to simulate. $\endgroup$ – X-27 the fluffy unicorn Dec 22 '16 at 16:56
  • $\begingroup$ Wow. Nice answer and nice result (your final .gif reminds me Silent Hill 1 and Shattered Memories games climate somehow). +1 from me. Congrats for getting an Egoist hat for this one btw ;). I'm trying to hunt it right now :). $\endgroup$ – Paul Gonet Dec 22 '16 at 23:47
10
$\begingroup$

Rain/Snow effect

A massive amount rain drops/stripes and snow can be achieved by showing one or more planes with according partly transparent textures in front of the camera.

Multiple planes can result in a depth effect. It adds some variation to the "falling" too. With a certain number of objects it will be harder to notice how many paths they take.

The texels on the texture should be small enough to prevent being recognized as flat object. In your sample above you see at the snow flakes close to the camera. They should be much more detailed as closer they are to the camera.

You can get the motion effect by either moving the plane, playing a video or animating the UV of the texture.

Make sure the end and the beginning of the animation fit together otherwise you get a frequent and noticeable jump.

Moving the plane

This is as simple as it sounds. You move the plane from top to bottom. Easy way: play an action.

Be aware the border of the plane should never be visible to the camera.

Playing a video

Have a plane on place, but play a "snowflakes video" via VideoTexture.

UV scrolling

The BGE has a simple build in UV-Animation (UV/Image Editor -> property menu n -> Game Properties). This fits pretty well this situation.

Alternative you can manipulate the UV via Python.

Location

Camera relative

A simple method is to parent the plane(s) to the camera. This way you need just a view of them. Unfortunately when moving and turning the rain/snow seems not to belong to the scene.

Scene relative

A more complex method is to place the planes into the scene. This let it appear more plausible.

You need to ensure that the planes borders are never visible (otherwise you loose the effect). So you need a balance between details and efficiency.

You need to ensure the planes are visible with a direct view angle. Otherwise they will be recognized as planes and flat objects. You can solve that with the material setting "billboard".

You need to dynamically add/remove the planes otherwise you would need so many planes that you will get processing problems. This is typically solved by Python due to it's dynamic nature. At a certain distance to the camera you add planes. When the distance between camera an a plane exceeds a certain limit you remove the plane (as it should not be visible anymore).

I hope you get the idea.

$\endgroup$
  • $\begingroup$ (I actually had taken the example in the question from the snow system I used in Arctic Drones, by dropping large transparent planes in the scene at different depths. I am writing a detailed answer, rather slowly, and there may be room for improvement.) $\endgroup$ – X-27 the fluffy unicorn Dec 22 '16 at 5:45
  • $\begingroup$ So you writing the answer to your own question? $\endgroup$ – Monster Dec 22 '16 at 5:49
  • 3
    $\begingroup$ It is actually rather common (and encouraged) when an SE user finds a cool bit of information, to make a question and answer it themselves so other users can also benefit from it. $\endgroup$ – X-27 the fluffy unicorn Dec 22 '16 at 5:56
  • 1
    $\begingroup$ That is no problem. Just do it $\endgroup$ – Monster Dec 22 '16 at 6:05
  • 1
    $\begingroup$ Added my answer - It would be really nice to know if there is anything that I'm doing wrong/inefficiently, which is really likely, knowing some of my past answers :) $\endgroup$ – X-27 the fluffy unicorn Dec 22 '16 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.