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.
Scripting and Dynamics
Coursework blog for Technical Art Applications (semester 1) and Scripting & Dynamics (semester 2).
Wednesday 29 April 2015
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
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.
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.
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.
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.
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.
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 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.
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.
Subscribe to:
Posts (Atom)