In Part 1 of this two-part tutorial, we saw how to obtain real-time weather data from the Weather Unlocked API so that our scene can mirror the weather of a real-world location.
However, in Part 1 we could only place white or dark clouds in our scene. Today, we’ll take our weather simulation a step further by adding rain, snowflakes, and thunder. As we add these new weather patterns, we’ll discuss storing data in objects and using a particle system to simulate snowflakes and raindrops.
My name is Nico Earnshaw, and I take care of the Decentraland documentation. That means everything you can find in docs.decentraland.org. If you have any feedback about our docs, please make a pull request or create an issue in the GitHub repo!
If you were following along with Part 1, then you can pick up right where we left off last week.
If you’re just starting out, you can download this version of the sample project that includes just the code we wrote last week.
You can also download all of the assets we’ll use in the scene, including 3D models and textures for raindrops and snowflakes, from this link.
Finally, you can also find the complete scene code, including both what we did last week and what we’ll do today, in the scene’s GitHub repository.Design raindrops #
The clouds that we added last week look nice, but we can take this to the next level by adding some rain. To create rain we made a simple 2d texture that looks like a raindrop. By using 2D models, we save on triangles, which helps with the scene’s performance. We could have created a 3D model shaped like a drop, but the realism probably would not be worth the performance cost.
Note that the image has a transparent background, and the raindrop itself is also partially transparent itself to help add a little more realism.Storing data for each raindrop #
Let’s think about how we want to use these drops in the scene. We want drops to appear in a rand...