SlideShare a Scribd company logo
Understanding Maths and Programming
for
CG Artists
BY
M KEDARNATH
M_kedar_nath@yahoo.com
Programming and scripting
Maths
CG requirements
Connecting the above
Note :
The syntax used in this notes may not be accurate and directly usable. To write script
please refer to help file of the software. Also here I am not concentrating on any
programming or scripting language like MEL, Python, VEX (Houdini), Lua etc but focusing on
the base of it.
I am not a professional programmer so there can be better or optimized way of doing
the tasks which I have done in this notes. This is mainly to understanding how to connect
Maths and programming to create what we want in CG. Also once we understand the
concepts then it is almost same in different scripting/ programming languages except the
syntax.
Programming and scripting
• Frame work
• Pipeline programming
• Understanding software scripting language and SDK
• Automation
◦ Script to add render layers
◦ Script to adjust cloth sim
• Expanding the capability of the software
◦ Creating plugins
• Creating new CG software
Maths
• simple mathematics equation
◦ Trigonometry
• 3D geometry
• Dynamics
CG Requirements
• Lookdev/Shading
• Lighting
• CHF
• Assets etc
Connecting all above
• Understanding equation of a shader
• Understanding an equation of rendering and render a sphere color
Few terminologies to understand
Design – what you are going to do is called Design of a software
Architecture – Is a design which tells us how we are going to connect the different parts of
the program.
Framework – A programming framework is a structure (or implementation of the
Architecture) which defines or makes the software development part easier and faster.
API – Application programming interface – is a set of functionalities or classes which can be
used to extend the capabilities of the software.
SDK – software development kit is a set of tools used to develop applications.
Understanding programming for Artists
Pipeline programming
Pipeline programming can be anything from folder creation to automatic data transfer to
software integration using single desktop application.
WIP
Few free pipeline tools available -
Prism -
There is a free animation pipeline to combine all tools - Prism manages your complete
workflow from the initial project setup to managing scenefiles to comparing renderings and
composit them to create the final images.
Prism includes many different features to automate your workflow
https://prism-pipeline.com/
Flamenco -
It is a free and opensource render farm management sotware
https://www.flamenco.io/
CGRU
Free and open source CG tool pack
http://cgru.info/
Automation/software workflow
We can do different types of automation using scripting. In any production software like
Maya, Nuke, Houdini, Mari etc., we can create own shelf and call different scripts from
different departments.
• We can create different types of scripts/Procedures to do procedural modeling.
• Automate the process of exporting the data and saving with standard naming
structure and folder structure.
• Nuke
◦ We can create own write nodes with shot specific folder structure included by
default.
◦ Create a script to automate the compositing template.
◦ Etc
• Maya
◦ Create a script with all the render settings put in one UI.
◦ Setting for different render types like preview/high quality, through which control
the texture size, AOVs to render, LOD of model etc.
Scripting And Programming
Scripting doesn't require an explicit compilation step. As an example MEL or Python in
Maya doesnt need any specific compilation before running. We can directly run that inside
Maya. But while creating plugins in C++, we need to compile the program as .mll file and load
through plugin manager.
Lets understand to combine math formulas with programming to get the output.
WIP
Trigonometry –
Trigonometry is a branch of mathematics which deals with angles and the angular
relationships of planar and 3D figures.
Value of sin(theta) – ranges from -1 to 1 based on the angle.
If we need to increase the frequency then we need to use
sin(a * theta) (where a is a constant).
Similarly if we need to increase the value from 1 then we need to use
a * sin(theta) (where a is a constant)
Value of cos(theta) – similarly value of cos(theta) is also ranges from -1 to 1 based on angle
We can use same multiplication as sin(theta) to increase the feequency.
Lets use these above formula to create some animation using expressions in Maya.
pSphere1.translateX = sin(frame) ( frame number can be used as theta)
pSphere1.translateX = sin(frame/5) (to make the animation 5 times slower)
pSphere1.translateX = 5* sin(frame) (to move the sphere to 5 times distance)
We can combine sin and cos values in translateX and translateY to animation the sphere in
circular direction.
Use the below expressions in translateX and translateY to move the sphere in circular (x,y)
direction.
pSphere1.translateX = 5*(sin(frame/15))
pSphere1.translatey = 5*(cos(frame/15))
If we want to move the object in constant value then we can use “frame” without any
trigonometric functions.
Use the below expression in translateZ along with above X and y to move the sphere in
circular direction and towards z, like spring.
pSphere1.translateZ = frame/10
The same way trigonometry can be used to create spheres and place them in a circular path.
Here we defined the number of spheres within 360 degrees and place them in equal distance.
Also if we need to create spring type of formation then we can use z value which is
incremental. Either we can use $i or we cab define any new number and do the increment in
the loop.
//
int $theta, $i;
int $number = 20;
int $step = 360/$number;
for ($i==0; $i<$number; $i++)
{
int $theta = $i*$step;
float $x = 5*sin(deg_to_rad($theta));
float $y = 5*cos(deg_to_rad($theta));
polySphere;
move $x $y 0;
}
//
To understand the values we can directly write the functions and get the value. Based on the
formulas we can write our own scripts to create what ever we want.
sin(deg_to_rad(90)); //which will give us value 1 as output.
Similarly we can try using other functions in our scripts and expressions.
Matrices
Matrices is a collection of numbers arranged in rows and columns ,
A matrix of m rows and n columns is called a m x n matrix (m by n), where m and n are
matrix dimensions.
In CG what can be defined in a matrix –
• A color is 1 x 3 matrix
• Translate or rotation or scale are 1 x 3 matrix ( we can use these in our
scripting or expressions.
• In CG usually the whole transformation defined in 4 x 4 matrix.
WIP
Vector Mathematics
A vector represents a quantity that has both magnitude and direction.
Below is the example of setting color value using vector.
vector $col = << 1, 0, 0>>;
setAttr "lambert2.color" ($col.x) ($col.y) ($col.z);
WIP

More Related Content

What's hot

C++vs java
C++vs javaC++vs java
C++vs java
Pradeep wolf king
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
Martin Odersky
 
Oop2011 actor presentation_stal
Oop2011 actor presentation_stalOop2011 actor presentation_stal
Oop2011 actor presentation_stal
Michael Stal
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
Salahaddin University-Erbil
 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
BlackRabbitCoder
 
C++ to java
C++ to javaC++ to java
C++ to java
Ajmal Ak
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Rahul Jain
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
Sagar Pednekar
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
Diksha Bhargava
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Mohammad Hossein Rimaz
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
Martin Odersky
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
Martin Odersky
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
Martin Odersky
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
Michael Heron
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
Ranel Padon
 
Java Building Blocks
Java Building BlocksJava Building Blocks
Java Building Blocks
Cate Huston
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
Object Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part IObject Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part I
Ajit Nayak
 

What's hot (18)

C++vs java
C++vs javaC++vs java
C++vs java
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Oop2011 actor presentation_stal
Oop2011 actor presentation_stalOop2011 actor presentation_stal
Oop2011 actor presentation_stal
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
 
Java Building Blocks
Java Building BlocksJava Building Blocks
Java Building Blocks
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
 
Object Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part IObject Oriented Programming using C++ Part I
Object Oriented Programming using C++ Part I
 

Similar to Maths&programming forartists wip

PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
jaymaraltamera
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegro
snowfarthing
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
Vikram Nandini
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
Waqar Younis
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
vrickens
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
Rohit Shrivastava
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
CESAR A. RUIZ C
 
Short Talk on Graphiti at EclipseCon 2010
Short Talk on Graphiti at EclipseCon 2010Short Talk on Graphiti at EclipseCon 2010
Short Talk on Graphiti at EclipseCon 2010
michaelwenz
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
💻 Anton Gerdelan
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Spark
datamantra
 
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
MLconf
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
Franciny Salles
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
Getachew Ganfur
 
A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny Apps
Daniel Koller
 
CS267_Graph_Lab
CS267_Graph_LabCS267_Graph_Lab
CS267_Graph_Lab
JaideepKatkar
 
Learn C Programming Full Course Free
Learn C Programming Full Course FreeLearn C Programming Full Course Free
Learn C Programming Full Course Free
Dheeraj Patidar
 
C tutorials
C tutorialsC tutorials
C tutorials
Amit Kapoor
 
Project two c++ tutorial
Project two c++ tutorialProject two c++ tutorial
Project two c++ tutorial
Babatunde Salaam
 

Similar to Maths&programming forartists wip (20)

PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegro
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
 
Short Talk on Graphiti at EclipseCon 2010
Short Talk on Graphiti at EclipseCon 2010Short Talk on Graphiti at EclipseCon 2010
Short Talk on Graphiti at EclipseCon 2010
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Spark
 
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
 
A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny Apps
 
CS267_Graph_Lab
CS267_Graph_LabCS267_Graph_Lab
CS267_Graph_Lab
 
Learn C Programming Full Course Free
Learn C Programming Full Course FreeLearn C Programming Full Course Free
Learn C Programming Full Course Free
 
C tutorials
C tutorialsC tutorials
C tutorials
 
Project two c++ tutorial
Project two c++ tutorialProject two c++ tutorial
Project two c++ tutorial
 

Recently uploaded

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 

Recently uploaded (20)

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 

Maths&programming forartists wip

  • 1. Understanding Maths and Programming for CG Artists BY M KEDARNATH M_kedar_nath@yahoo.com
  • 2. Programming and scripting Maths CG requirements Connecting the above Note : The syntax used in this notes may not be accurate and directly usable. To write script please refer to help file of the software. Also here I am not concentrating on any programming or scripting language like MEL, Python, VEX (Houdini), Lua etc but focusing on the base of it. I am not a professional programmer so there can be better or optimized way of doing the tasks which I have done in this notes. This is mainly to understanding how to connect Maths and programming to create what we want in CG. Also once we understand the concepts then it is almost same in different scripting/ programming languages except the syntax.
  • 3. Programming and scripting • Frame work • Pipeline programming • Understanding software scripting language and SDK • Automation ◦ Script to add render layers ◦ Script to adjust cloth sim • Expanding the capability of the software ◦ Creating plugins • Creating new CG software Maths • simple mathematics equation ◦ Trigonometry • 3D geometry • Dynamics CG Requirements • Lookdev/Shading • Lighting • CHF • Assets etc Connecting all above • Understanding equation of a shader • Understanding an equation of rendering and render a sphere color
  • 4. Few terminologies to understand Design – what you are going to do is called Design of a software Architecture – Is a design which tells us how we are going to connect the different parts of the program. Framework – A programming framework is a structure (or implementation of the Architecture) which defines or makes the software development part easier and faster. API – Application programming interface – is a set of functionalities or classes which can be used to extend the capabilities of the software. SDK – software development kit is a set of tools used to develop applications. Understanding programming for Artists Pipeline programming Pipeline programming can be anything from folder creation to automatic data transfer to software integration using single desktop application. WIP Few free pipeline tools available - Prism - There is a free animation pipeline to combine all tools - Prism manages your complete workflow from the initial project setup to managing scenefiles to comparing renderings and composit them to create the final images. Prism includes many different features to automate your workflow https://prism-pipeline.com/ Flamenco - It is a free and opensource render farm management sotware
  • 5. https://www.flamenco.io/ CGRU Free and open source CG tool pack http://cgru.info/ Automation/software workflow We can do different types of automation using scripting. In any production software like Maya, Nuke, Houdini, Mari etc., we can create own shelf and call different scripts from different departments. • We can create different types of scripts/Procedures to do procedural modeling. • Automate the process of exporting the data and saving with standard naming structure and folder structure. • Nuke ◦ We can create own write nodes with shot specific folder structure included by default. ◦ Create a script to automate the compositing template. ◦ Etc • Maya ◦ Create a script with all the render settings put in one UI. ◦ Setting for different render types like preview/high quality, through which control the texture size, AOVs to render, LOD of model etc. Scripting And Programming Scripting doesn't require an explicit compilation step. As an example MEL or Python in Maya doesnt need any specific compilation before running. We can directly run that inside Maya. But while creating plugins in C++, we need to compile the program as .mll file and load through plugin manager. Lets understand to combine math formulas with programming to get the output. WIP
  • 6. Trigonometry – Trigonometry is a branch of mathematics which deals with angles and the angular relationships of planar and 3D figures. Value of sin(theta) – ranges from -1 to 1 based on the angle. If we need to increase the frequency then we need to use sin(a * theta) (where a is a constant). Similarly if we need to increase the value from 1 then we need to use a * sin(theta) (where a is a constant) Value of cos(theta) – similarly value of cos(theta) is also ranges from -1 to 1 based on angle We can use same multiplication as sin(theta) to increase the feequency.
  • 7. Lets use these above formula to create some animation using expressions in Maya. pSphere1.translateX = sin(frame) ( frame number can be used as theta) pSphere1.translateX = sin(frame/5) (to make the animation 5 times slower) pSphere1.translateX = 5* sin(frame) (to move the sphere to 5 times distance) We can combine sin and cos values in translateX and translateY to animation the sphere in circular direction. Use the below expressions in translateX and translateY to move the sphere in circular (x,y) direction. pSphere1.translateX = 5*(sin(frame/15)) pSphere1.translatey = 5*(cos(frame/15)) If we want to move the object in constant value then we can use “frame” without any trigonometric functions. Use the below expression in translateZ along with above X and y to move the sphere in circular direction and towards z, like spring. pSphere1.translateZ = frame/10 The same way trigonometry can be used to create spheres and place them in a circular path.
  • 8. Here we defined the number of spheres within 360 degrees and place them in equal distance. Also if we need to create spring type of formation then we can use z value which is incremental. Either we can use $i or we cab define any new number and do the increment in the loop. // int $theta, $i; int $number = 20; int $step = 360/$number; for ($i==0; $i<$number; $i++) { int $theta = $i*$step; float $x = 5*sin(deg_to_rad($theta)); float $y = 5*cos(deg_to_rad($theta)); polySphere; move $x $y 0; } // To understand the values we can directly write the functions and get the value. Based on the formulas we can write our own scripts to create what ever we want. sin(deg_to_rad(90)); //which will give us value 1 as output. Similarly we can try using other functions in our scripts and expressions.
  • 9. Matrices Matrices is a collection of numbers arranged in rows and columns , A matrix of m rows and n columns is called a m x n matrix (m by n), where m and n are matrix dimensions. In CG what can be defined in a matrix – • A color is 1 x 3 matrix • Translate or rotation or scale are 1 x 3 matrix ( we can use these in our scripting or expressions. • In CG usually the whole transformation defined in 4 x 4 matrix. WIP Vector Mathematics
  • 10. A vector represents a quantity that has both magnitude and direction. Below is the example of setting color value using vector. vector $col = << 1, 0, 0>>; setAttr "lambert2.color" ($col.x) ($col.y) ($col.z); WIP