Wednesday 29 April 2015

Progress Updates

I've made some progress on my project and this update should cover all the latest additions.

I've now linked in opacity attributes into the master slider. These were initially unable to be keyed to the variable but I have used a workaround for this. These particular attributes control opacity settings on the opacity ramps which do not have a corresponding attribute to be keyed. However you are able to set the attribute in the script so these are updated in the storm script directly.

I've also added in the secondary cloud layer which resides just above ground level. This one of my favourite additions to the scene as it really creates some immersive effects. I've made this reasonably fast paced and both its texture time and opacity are linked in to the main storm controller.

Unfortunately I have ran out of time to explore the dynamic behaviour of the dust particles in the air. This would be linked in to a turbulence field which I shall discuss below. I'm not too concerned about this as I would've needed to explore more shading options to get the right effect I was looking for.

I've scripted in an air turbulence regulator which goes alongside the gust of wind event. It generates random numbers which over the course of 100 frames ramps a variable up and down. My plan was to link this in to the turbulence or use it to change the direction of wind over time. The script does provide a working set of numbers to work with (still needs a little tweaking) but I just don't have the time to finish that.

I have been unable to sort out the rendering issue and have tried other computers to see if it was just mine. I've also ran into countless other Maya errors, most of which are harmless but are considerably annoying to deal with. I've logged these in a text file which I'll include with the final project files.

As this was my last module hand-in for this semester, I was unable to foresee these rendering issues and with other modules taking up a lot of my time in recent weeks I was unable to solve the issue. I will have to use the Maya software renderer which does the job but doesn't look as good.

Thursday 23 April 2015

Rendering Errors

Unfortunately I've been experiencing a lot of rendering errors which I have so far been unable to solve. This is particularly distressing considering hand-ins are approaching.

This blog post documents the errors and steps taken to try and solve a workaround.

The main error I've encountered is "Error: *Fatal* (mental ray) : mental ray encountered a fatal error. The system may have become unstable. Please save the scene and exit Maya."

Unfortunately Maya does not give any more additional information about this error and looking up troubleshooting gives multiple possible causes and solutions. As always with Maya errors, a number of people online also claim to run into this problem but rarely are there any mentions of how or if the problem was solved.

Maya's Support Article claims the issue is related to textures being only 1 pixel however this does not seem to be the issue I'm having. The scene has been previously able to render but it is perhaps an additional object in the scene which is preventing the render. I will attempt to identify what object may be causing this.

Maya Software and Hardware rendering still works but the quality is far less superior and greatly increases the visibility of particles in the scene which doesn't particularly look very good. It does still show the storm script in operation which is good and may have to be used

Tuesday 21 April 2015

Creating Clouds

I've mentioned a few times before that I'd tested out dynamic clouds but haven't yet shown my work with them.
Originally following this tutorial I combined the clouds with the atmospheric fluid containers and the results were a good start.



By increasing the "Texture Time" each frame the clouds would shift, un-form and reform which looked pretty cool. I tried this out as an expression then later included it in my final environment.

I've now got clouds set up in my scene and it is controllable via the interface and storm script. By using the master storm slider the height of the clouds is decreased, I also alter an opacity setting that increases the thickness of the clouds.


The intensity of the storm also affects how active the clouds are, you can just see this in the playblast I've included although sometimes hard to see.

I hope to alter the colour and lightness as well and most importantly I'm going to add in a secondary layer of clouds only visible during the storm that are closer to the ground.


Monday 20 April 2015

Connecting Wind to Script

I've now got a working "wind gust" in the storm controller. I now want to control this attribute to a wind field within the scene. This will then affect the vents of gas that are coming from the planet's surface.

Similar to my tests with particle emitters, I created a Volume Axis field and positioned it over the gas vents. I had a bit of trouble initially getting the smoke particles to interact with the air fields. I solved this by using the 'Dynamic Relationships Editor' to link the air field to the three nParticle shapes.


The result was working wind, the above video shows the current implementation but I've yet to properly set the attributes. Here the wind speed is exaggerated just for demonstration. I want to address the issue that the boundary of the air field is quite sudden, adding a drop-off in intensity should solve this.

Next was to set a "wind constant" which would be the wind speed while the "Master" storm control slider was set at 100%. 

Now that I've got a working wind gust mechanic, the next step is to link that into the controller interface. To do this I will take the wind speed and acceleration values at each frame and pass them through an multiplier which determines what the actual wind speed should be depending on the setting of the master controller.

This will allow for the user to view the change in wind speed in real time, however wind gusts may not react smoothly until this code is implemented and tested. 

Interface - Connecting Attributes 2

I decided to make the gas vent's height and strength controllable via the interface tool. The reason for this being that not only is the storm a hostile part of the planet, but that the gas vents can also play a part in the narrative of the environment.

As the user may want to control these elements, I added sliders for height and strength. The particle emitters themselves don't have these attributes so I played around with the attributes they do have in order to find something to connect my controllers to.

The vent height attribute is keyed to the gravity of the particle nucleus. This at first does sound wrong but it does achieve the desired effect I wanted. By reducing the gravity the particles rise further which is the desired effect. It does however alter the nature of the particles such as thinning them out but I am happy with the result for now.
The vent strength attribute should combat this as this attribute controls the spawn speed of the particles (which therefore thickens the stream out again). It also controls the radius of the particles.

On a side note, the maya command "connectControl" can only control one attribute at a time. So in order to control the same attribute on 3 objects, 1 attribute has to be set-up and connected to the 3 variables via set driven key.

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.