Saturday, 18 April 2015

Storm Script - Wind Gusts

Something I wanted to include in the storm script are events like random gusts of wind, or gradual increases of turbulence and moving fog.

I began with implementing a random gust of wind. With the storm slider activated (anything over 0) I knew there would be a constant wind speed. I wanted the wind at a certain point to accelerate quickly then peak off and return to the constant speed.

To activate the event, a random number is generated at every frame and if that number is higher than a set number, then the event activates. I picked random numbers and played through the simulation a few times until I got a frequency I was initially happy with.


I knew the result I wanted and I was confident I'd be able to code it out but was initially stumped on how to implement it.

I discussed this with Computer Games Technology student Michael Daltrey who helped me to take my idea and apply a logical coder's approach to each step needed. I drew out a speed curve over time to suggest ways I could attempt to add the wind. Michael drew an acceleration curve as this variable would be the main change which would affect the speed at each frame. We decided the first curve type (out of the three drawn) was the easiest to approach and we worked out the pseudocode.

From here, I tackled this in Python, initially getting a triangular peak (as shown on the bottom right of the image) as I was using a constant acceleration and deceleration. After changing the rate at which the acceleration changes (to match the acceleration curve) and after contending with a few Maya freakouts I was getting promising results.


This is a screenshot from the script editor which prints out variable data each frame. This gust of wind was activated on frame 114. Note at frame 124 the acceleration is displayed as a very small number. This should be 0 but Maya doesn't quite agree, this was one of the freakouts I mentioned earlier, I had 2 lines of code which helped to work with that number.

Now I just need to link this variable to a wind field within the scene. That will then affect the particles of dust and smoke within the scene.

Thursday, 16 April 2015

Interface - Connecting Attributes

As my assisting tool was using sliders, I wanted those sliders to have meaningful number scales. I chose 0 - 100 as the default as its a good whole number, understandable and often associated with a percentage which works well for most of the sliders I've used. For example the storm master slider, goes from 0 - 100 where 0 is turned off and 100 is 100% storm intensity.

From the start, I wanted things like "Time" to be a little easier to understand so 0 - 24 seemed more appropriate. Yes I could have made this anything, it is an alien planet after all and days could be longer, but for the sake of usability: 7 is morning, 12 is midday, 8 is evening, etc.

Originally I used the maya command:
maya.cmds.connectControl(scene_time, "grp_light_control.rotateX") where the group held a light whose pivot rotated around the scene. For testing purposes I had to set the slider from 0 - 360 to work.
To get a better slider scale to work I was first a little stumped. I thought I'd have to add new attributes to objects with a scale I wanted, then use the hypershade editor to connect them to the existing attributes that needed to be controlled. Although I did need new attributes, set driven key was the solution.

Simply, I had to create a new attribute on the object I was controlling, so for the light control I added a variable named scene_time which had a minimum of 0 and maximum of 24. I then used set driven key to key the object's rotation (where 0 was 0 and 24 was 360). And now I have sliders that are appropriately scaled, hooray.

Saturday, 11 April 2015

Building the Environment - Renders

I've started to put together my environment. Similar to my test renders earlier, I've created a terrain mesh and included a texture. There is obvious repeating texture tiles but I'm not too concerned about this as any attempts to create a high quality texture complete with normal maps, etc. would take up too much of my time. It is not my area of expertise after all.


Using colour ramps its easy to add visible layers to the atmosphere. In the image above it doesn't look too great but in the image below I used it to create a haze of dust that sits above the surface. I also try to sort out a light which can be used to achieve different times of day depending on its position.






I'm quite happy with the final image, with a higher quality settings turned on the lighting looks a little better and the sky is a nicer colour. I added in clouds I'd created in an earlier test.

I will now attempt to alter the colours to match my earlier concept drawings.

Building the Environment - Concepts

In response to the learning contract I wanted to further specify what type of environment I wanted to build. I want to convey an alien planet, with inspiration from the planet of Mars and Saturn's moon Titan.

I didn't want to concentrate too much on the terrain and modelling aspect as this project is mostly about the air, the atmosphere and the dust particles that make up the rest of the scene. However I did want to consider the colours and composition of the scene.

I put together an environment in Photoshop that I tweaked the colours of to see what would work. They aren't meant to be works of art but they are a good representation of the direction I'm aiming for.

I wanted to make a clear difference between the planet in its calm state and when the big toxic dust storm came into the scene. For the planet's calm state I think the colours that work best are the second two which are slightly more blue.



The yellow is too close to the orange-brown dust so it gives the impression things are already hostile, whereas the blue is a complimentary colour to the ground. The blue is also more representative of our own atmosphere which we already come to recognise as safe. I liked using the blue to hopefully make people associate the blue with "breathable" air.

This idea is also used in Total Recall (1990) but they use a very dark red to identify the hostile environment and the blue with the breathable environment.


The below concept is an attempt at showing the planet enduring a toxic dust storm. My environmental art skill isn't fantastic but it gives an idea of what type of additions I want to include that invade the calm environment.

Tuesday, 7 April 2015

Tool Interface

As I want the environment to be controllable by the user, a small scripted tool will accompany the scene. It will be used as a simpler way to interact with the variables in the scene and allow the user to set-up the environment to suit their needs.

I have created the interface in Maya and although not functional yet, it serves as a good outline for what options I want to have.


I've used frames in order to split up the various sliders. The environment controls will handle things like the time of day, and the properties of dynamics already in place in the scene (such as the vents of gas on the surface).

The storm controls alter the variables which will be used in the storm expression. The storm expression will be coded separately and will use the user set variables to control the attributes of objects in the scene.

Last semester I used a form layout to position objects on the interface. This time I have used frames which allows me to split up the sliders, as well as allow easy addition of new sliders into the window without the need for manually inputting form positions.

Most of the sliders will go from 0 - 100 for ease, the "Time" slider will probably go from 0 - 24 to represent hours of the day. I may change this to a simple day/night slider or restrict this to certain hours as I am not yet sure how I would move the light source around to achieve a day/night cycle.
The "Master" slider would remain at 0 by default, setting this to 100 is essentially turning the storm on and choosing its intensity.

Sunday, 5 April 2015

Tool Interface Ideas

Part of the requirements for the brief is that some sort of scripting must be included. I've been thinking into how I would include this in my environment dynamics scene,

I have drawn up an idea of how I'd like to set-up my environment. I'd also like to allow the user to be able to activate the storm on and off via a separate window.


The interface could include sliders for things such as the time of day, intensity of the clouds and dust, or the turbulence and nature of any wind in the scene.

I am thinking about creating a storm script which would run off an expression. This expression would use the slider settings and generate the storm scene. The storm itself would likely be ramping up and down air turbulence, adding in sudden wind gusts and varying the degree of dust in the scene.

The tool and scene together would create a helpful tool for the user to set-up different scenes. For example if this was a CGI scene in a movie, the layout artist could quickly set-up how the weather is on that planet.
Unfortunately I don't think the tool could be used to dynamically change the weather in a scene. I would need to be able to bring in the weather from off-screen and more work would be required to get this advancing weather front to look natural. I will focus on purely allowing the sliders to set-up the scene beforehand where it looks good constantly playing. The storm script itself will vary the intensity based on settings.

Wednesday, 1 April 2015

Scene Composition

In response to the learning contract feedback, I needed a better plan of what sort of environment I'd be making and what would be included in it.

I came up with this quick sketch which identifies the different dynamic components that make up the scene.


In addition, I also considered how I may want to include the use of expressions and scripting in my project. An accompanying scripted tool that has control over certain aspects of the environment or attributes within the "storm" expression may help to give me a chance to script and also enhance the usability of the scene.