Posts

Showing posts from August, 2023

Scripting for Animation and VFX: Week 4

Image
 Scripting for Animation and VFX: Week 4 Functions and Creating Spheres  For this weeks assignment we were working with functions using python in maya. The given code to work with and expand created randomly placed spheres and curves that connected them.  Breaking down the given code: import random import maya.cmds as cmds def create_random_sphere():     # Generate random position     x = random.uniform(-100, 100)     y = random.uniform(-100, 100)     z = random.uniform(-100, 100)     # Create sphere     sphere = cmds.polySphere() [0]     # Move sphere to random position     cmds.move(x, y, z, sphere)     return sphere def create_pipe(start, end):     # Create a pipe between two objects     curve = cmds.curve(degree=1, point=[cmds.xform(start, query=True, translation=True), cmds.xform(end, query=True, translat...

Scripting for Animation and VFX: Week3

Image
 Scripting for Animation and VFX: Week3 Golden Angle In geometry the golden angle is the smaller angle of two angles created by dividing the circumference of a circle using the golden ratio. The golden angle is a pattern that appears in nature. One example being the pattern that sunflower seeds form. The seeds grow in lines in a spiral formation. The amount each seed turns allows there to be no gaps in the pattern. The pattern uses the golden ratio for each turn. The golden ratio is an irrational number, a number that cannot be written as a simple fraction. Using a fraction would mean the lines would eventually stack up making gaps in the pattern.  Golden Angle Maya Script For this week we were given a script to experiment with. This script creates spheres that follow the golden angle pattern.  The script: import maya.cmds as cmds import math for i in range (0,2000):     obj = cmds.polySphere()     goldenAngle = i * math.radians(137.51) ...

Scripting For Animation and VFX: Week 2

Image
 Scripting for Animation and VFX: Week 2 Expressions     In order to improve writing expressions, I will work on small projects to solve small problems with expressions and work up to solving larger problems and combining simple expressions in order to make more complicated ones. DAG and DG    DAG stands for Direct Acyclic Graphs and DG stands for Dependency Graphs.  DAG: Directed Acyclic Graphs are directed graphs that do not have directed cycles. Directed graphs are made up of vertices and edges, each edge is directed from one to another.  In DAG graphs the edges will never form a loop. Direct Acyclic Graphs are topologically ordered. The paths in the graph are linear.  Maya uses DAG graphs when parenting objects. The child of a parent object can not also be the parent. So parenting can not form loops.  DG; Dependency Graphs are directed graphs graphs that represent the dependency of objects towards each other.  Dependency graphs ...