Posts

Easy PIL install

https://stackoverflow.com/questions/8863917/importerror-no-module-named-pil At first install Pillow with pip install Pillow or as follows c : \Python35 > python - m pip install Pillow Then in python code you may call from PIL import Image

Rendering order and Z-sorting

Image
Rendering order and Z-sorting . In Unity, there are a couple of options using which we can control render order of the objects, two of them are 1. Render queue in shaders and 2. Painter's algorithm but eventually, what appears in front and what stays hidden is decided by Z-sorting/depth sorting. Here is the authoritative sequence of order of objects that will appear on the screen. Z-sorting/ Depth sorting is the final step to sort pixels based on the z-distance from the camera, but we can still turn ZWrite-off in the shaders (which in a way breaks Z-sorting). If we turn off ZWrite in all the shaders then render-queue will be in charge of deciding what comes in front and what goes in back If all shaders have ZWrite turned off and as well as they are on the same render-queue then the distance of their transform point from the camera will decide the render order. Eg : - ZWrite Off - Render Queue same - Painter's algorithm - ZWrite Off - Render Qu...

Run Python Script using Jenkins to add to SVN

Image
(Not a tutorial - I am keeping it just for my own reference) Step 1: Setting Jenkins Job and Python script. Step 2 : Setting permission on svn data cache. chmod -R a+rwx /Users/xxx/src/starts-art/.svn Step 3: Setting permission on repo files. chmod -R a+rwx /Users/xxx/src/starts-art/DatabaseBackup/backup

When normal is just a direction not a position then why position of mesh changes the normal map?

Image
When Normal is just a direction, not a position then why positioning of the object in the scene or transformation (translation, rotation, and scale) of the object matters while baking object-space or world-space normal map? As we know that Normal is a direction (and it is orthogonal to the face of the mesh). When we bake Normal-map as RGB image, we calculate its x, y, z values to represent a direction.  To calculate x, y, z of a normal-direction, we need a reference point such as when we calculate a position of a dot on graph paper, (0,0) is the reference point. Reference point we pick, may change the x, y, z value of a direction. Eg : If we have a pyramid and we are calculating Normal of a face. Object Space Normal Map : To write Object-space normal value, we will find out x,y,z value from a center of the mesh. x, y, z value of Normal direction will remain the same at any rotation of the mesh as when we rotate the mesh, center-of-mesh i.e. transformation-axis rota...

Beginner's guide to Shader Development using Unity

Image
-  Teachable.com     -  Cgcircuit.com What are we going to understand here? What is a shader? Types of shaders based on their functionality. Shader and their types : W hat is a shader ? When we ask a computer to perform any operation, we give an instruction to it, and a set of these instructions is called a  Program .  A program that is used or contributes to shade or draw something on the screen is called a  shader . Shader is a set of instructions that is run on  GPU — Graphics Processing Unit GPU:  A processing unit or circuit specially designed for faster and efficient computer graphics operation or image manipulation. If we quickly take a look at the comparison of GPU and CPU, GPU is also being used in deep-learning calculations. A CPU with four (or 8 or 10) cores in it A GPU with thousands of cores in it. Cores of CPU are designed for serial operations, whereas cores of GPU...

Hollywood vs Bollywood - Scene Comparison

Image
Here are some shot comparison of similar scenes from Bollywood movie "Mohan Jodaro" and TV-series "Game of Thrones" I always want to pin point things that Bollywood movies lack in quality that Hollywood movies and TV-series have. It begins with some simple math that when input is better, there is a good chance that output will be better as well. Hollywood movies have big budgets, they can have better production quality and they can invest more in things like visual effects. Their target audience is slightly different, which I believe is changing. People all over world watch Hollywood movies and TV-series like Game of thrones which raises their expectation from Bollywood movies as well (Indian TV-series are not even in comparison - they are just bull shit). Bollywood typical formula of Muscle show-off, shaking of head while delivering dialogue, jumps that break all physics rules, cat walks will soon come to an end, they will have to give more to their audience....

Auto formatting Python code

Install Visual Studio Code. Once installed, open visual studio code. press "command + p", a window will open at the top. Type : ext install python Open terminal and type following commands : pip install pep8 pip install --upgrade autopep8 pip install pylint  Start auto formatting python code

DirectX3d - Graphics Rendering Pipeline

Image
From :  http://user.xmission.com/~legalize/book/preview/poster/index.html Another Resource : http://www.realtimerendering.com/#rendpipe

Maths and Graphics are fun

Image
CG - Maths http://acko.net/files/fullfrontal/fullfrontal/wdcode/online.html WebGL / Rendering techniques http://acko.net/files/fullfrontal/fullfrontal/webglmath/online.html

Maya and Mac os using different version of SVN

While writing some tools for Maya to perform SVN operations, I found that they were erring out. To investigate the problem I ran a simple test in Mac Terminal and Maya. Mac terminal : $  svn --version Output :  svn, version 1.8.13 (r1667537) Maya  : import subprocess command = "svn --version" process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,           stderr=subprocess.PIPE, universal_newlines=True) out, err = process.communicate() print out,err Output :  svn, version 1.7.10 (r1665045) Problem : Clearly my Mac Os and Maya were using different SVN. On executing command: "which svn" Terminal gave =  /usr/bin/svn Maya gave      = usr/local/bin/svn After spending allot of time, I was not able to figure out how to point maya to use usr/local/bin/softwares. I tried modifying - /etc/paths file (which is $PATH), - /Users/username/.bash_profile My Solution: 1. Install svn...

Calling an external command in Python

Here's a summary of the ways to call external programs and the advantages and disadvantages of each: os.system("some_command with args")  passes the command and arguments to your system's shell. This is nice because you can actually run multiple commands at once in this manner and set up pipes and input/output redirection. For example, os.system("some_command < input_file | another_command > output_file") However, while this is convenient, you have to manually handle the escaping of shell characters such as spaces, etc. On the other hand, this also lets you run commands which are simply shell commands and not actually external programs. see documentation stream = os.popen("some_command with args")  will do the same thing as  os.system  except that it gives you a file-like object that you can use to access standard input/output for that process. There are 3 other variants of popen that all handle the i/o slightly differently. If you pa...

Robomongo and MongoDB - initial setup on Mac

Image
1. Install MongoDB : Download tgz or zip file from MongoDB website   Extract tgz or zip file in home directory eg : /Users/userName/mongodb_x86_64-3.0.0 Add path of mongoDB directory in PATH 2. Run MongoDB server : Create a directory for primary DB path. /Users/userName/mongodb_x86_64-3.0.0/data/db Run Command /Users/userName/mongodb_x86_64-3.0.0/bin/mongod --dbpath /Users/userName/mongodb_x86_64-3.0.0/data/db  --bind_ip 0.0.0.0 -v 3. Install RoboMongo : Download RoboMongo from http://robomongo.org/ Drop downloaded/extracted folder in Applications folder (/Applications) 4. Run RoboMongo and Connect with MongoDB : 5. Create Example Database in RoboMongo : Step 1 : Create Database Step 2 : Create Collection ( Collection of Documents/Tables ) Step 3 : Create Document/Table  Step 4 : Insert data in Document Query Test in Python ( using pymongo) import pymongo # Connecting with server client = p...