Jump to content

Clouds in T3D


MilkywayM16

Recommended Posts

Hey guys! Long time lurker, first time poster. I know quite a bit about Torque and want to take the time to learn a little bit more. While there is documentation about the cloud types available in Torque, I haven't really seen too many high quality examples of what the cloud systems in Torque are capable of. I'm more specifically referring to the cloud layer, not the basic clouds.


I've played around with the default art asset and all of the settings in the editor and have never really come up with any combinations that really look good. There doesn't seem to be any documentation around effectively creating a new cloudlayer normal map, so I've fumbled around in photoshop trying to best estimate how it will look ingame only to find out that it looks nothing like what I intended.


Basically I get the feeling that the cloudlayer just isn't powerful enough to do the things that I want it to, but I need confirmation from other users of Torque who might have had a better experience in creating some awesome looking results. What are your thoughts on the cloudlayer object?

Link to comment
Share on other sites

Well this won't get you all the way there, but if you really want a complex, diverse and realistic sky model with all kinds of clouds, you might consider joining me in my little "borrow as much useful content as possible from FlightGear" campaign. The cloud models are in .ac format and need to be converted to dts (my method has been going through blender to get models into collada, and then importing them into Torque.) They also have flat texture layers in addition to the 3D clouds. Here's just one screenshot, if you look around on flightgear.org and their forums you'll find many more:


http://www.flightgear.org/wp-content/gallery/gallery-v2-8/6oxqb.jpg


I would personally love to see everything FlightGear can do re: clouds and weather imported wholesale into Torque, and I don't think their community would have any problem with it as long as we were open about where the content came from. It's all released under an open license anyway. There is still work to be done on the T3D side, of course, to make sure the sky layers are capable of everything necessary and to work in the 3d models where appropriate. I'm not familiar at all with the sky system so can't help you much at this point, but it is on my list for sure.

Link to comment
Share on other sites

Heh, I couldn't find an easy way to copy out a list of filenames, but here's a screenshot of the top part of my FGDATA models/weather directory just to give you an idea of how many models we're talking about.


http://opensimearth.com/images/screenshots/FGDATA_clouds.jpg


The total count is 124. You can browse and download the .ac models from here:


https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Models/Weather/


I don't remember if I had to download a plugin for Blender or not, if it doesn't work for you let me know and I'll find it on the FlightGear site. If it works you can just go to Import->ac model, and then export as DAE, and you're up to where I am so far. As mentioned in this other thread I'm still having trouble importing some textures, and all of the textures have needed to have materials written for them by hand in Torque script.

Link to comment
Share on other sites

Ha, well, I thought I'd try it myself, but so far I can't exactly report epic results. Much of the problem I think is my own ineptitude and general confusion when it comes to dealing with the Material Editor and Torque materials in general, but I wouldn't be surprised if we're having some translation difficulties in our little import pipeline here. This is what I got after messing with it for half an hour or so and trying a handful of different models at random. I still haven't found the little puffy white cloud blobs in the above screenshot, most of these are more planar, and obviously I'm completely wrecking the materials and losing the transparency. Some help from an actual artist here would be awesome. :-)


http://opensimearth.com/images/screenshots/fg_clouds_01.jpg


The smaller blob in the foreground is a 1% scaled down nimbus1, the higher farther away pair of planes is altocumulus1. The others I tried were all more or less planar, the nimbus has been the most interesting mesh so far. Flightgear also does all kinds of animations and other work on these in the engine, so there's no guarantee the models on their own are ever going to look perfect... but the FG side is open source too, and also has a fairly large and helpful community, so sooner or later I'm sure it can all be figured out.

Link to comment
Share on other sites

If I had to guess, the models are designed so it's a bunch of billboards to give it a sense of volume, in variable shapes so you can have a cloud 'model' of varying types.


I'd been mulling on doing something like that m'self, so that's pretty neat. What you'd likely need to do is flag the quads in the model in blender with the BB prefix, which tells the TSShape that it's supposed to be rendered as a billboard. This way you can have a single model file with precreated billboards rendered all normal-like with regular materials.


From there, as you said, you'd create materials for the cloud puff textures(really, a script could be written that just while-loops over the files and creates a basic diffuse texture material with the translucency options on) and then use with the model.


Since it goes through the regular materials, it should also at that point shadow cast on the terrain, which would be a fantastic addition.


I'm also in agreement with you, Chris, that a full cloud/weather system would be incredibly useful.


There were some old resources on the GG site that could act as a baseline that would randomly permute through barometric pressures, and have weather events blend in/out based on certain amounts.


It'd be pretty easy to have the ability to define min/max ranges, as well as min/max temperatures, and other such things as well that the weather system could iterate on. With that sort of setup, it'd be fairly easy to configure a map so that during the early morning, between the air pressure, humidity and temperature, you get fog, lots of clouds, etc, etc.


Could even blend clouds in/out on the fly with this by adjusting their alpha level. Spawn a cloud model in, move it given the level's wind settings, and have it fade in and out based on a few parameters pertaining to air humidity, LCL height, etc.


Obviously not all games would need all that, but a full system that could be modified and customized as a base would be suuuuuper cool.

Link to comment
Share on other sites

Indeed, totally with you on the full weather simulation goal... another thing worth mentioning though is the METAR system, which FlightGear uses to model real life weather coming in from the network of METAR sources at airports, etc. Even if you didn't want to use them in realtime, the codes and a stored history of some of them could let you fake an awful lot of weather simulation, without ever having to deal with the barometric pressure and temperature stuff yourself.


But of course that's nowhere near as much fun. Personally I'm hoping to plug in a full on weather simulator at some point, I seem to have lost the link but I had an open source fire/local weather simulator on tap a while back. It might be overkill for game purposes, but I'm slowly learning the advantages of letting other people do the heavy lifting whenever possible. :-)

Link to comment
Share on other sites

The clouds in the crysis vid u posted would be more of a simple texture based cloud layer, which is what the basic clouds in torque does, the cloud layer isnt really meant for that kind of detail i dont think, the clouds are multiplied together in the shader so it looks like clouds form and disappear, u would use cloud layer on a stormy sky or something like that not really for that kind of scene in crysis, for those clouds get yourself some really hi-res or semi hi res images of clouds and add them into the textures on the basic clouds layer and u will get a similar effect


EDIT: heres a fun idea for ya though : - u could expand the basic clouds a lot more quickly and easily than the cloud layer to do what u want, if u modify the shader to take into account a normal map for each of the clouds u could implement scattering and rim light and things like that to give depth to your clouds

Link to comment
Share on other sites

The clouds in the crysis vid u posted would be more of a simple texture based cloud layer, which is what the basic clouds in torque does, the cloud layer isnt really meant for that kind of detail i dont think, the clouds are multiplied together in the shader so it looks like clouds form and disappear, u would use cloud layer on a stormy sky or something like that not really for that kind of scene in crysis, for those clouds get yourself some really hi-res or semi hi res images of clouds and add them into the textures on the basic clouds layer and u will get a similar effect


EDIT: heres a fun idea for ya though : - u could expand the basic clouds a lot more quickly and easily than the cloud layer to do what u want, if u modify the shader to take into account a normal map for each of the clouds u could implement scattering and rim light and things like that to give depth to your clouds

 


It would be great to get the god ray shader to work with the clouds layer.

Link to comment
Share on other sites

that would be great, as far as i know the cloud layer doesnt render to the prepass texture im not sure, but in lightRayOccludeP passing the cloudlayer texture would be easy if they were all in one shader much like the way the postfx shaders are, most of them are in one script file and the pass from one shader is passed into the next shader using these variables:-


$inTex

$outTex

Link to comment
Share on other sites

that would be great, as far as i know the cloud layer doesnt render to the prepass texture im not sure, but in lightRayOccludeP passing the cloudlayer texture would be easy if they were all in one shader much like the way the postfx shaders are, most of them are in one script file and the pass from one shader is passed into the next shader using these variables:-


$inTex

$outTex

 

I am not that familiar to the way passes work. I am new to 3d world.


Could we just save that texture and send it to the lightRayOccludeP when it's called ?

Link to comment
Share on other sites

well thats the thing i dont know until its tried and im not at my pc atm, i have the github up here though,


see the way the data works?

 

singleton PostEffect( LightRayPostFX )
{
  isEnabled = false;
  allowReflectPass = false;

  renderTime = "PFXBeforeBin";
  renderBin = "EditorBin";
  renderPriority = 10;

  shader = LightRayOccludeShader;
  stateBlock = LightRayStateBlock;
  texture[0] = "$backBuffer";
  texture[1] = "#prepass";
  target = "$outTex";
  targetFormat = "GFXFormatR16G16B16A16F";

  new PostEffect()
  {
     shader = LightRayShader;
     stateBlock = LightRayStateBlock;
     internalName = "final";
     texture[0] = "$inTex";
     texture[1] = "$backBuffer";
     target = "$backBuffer";
  };
};

 

outtex and intex


If we could render the cloud layer out to the prepass i think it would work, although this may need some changes in the source code, it may work just by changing the shader but because its not a postfx i dont think we can choose what to render the final result to

Link to comment
Share on other sites

well thats the thing i dont know until its tried and im not at my pc atm, i have the github up here though,


see the way the data works?

 

singleton PostEffect( LightRayPostFX )
{
  isEnabled = false;
  allowReflectPass = false;

  renderTime = "PFXBeforeBin";
  renderBin = "EditorBin";
  renderPriority = 10;

  shader = LightRayOccludeShader;
  stateBlock = LightRayStateBlock;
  texture[0] = "$backBuffer";
  texture[1] = "#prepass";
  target = "$outTex";
  targetFormat = "GFXFormatR16G16B16A16F";

  new PostEffect()
  {
     shader = LightRayShader;
     stateBlock = LightRayStateBlock;
     internalName = "final";
     texture[0] = "$inTex";
     texture[1] = "$backBuffer";
     target = "$backBuffer";
  };
};

 

outtex and intex


If we could render the cloud layer out to the prepass i think it would work, although this may need some changes in the source code, it may work just by changing the shader but because its not a postfx i dont think we can choose what to render the final result to

 

I can't get my head around on how to render the cloud layer to the input texture.

I wonder why can't we just make a copy of the clould layer render and use that as a input. It is because the cloud layer is rendered after the god ray shader?

Link to comment
Share on other sites

not sure, when making the skyline class he probably made a call that rendered it to the prepass buffer. Then that is passed to the lightrayOccludeP as u can see from its accompanying script and that makes it so it interacts and shows the godrays.

 


Is that call hard to make ?

Link to comment
Share on other sites

I'm glad there seems to be a lot of interest in this topic, thank you all for responding! It seems like it would be safe to say that the default cloud layer object is simply not that powerful alone. I've actually done tons of casual research on the topic of skies and clouds in video games and it would be neat to see a better system implemented in Torque. Every existing method has its strengths and weaknesses, maybe the solution is a system that uses multiple methods? I'm definitely going to look into it.

 

the artwork for the cloudlayer is controlled in its alpha channel almost entirely i think

Does this mean that the normal map is unnecessary? Personally I think the addition of the normal map makes the clouds look worse. I think it was originally implemented to give some depth to the cloud layer but, at least with the default asset, it looks off to me.

 

Even many modern games still just use a skybox, since it looks better, they don't even have tools like clouds as in Torque.

I often use a semi transparent clouds texture as a cloud layer, it is good enough for me, here you can see an example: http://www.moddb.com/games/uebergame/images/ruins-dawn-preview#imagebox

Thanks for providing the screenshot, I actually really like what you achieved. It's simple but looks good and seems to be effective.


It'd be nice to see more implementations of the default cloud layer to get an idea of how different people use it. I think Deadly Matter uses a mostly-default cloud layer with a different texture and it looks pretty great. Maybe if I'm lucky, one of the guys from that team will wander in here and clue us in :D


As a side note, I believe the cloud layer already occludes the god rays, but I could be mistaken.


Oh and as another side note, can anyone tell me what the point of the "dynamic fields" section is when viewing an object in the inspector? In the scattersky object, there are fields that define moon texture, night skybox texture, mie scattering, sun brightness, etc but they seem to do nothing when I change the values and in fact seems to break functionality that I remember working in past releases of T3D. Does anyone know what's going on there?

Link to comment
Share on other sites

Sorry to double post, but I wanted to share what I've been prototyping since I started this thread:


http://i.imgur.com/nje3hkp.jpg


I didn't want to stretch the page with too many pictures, so you can find the rest here: http://imgur.com/a/wAOdb


Not sure what the fps impact will be but hopefully it's negligible. I have big plans for a new cloud system so stay tuned.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...