Posts

Showing posts with the label Scripting

Film Camera/Lens Emulation

Image
Something I have learnt whilst studying and working is the importance lens and film stock choice affects the overall look and feel of your image, and I think its really important to carry this over into fully digital work, or matching it to backplates. A big part of my learning more about this was my LensFX gizmo . I improved it a lot during the last few months of uni to get it to a place I was really happy with. Adding features to add lens dust and focus breathing. Below is a test I did in Arnold, playing with some displacement, trying to emulate the features/effects of a real lens with focus breathing. I added a focus pull, lens breathing, a lens flare, lens dust, filter flares and subtle glows. To make it feel more cinematic, I worked at 1920*800 widescreen resolution and created anamorphic style bokeh. I think it makes the image feel a lot more dynamic that if it was a simple focus pull, with no breathing or refocusing.  Best to watch this video in fullscreen at 1080p ...

Referencing Script

Image
I wrote this script a while ago whilst I was still at University. It was basically to help us reference assets into our shot files. Our structure was: Maya Project  -> Assets -> Props -> PROP NAME FOLDER -> PROP.ma So the script would read all .ma files in the "prop name folders" and give you a list of all the props in the folder, you could then select as many as you needed and reference them all in. Made the whole process a bit more simple, although Maya does have more advanced scene setup tools which would have been more effective in the long run, if we put the time into learning them.

Lens Effects Gizmo + Goals

Image
As part of my ongoing compositing development for Big Top and Dino Diner I have compacted the lens effects node tree I made before Christmas into a Gizmo. The fundamentals of each different lens effect come from this tutorial  which I have modified, below I've got a screenshot of it being used for a character AOV test in The Big Top. The effects the gizmo is currently capable of are: - Depth Of Field - Vignette - Filter Flare - Lens Distortion - Field Curvature (Edge defocus) - Lens Flares - Glow - Chromatic Abberation (Axial and Traversal) - Grain The user is able to work their way down the list of lens effects enabling or disabling them, and tweaking as they see fit. The aim being to allow people to more easily add real world lens effects to the perfect CG renders. This was roughly the node tree I started with, I ended up leaving out Astigmatism as I think the effect had to much of a dramatic impact o...

Efficient Shading

Image
Attribute controlled Shading In order to further my rendering and shading technical knowledge I have been exploring Primitive Variables (Renderman) and UserData (Arnold) attributes in order to set up more efficient Maya scene files. The goal here is to cut down on the number of shaders used in a scene by having only one across multiple objects, but still having variation via custom attributes on each objects shape node. A very basic example: you have 3 spheres, a red, a green and a blue. In a simple setup each might have its own shader, with it's specific colours.  However using PrimVars, you can have one shader for the spheres, and each sphere would contain an attribute with its own colour value. At render the shader gets the colour value from each object, and produces exactly the same result, but all from one shader. Learn more about UserData here This is gonna solve optimization problems on Dino Diner, where we may have 10 tables in a scene, eac...

Game Of Life Render

Image
Having completed my game of life script I wanted to get a nice render of it, which I've finally gotten around too. I wanted to make a grid of marbles, each different colours, however having around 2000 in total in the scene that was not gonna happen by assigning them manually. After a lot of trial and error I found a way to get what I wanted. First I created a procedural texture of squares, each different colours from the 6 base colours I chose. I then positioned this under the spheres. I gave every sphere a completely see through glass material, and disabled primary viability of the plane. This meant the refracted colour of the plane could be seen in the marbles but not the marbles themselves. I think this worked pretty well, definitely more efficient than  assigning  all the objects a material.

Conway's Game Of Life (FINISHED!)

Image
It finally happened! Definable number of lives, can easily scale or shrink and the edges are fully wrapped around. Here I've got a grid of 14*14, looping 100 times, which is why it cuts off towards the end. After thinking through and working out on paper how to wrap the edges, the easiest way I found was to create a buffer edge around the matrix, which is never displayed in 3D, and copy values from the edge of the 3D matrix into the buffer, this allowed all the code I had written before to still work, and I just had to work in the new parts to get it wrapping round. So happy with the result! I want to work now on rendering it nicely, changing the cubes for something else perhaps, and getting something lit and rendered to have a nice version to show, coding wise in future I may look into creating starting cubes, to define certain patterns that will create specific results, such as this from the wiki page.

Conway's Game Of Life V1

Image
After several different attempts here is my first working Game of Life running in Maya, scripted in MEL! I'm so pleased that I finally got it working! All the rules are working properly, the size of the grid can be changed easily, as well as the number of lives. I wont call it 100% finished quite yet as at the moment the edges and corners are not included, for the moment they are stationary but I would like to get it finished off by looping the sides around. The whole thing involved a crazy amount of problem solving and thinking around different issues,  I went through several iterations,  optimizing and  cutting it down, or improving parts of it, before I got to this stage.

Offset Group Script Update

Image
After thinking more about my offset group script I have updated it to be more useful by being able to select several objects and group them individually. For example selecting 3 controls and giving them each their own offset group. This will make the script a little easier to use, and more reliable. Thinking and then coming back to scripts is useful, I'm always keen to find little ways to improve them. I can provide copies of these scripts if anyone is interested, just drop a comment.

X-Wing Rig + Offset Group Script

Image
Over the past few days I have started, and completed, my X-Wing rig, it was really helpful for getting back into rigging properly. I ran into a few problems rigging R2-D2 when aligning controls with bones, which I remembered the proper workflow this time around. Overall it was fairly simple, it just took a few iterations in order to get it working how I wanted it to. One helpful little script I wrote along the way was a single button to quickly make offset groups of objects, select one object, eg "pCube1" press the button and it is grouped under "pCube1_GRP" This has already saved me so much time in creating groups and renaming them, and was much quicker script to write than a full renaming tool.

MEL Constraint + Playblast Tools

Image
This week I have been trying to keep on top of making progress in MEL. I have gone back and made some improvements to my constraining tool, adding the aim constraint. And I created a tool to more easily playblast work. Most of the new progress I made was with creating window UI, I found a better way to create windows, having them within strings, and was shown by more lecturer a more reliable way to delete any existing copies when creating a new one. Here are the additions I made to the  constraining tool : (previous version here) I have also converted this over to the string way of creating windows. Here is my new playblast tool: I noticed every time I playblast work I turn on and off the nurbs curves. So to speed up that process this turns them off, playblasts the window, and turns them back on. This will save time not having to navigate menus.   If I find I need it, I can give the tool more controls for quality...

Renderman Conversion Script

Image
I have gradually been building up my material converter script, I have re-written lots of it over the past week, changing elements and making it work better. In it's current state it detects the type of material and assigns a similar type of Renderman Material, currently this only works for lambert and blinn, so I need to add some 'else' statements to include the other types of material. I also added, and then removed connecting transparency, because Renderman doesn't have it in the same way Mental ray does, I did try plugging the transparency into Rendermans presence, but this was not reliable depending on how the mental ray material was set up. I have also added in the ability to copy over diffuse colour values to materials without textures, so it is more of a complete conversion. It needs more work, but it is coming along nicely.

MEL Progress

Image
As part of Modeling and Rigging I have been able to talk a lot to my lecturer about scripting in MEL. Now I have more direction with it I feel like I'm making more progress. Currently for Live Brief project we are setting up a scene for rendering in Mental Ray, but if we have time we would like to render in Renderman, although this means the 20+ materials would need to be converted, have the textures re-applied etc; so I am working on a script to help us do this quickly in one go.  So far I have it working to convert the materials to a new set of Mental Ray materials, and apply them to the appropriate objects, I'll convert this over to Renderman when I get to the studio. Currently if it comes across a material with transparency or alpha data plugged in it skips it, I would like to build in a function to plug this in, as well as the colour data. If I can get the script fully working in this way it might serve as a useful tool to convert over any...

MEL for Rigging

Image
This weeks modeling and rigging session was focused on using MEL. Having used some before I did have a starting point but I learnt how to get around some problems I had before. Mainly by avoiding having specific names in more complicated commands, by adding the ".translate" onto the end of variables. We also learnt how to add selections to variables, and it helped me understand how Maya sees scripts that you have open and running in the program. This is just a simple script that connects the translate, scale and rotate values of a first selected object, to a second selected object. It's somewhat useful but could be improved upon to give it more options, but it is a good example of little quick scripts that will come in handy for rigging. When I'm doing rigs in future I will look for opportunities  to practice writing little scripts, even if it takes me longer to begin with, the more practice I get the quicker I will get at wri...

Live Brief Project

Image
This semester we are working on another group project. Using audio clips from the BBC's listening project. The group I am in all like working in 3D or after effects, so I think we could produce a really good looking result by the end of the project. We have chosen an audio clip to work from which is of a man talking to his daughter about the Piper Alpha oil accident. Out idea for the animation to go along with this clip involves 3D typography. Above is some of the testing work I have put in to the project. We are still working to pick a style but I think a full 3D model will be the way forward, rather than the 2D style I tested. Alongside these animation tests I have been working on a script to streamline text creation in Maya. The default tool gives you a lot of control over the font, but becomes a hassle to use over and over, I am hoping to make it a quicker process to add text to our Maya scene when it comes to that time. I am hoping for th...

Programming in MEL

One of my decisions at the end of last term was to really get going with programming. It was something I wanted to look into last year, and I did but I reached a point with Python where I didn't have any direction and it tailed off. After an inspiring lecture on the history and future of computing and how programming has developed I decided to take a look at MEL (Maya Embedded Language) This talks directly to Maya and the nice thing about it is that all actions in Maya are listed in the script editor, so you can look at what Maya is doing in MEL commands at any time. Python also can talk to Maya but with MEL I felt like I had a lot more drive, I have also been able to integrate it into projects at University. What I have been working on so far was building base knowledge of the common commands using online tutorials, now I've got a big old book from the biliary to work through some more interesting scripts. I will post some o...