Cloud system successfully revived!

Ask questions, discuss ideas, get answers
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Cloud system successfully revived!

Post by Apache Thunder »

All these years and all I had to do was drop in the BF2 skydome and use it as the "cloud" mesh.

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 I used the skydome from BF2 and that gets me 90% of the way to getting a good cloud mesh. The uvmap for the top is not optimized very well and looks a little weird, but after enabling the cloud geometry template and having the correct texture assigned to it in the rs file, it now is 90% of the way of being another kickass addition to this game. :D

Here's video of the epic cloud system finally revived!:



I played around with it in the debugger to prove that it is NOT a mesh with a BIK video texture or anything. This is the genuine cloud system in BF1942 as it was originally intended to operate as coded by EA. I just finally found how how to get it working!



How the hell did I not think of using a skydome before and how is it that no one else has ever figured it out? Why would EA/Dice code up all the cloud templates but delete the cloud geometry in the final game? All that trouble to make something really nice and only to disable it at the last minute. Were computers back then really so old that they couldn't handle scrolling clouds? lolz


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
I don't think the texture assignments work anymore since they used a mesh now and that mesh's RS file is what defines the texture. I will experiment with getting multiple layers of clouds working, but the first layer works great. Most of the cloud coding in Rallisport Challenge still work in BF1942 and the cloud coding I used above is actually something I copied and pasted in from Rallisport Challenge only with a few edits to the height and speed.



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.

Once I get a mesh to replace the BF2 skydome, I will of coarse post up something that should be useable in future and existing mods! I'll update this thread as I progress through this. :D

EDIT:

Here's the finished files that you can use:

el_elala_cloudsystem.rar

Be sure to use your own textures and settings if you want better results!
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Cloud system succesfully revived!

Post by fo0k »

.....!

wow..

it actually looks pretty good! is strange not to include it but i guess just an optimisation. (or they never figured out the uv's at the top heheh.)

crazy find sir.. the lensflare always got me... never worked?

it looks more like a flat plane than a dome.. but i guess thats intentional?
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Cloud system succesfully revived!

Post by Apache Thunder »

I've finished redoing a new mesh and tweaking the coding. Two or more cloud layers with independent setting is possible. I'm uploading a video that shows it.

The new mesh does kinda make it look more flat, but someone with better mesh and UVMapping skills can probably make it look more realistic. I've mainly done what's needed for others to improve upon. :D

New video of finished result in retail game. (thus now it's confirmed that it works outside of the debugger environment! :D)



Here's the finished files that you can use:

el_elala_cloudsystem.rar

I've included some comments in the code to explain what some of it does. But the cloud system isn't complicated at all, so it shouldn't be too difficult to fiddle with once you got a good set of textures and a mesh to put them on. Further testing is needed to see if different textures can be used on the other cloud layers. Turns out the game uses "cloud.setTexture" instead of "cloud.texture" that Rallisport Challenge originally used. Count this as one coding system from Rallisport Challenge that still works in BF1942! :D

EDIT:

Having the edges of the cloud dome extend below the zero plane might make it appear more 3D. You may give that a try as well.
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Cloud system succesfully revived!

Post by fo0k »

well the flat appearance is of course whats needed.. just amazed it does look like that :)

once I'm out of the tunnels I will give this a try on something with daylight.
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Cloud system succesfully revived!

Post by Apache Thunder »

Cool. Let me know what you eventually get working with it. I bet higher resolution clouds will definitely make things look better. :D
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Cloud system succesfully revived!

Post by fo0k »

so in that last vid you have a couple going..
wondering what else could be achieved if possible to layer
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Cloud system succesfully revived!

Post by Apache Thunder »

Yep. That was two layers. One layer has slightly slower speed with smaller texture scale to make clouds smaller. Second layer (which I think is the closer one) uses a faster scroll speed with larger texture scale.
ImageImageImage
I have cameras in your head!
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Cloud system succesfully revived!

Post by Swaffy »

When are you guys going to run out of ideas?
Those clouds look very nice, by the way.

Pin this up somewhere, it could make a good tutorial.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Cloud system succesfully revived!

Post by Apache Thunder »

:D

Here's the more polished result. I've made the clouds fit in better with El Alamein and are a bit more "hazy" in appearance.



Updated RFA:

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 to provide an example for future modders and wasn't tailored specifically for the map I ended up testing it on.

I took you up on the suggestion and posted a modified copy of this thread in the tutorials section. I removed all replies since it's a new thread (since I found it easier to "copy" the thread to the new section) and edited it a bit. :D
ImageImageImage
I have cameras in your head!
Grabbi
Posts: 42
Joined: Wed Aug 03, 2011 3:37 pm
Location: Germany
Contact:

Re: Cloud system successfully revived!

Post by Grabbi »

very nice review Apache Thunder!Image
[url=bf1942://85.214.226.169:14567]Image[/url]
Post Reply