Using the cloud system in your own mod.

If you know something thats not in here please share it

Using the cloud system in your own mod.

Postby Apache Thunder » Thu Sep 06, 2012 10:14 pm

Some info on how the cloud system was supposed to work in BF1942.

In all maps the template name goes by "cloud" and is remmed out. The file this mysterious geometry template refers to no longer exists and perhaps can only be found in an old beta of the game that has yet to surface. But once a correct mesh is used to replace the missing mesh, it appears to work flawlessly. You may use your own mesh, or use mine. The main thing to look out for is that the mesh should be above the zero plane (though you can have the edges extend to and below if necessary). Otherwise it may not work correctly. Also you must have a sky geometry defined and it must be large enough for the cloud mesh to fit inside it.

Here's a video of how the cloud system will appear once re-enabled and set up correctly:




The cloud mesh behaves much like a second skybox only it has proper alpha and the cloud coding defines the speed and position. So it also scrolls across the mesh and is not static.

Alright here's how I had the clouds coded in the SkyAndSun.con file. Note that the cloud geometry must be defined AFTER the sky.initSky command or else it will complain in the logs about not being able to find the sky geometry and your cloud geometry will never appear:

Code: Select all
rem
rem *** All cloud stuff including geometry template must be added after the sky.initSky command! ***
rem
sky.initSky
Sky.setCloudFog 1

rem
rem *** Cloud Geometry (check to ensure it will fit inside your custom skybox mesh) ***
rem

GeometryTemplate.create StandardMesh Cloud
GeometryTemplate.file ../bf1942/levels/El_Alamein/standardMesh/cloud


rem
rem  *** Each AddCloud entry creates a new cloud layer ***
rem
Sky.addCloud
Cloud.setName cloud_0
Cloud.setSrcBlend BMSourceAlpha
Cloud.setDstBlend BMInvSourceAlpha
rem
rem  *** setTexScale command alters size of clouds. Smaller numbers = larger clouds. ***
rem
Cloud.setTexScale 4
rem
rem *** Sets direction and speed of cloud scrolling. Vec2 float values. ***
rem
Cloud.setSpeed 0.01 0.01
rem
rem *** Sets Height of cloud layer. ***
rem
Cloud.setHeight 3000
rem
rem *** Appears to set a texture. Unknown if it is able to override texture assigned by RS file. ***
rem *** Experiment to find out. ***
rem
cloud.setTexture cloud3


rem
rem  *** Second cloud layer ***
rem
Sky.addCloud
Cloud.setName cloud_1
Cloud.setSrcBlend BMSourceAlpha
Cloud.setDstBlend BMInvSourceAlpha
Cloud.setTexScale 1
Cloud.setSpeed 0.008 0.008
Cloud.setHeight 2000
cloud.setTexture cloud6

rem
rem  *** Appears to alter global position of all clouds as group. ***
rem  *** Experiment to see what it does. ***
rem
Sky.changeOfsCloudHeight 2500
Sky.changeOfsCloudDist 333


The cloud.setTexture commands don't appear to be functional anymore, so you can probably leave those out. Unfortunately this does mean you are limited to one cloud texture per map. But you can have as many cloud layers as you want and each one can have a different height, size, and scale so you do have a little flexibility despite the one texture limit.


Note all the sun related setting appear after the cloud coding and the sky geometry along with the (currently still inactive) lensflare stuff at the beginning of the file. I only included the stuff pertaining to the cloud system.

Here's the finished files that you can use as an example:

el_elala_cloudsystem.rar

Be sure to use your own textures and settings if you want better results!

For more tailored cloud settings for El Alamein, I made this more polished cloud settings (which is the version shown in the video)

El_Alamein_004.rfa

This version is better suited for El Alamein. The previous ones were just something to show off the cloud system and wasn't tailored specifically for the map I ended up testing it on. So this one is for those who want to spice up El Alamein with better clouds. The first link is recommended if you want to learn how to use the commands since that's the version that has the extra comments added to the code to explain the commands.

If you have any issues getting it to work or have questions, please refer to this thread where any discussion of this should be covered:

Cloud system successfully revived!
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Return to Modding/Mapping Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest