top of page

HELLO WORD

Screen Shot 2018-11-01 at 22.00.31.png
il_fullxfull.752979733_qnxv.jpg

FUN FACT: for Python script:  tipe  import this in the interpreter.

Python

FLAG ARGUMENTS AND PYTHON CORE OBJECT TYPES

As you have seen, most Maya Python commands have flags, which allow you to change the default settings of the command being executed. Each flag argument must be passed a value. A flag’s value can be one of several different built-in Python types. Table 1.1 lists Python’s core object types that are used by Maya commands.

Note that Table 1.1 is not a complete list of Python core object types—there are many others that you may use for other purposes in your scripts.

Screen Shot 2019-01-05 at 23.48.21.png

Numbers

Maya commands expecting Python numbers will accept any real number. Examples could include integer as well as decimal numbers, which corre- spond to int/long and float/double types, respectively, in other languages.

Strings

The string type is any sequence of letters or numbers enclosed in single quota- tion marks, double quotation marks, or a matching pair of triple quotation marks of either type. For instance, “boat”, “house”, and “car” are equivalent to ‘boat’, ‘house’, and ‘car’ as well as to “““boat”””, “““house”””, and“““car”””. However, the string “3” is different from the number object 3. Strings are typically used to name objects or parameters that are accessible from the Maya user interface.

Lists

A list is a sequence of any number of Python objects contained within the bracket characters [ and ]. A comma separates each object in the list. Any Python object may be in a list, including another list!

Tuples

The Python tuple is very similar to the list type except that it is not muta- ble, which means it cannot be changed. We discuss mutability in greater detail in Chapter 2. Tuples are contained inside of ordinary parentheses,( and ).

Booleans

A Boolean value in Python can be the word True or False (which must have the first letter capitalized), or the numbers 1 and 0 (which correspond to the values True and False, respectively). These values are typically used to represent states or toggle certain command modes or flags.

HUMAN EYES

Screen Shot 2018-12-27 at 20.33.11.png

 

 

RODS AND CONES

 

■Cones are located in the fovea and are sensitive to color.

●Each one is connected to its own nerve end.
●Cone vision is called photopic (or bright-light vision).

■Rods give a general, overall picture of the field of view and are not involved in color vision.

●Several rods are connected to a single nerve and are

●Sensitive to low levels of illumination (scotopic or dim- light vision).

RGB and luminance

To form a color with RGB, three light beams (one red, one green, and one blue) must be superimposed (for example by emission from a black screen or by reflection from a white screen). Each of the three beams is called a component of that color, and each of them can have an arbitrary intensity, from fully off to fully on, in the mixture.

The RGB color model is additive in the sense that the three light beams are added together, and their light spectra add, wavelength for wavelength, to make the final color's spectrum.[1][2]This is essentially opposite to the subtractive color model that applies to paints, inks, dyes, and other substances whose color depends on reflecting the light under which we see them. Because of properties, these three colours create white, this is in stark contrast to physical colours, such as dyes which create black when mixed.

Zero intensity for each component gives the darkest color (no light, considered the black), and full intensity of each gives a white; the quality of this white depends on the nature of the primary light sources, but if they are properly balanced, the result is a neutral white matching the system's white point. When the intensities for all the components are the same, the result is a shade of gray, darker or lighter depending on the intensity. When the intensities are different, the result is a colorized hue, more or less saturated depending on the difference of the strongest and weakest of the intensities of the primary colors employed.

Screen Shot 2018-12-27 at 20.08.44.png
Screen Shot 2018-12-27 at 20.07.44.png

A set of primary colors, such as the sRGB primaries, define a color triangle; only colors within this triangle can be reproduced by mixing the primary colors. Colors outside the color triangle are therefore shown here as gray. The primaries and the D65 white point of sRGB are shown.

Screen Shot 2018-12-27 at 20.38.58.png
TIP:
Screen Shot 2018-12-27 at 20.45.05.png

PIXEL/S

COLOUR TURTLE

Screen Shot 2018-12-26 at 21.11.35.png
Screen Shot 2018-12-26 at 21.24.53.png
Screen Shot 2018-12-26 at 21.09.18.png
Screen Shot 2018-12-26 at 21.06.53.png
Screen Shot 2018-12-26 at 21.24.45.png
Screen Shot 2018-12-26 at 21.11.43.png
Screen Shot 2018-12-26 at 21.11.20.png

COLOUR WHEELS

We can play with different options like changing the scale: it is scale 2 and scale 6 left to right:

Screen Shot 2018-12-26 at 22.08.20.png
Screen Shot 2018-12-26 at 22.04.44.png
Screen Shot 2018-12-26 at 22.04.12.png
Screen Shot 2018-12-26 at 22.15.18.png

Or we can play with colours swell, as you can see in the script we have a list of colours [red, yellow, blue, etc] the order in list is red =0, yellow = 1, blue =2, counting begin from 0

Screen Shot 2018-12-26 at 22.28.36.png

Dynamic range

Dynamic range refers to the total amount of light being captured in a given scene. If you are taking a picture with a lot of bright parts full of light in addition to a lot of dark parts shrouded in shadow, the scene could be described as having a great deal of dynamic range (high contrast). If, however, the scene is lit in such a way that it is neither too bright nor too dark it could be said to have a low dynamic range (low contrast).

We can interpret dynamic range as the measurement between the whitest whites and the blackest blacks in an image, or the lowest and highest values of density and luminance.

Screen Shot 2018-12-03 at 13.25.17.png
Screen Shot 2018-12-03 at 12.06.49.png

More Python

Screen Shot 2019-01-05 at 22.40.47.png
Screen Shot 2019-01-05 at 22.41.22.png

Color bit depth

WHAT IS 10-BIT COLOR?

Bit depth refers to the overall number of levels of red, green, or blue that the camera records. Eight bits means there are 256 levels (zero to 255) of each color, or roughly 16.8 million combinations in total. Now, 16.8 million sounds like a lot, but one common situation where you can notice the drawback of 8-bit color is in areas of light falloff from bright to dark, which may show up as disparate bands of shading rather than a smooth gradient.

Bumping up to 10 bits multiplies the levels of color by four. That’s 1,024 available values for green, red, and blue, or a whopping one billion total combinations. As Hammond explains, however, you may not notice the difference: Your monitor likely only supports eight-bit color, as does your TV, as does YouTube. (Higher-end, professional monitors can show more colors).

Screen Shot 2019-01-05 at 22.48.49.png
Screen Shot 2019-01-05 at 22.48.41.png
Screen Shot 2019-01-05 at 22.46.00.png
Screen Shot 2019-01-05 at 22.46.14.png

What is chroma subsampling?

Our eyes are more sensitive to brightness than color

Images are made up of pixels, and each pixel contains two types of information: luminance or luma, which is brightness, and chrominance or chroma, which is color. Because our eyes are less sensitive to color detail than to brightness detail, chroma subsampling is used to reduce the amount of data in a video signal while having little or no visible impact on image quality.

Video created with chroma subsampling still includes brightness information for every single pixel, but not color information. Color information is shared among adjacent pixels. The number of pixels that share the same color information is determined by the type of chroma subsampling. To describe the extent of subsampling, video professionals use a numerical shorthand in the form of a ratio that references a block of 8 pixels, 4 across and 2 high.

This ratio has three numbers separated by colons. The first number indicates the number of pixels wide the sample is (usually 4). The second number tells you how many of the pixels in the top row will have color information, that is, chroma samples. And the third number tells you how many pixels in the bottom row will have chroma samples.

 

 

 

 

 

 

 

4:4:4 — in this case, every pixel gets a chroma sample so there is no subsampling happening. This is uncompressed color.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4:2:2 — here, every two pixels in the top row have to share a chroma sample, and every two pixels in the bottom row have to share a chroma sample, which means that 50% of the color information is being thrown out.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4:2:0 is more aggressive subsampling where again every two pixels in the top row share a chroma sample, but in this case, the bottom row has no color information of its own, and has to share the chroma samples of the top row. 75% of the original color information is discarded. That sounds like a lot, but 4:2:0 can still provide a great picture. It is part of the spec for both Blu-ray and the upcoming Ultra HD Blu-ray format.

 

Screen Shot 2018-12-03 at 12.59.09.png
Screen Shot 2018-12-03 at 12.58.31.png
Screen Shot 2018-12-03 at 12.58.57.png

ANOTHER FUN FACT

Did you know that the first digital camera invented in 1975 didn’t actually produce the first digital photograph? The first digital photo actually came almost two decades earlier in 1957 when Russell Kirsch made a 176×176 pixel digital image by scanning a photograph of his three-month-old son. The low resolution was due to the fact that the computer they used wasn’t capable of storing more information. 

In 1957, Kirsch's group developed a digital image scanner, to “trace variations of intensity over the surfaces of photographs”, and made the first digital scans. One of the first photographs scanned, a picture of Kirsch’s three-month-old son, was captured as just 30,976 pixels, a 176 × 176 array, in an area measuring 5 cm × 5 cm. The bit depth was only one bit per pixel, stark black and white with no intermediate shades of gray, but by combining several scans made using different scanning thresholds, grayscale information could also be acquired.[6] They used the computer to extract line drawings, count objects, recognize alphanumeric characters and produce oscilloscope displays.Kirsch also proposed the Kirsch operator for edge detection.

firstdigitalphoto.jpg
14220030.748502.6838.jpg

 01001000 01100101 01101100 01101100 01101111 00100001

Bits and Bytes

 

At the smallest scale in the computer, information is stored as bits and bytes. In this section, we'll learn how bits and bytes encode information.

Bit

  • a "bit" is atomic: the smallest unit of storage

  • A bit stores just a 0 or 1

  • "In the computer it's all 0's and 1's" ... bits

  • Anything with two separate states can store 1 bit

  • In a chip: electric charge = 0/1

  • In a hard drive: spots of North/South magnetism = 0/1

  • A bit is too small to be much use

  • Group 8 bits together to make 1 byte

Everything in a computer is 0's and 1's. The bit stores just a 0 or 1: it's the smallest building block of storage.

Byte

  • One byte = collection of 8 bits

  • e.g. 0 1 0 1 1 0 1 0

  • One byte can store one character, e.g. 'A' or 'x' or '$'

How Many Patterns With N Bits?

How many different patterns can be made with 1, 2, or 3 bits?

Number of bitsDifferent Patterns

1 BIT -  0 1

2 BITS - 00 01 10 11

3 BITS - 000 001 010 011 
               100 101 110 111

 

OR THAT MEANS ALL AVAILABLE COMINATIONS BETWEEN 0 AND 1FOR NUMBER OF BITS!!!
 

  • 3 bits vs. 2 bits

  • Consider just the leftmost bit

  • It can only be 0 or 1

  • Leftmost bit is 0, then append 2-bit patterns

  • Leftmost bit is 1, then append 2-bit patterns again

  • 3-bits has twice as many patterns as 2-bits

Screen Shot 2018-12-02 at 17.41.40.png
  • In general: add 1 bit, double the number of patterns

  • 1 bit - 2 patterns

  • 2 bits - 4 

  • 3 bits - 8

  • 4 bits - 16

  • 5 bits - 32

  • 6 bits - 64

  • 7 bits - 128

  • 8 bits - 256 - one byte

  • Mathematically: n bits yields 2n patterns (2 to the nth power)

One Byte - 256 Patterns

  • 1 byte is group of 8 bits

  • 8 bits can make 256 different patterns

  • How to use the 256 patterns?

  • How to store a number in a byte?

  • Start with 0, go up, one pattern per number, until run out of patterns

  • 0, 1, 2, 3, 4, 5, ... 254, 255

  • One byte can hold a number between 0 and 255

  • i.e. with 256 different patterns, we can store a number in the range 0..255

  • Really good for storing characters/letters.

Bytes

  • "Byte" - unit of information storage

  • A document, an image, a movie .. how many bytes?

  • 1 byte is enough to hold about 1 typed character, e.g. 'b' or 'X' or '$'

  • All storage is measured in bytes, despite being very different hardware

  • Kilobyte, KB, about 1 thousand bytes

  • Megabyte, MB, about 1 million bytes

  • Gigabyte, GB, about 1 billion bytes

  • Terabyte, TB, about 1 trillion bytes (rare)

Bytes and Characters - ASCII Code

  • ASCII is an encoding representing each typed character by a number

  • Each number is stored in one byte (so the number is in 0..255)

  • A is 65

  • B is 66

  • a is 96

  • space is 32

  • "Unicode" is an encoding for mandarin, greek, arabic, etc. languages, typically 2-bytes per "character"

Screen Shot 2018-12-02 at 18.13.03.png

Typing, Bytes, and You

  • Each letter is stored in a byte, as on the picture rightmost

  • 100 typed letters takes up 100 bytes

  • When you send, say, a text message, the numbers are sent

  • Text is quite compact, using few bytes, compared to images etc.

Screen Shot 2018-12-02 at 18.21.17.png

The largest number you can represent with 8 bits is 11111111, or 255 in decimal notation. Since 00000000 is the smallest, you can represent 256 things with a byte. (Remember, a bite is just a pattern. It can represent a letter or a shade of green.)

There are 28 (256) different possible values for 8 bits. When unsigned, it has possible values ranging from 0 to 255!!!

BRIDGE 

MAYA CREATE STAIRS

Python scripting can be used for many tasks in Maya, from running simple commands to developing plug-ins, and several different Maya-related libraries are available targeting different tasks.

Maya Python module

The Python bindings for all of the native Maya commands are in the maya.cmds module. In order to access these commands, you must enter the following in the Python tab of the Script editor in each session: 

This allows you to use Maya commands. For example: 

You can import Maya commands to a different and shorter namespace:

 

 

 

 

 

Tip: You can import maya.cmds automatically in the userSetup.py file. You can modify this to use your preferred prefix; for example: 

import maya.cmds as mc

mc.sphere()

Screen Shot 2018-12-27 at 21.06.25.png
Screen Shot 2018-12-27 at 21.06.19.png
Screen Shot 2018-12-27 at 21.06.12.png
Screen Shot 2018-12-27 at 20.59.31.png
Screen Shot 2018-12-27 at 21.00.00.png
Screen Shot 2018-11-22 at 14.32.01.png
Screen Shot 2018-11-22 at 14.32.21.png
TIP:

l = [ "Hello", "World", "This", "is", "a", "List" ]

t = ( "Hello", "World", "This", "is", "a", "List" )

MAYA ARNOLD

Screen Shot 2019-01-05 at 22.26.26.png
Screen Shot 2019-01-05 at 22.25.43.png
Screen Shot 2019-01-05 at 22.25.38.png
Screen Shot 2019-01-05 at 22.26.01.png
Screen Shot 2019-01-05 at 22.25.56.png

ALphA CHANNEL

Screen Shot 2018-12-27 at 21.37.47.png

In graphics, a portion of each pixel's data that is reserved for transparency information. 32-bit graphics systems contain four channels — three 8-bit channels for red, green, and blue (RGB) and one 8-bit alpha channel. The alpha channel is really a mask. It specifies how the pixel's colors should be merged with another pixel when the two are overlaid, one on top of the other.

Typically, you wouldn't define the alpha channel on a pixel-by-pixel basis, but rather per object. Different parts of the object would have different levels of transparency depending on how much you wanted the background to show through. This allows you to create rectangular objects that appear as if they are irregular in shape — you define the rectangular edges as transparent so that the background shows through. This is especially important for animation, where the background changes from one frame to the next.

Rail challenge

import maya.cmds as mc

 

rail_r = 0.5

rail_h = 15

 

 

for i in range( 3 ):

    mc.polyCylinder( r=0.5, h=15, n="rail1" )

    mc.move( 0, i*0, i*20 )

    

 

for i in range( 1 ):

    mc.polyCylinder( r=rail_r, h=rail_h, n="rail2" )

    mc.rotate( 90, 0,10)

    mc.move(0,0,20)

    mc.scale (1,2.65,1)

    

mc.duplicate()

mc.move (0,7,20)

 

 

for i in range(3):

    mc.polySphere(r=1,n="ball1")

    mc.move( 0, 0, i*20)

    

for i in range(3):

    mc.polySphere(r=1,n="ball1")

    mc.move( 0, 8, i*20)

Screen Shot 2018-11-22 at 13.26.36.png
Screen Shot 2018-11-22 at 13.20.44.png
Screen Shot 2018-11-22 at 13.31.06.png
Screen Shot 2018-11-22 at 13.35.28.png
Screen Shot 2018-11-22 at 13.37.53.png
Screen Shot 2018-11-22 at 13.40.26.png

And all together ... thats it :)

alfa.png

Challenge

KILL as many vampires as you can before you die!!!

Actually ...yeah good idea but NOT in this challenge. This one should be much more easier (is it?!)

to multiplay a single blade on Fig 1 and spread the copies around!

Why we need to kill vampires BTW?!

Screen Shot 2018-11-22 at 14.05.01.png
Screen Shot 2018-11-22 at 14.05.07.png
alfa 2.png

Fig 1

Screen Shot 2018-11-22 at 14.09.19.png
Screen Shot 2018-11-22 at 14.09.33.png

Something like...that

My first comp

i_Z234_BIKER_223.1001.jpg
a_img00585.jpg
Screen Shot 2019-01-05 at 23.05.26.png
Screen Shot 2019-01-05 at 23.05.33.png
bottom of page