Archives For words

Dot Product & Normalize

September 25, 2018

These are two of the most used functions in Computer Graphics, and quite a lot of the time, the underlying process of how it works, is ignored.

Normalizing a vector is essential for a variety of reasons, and below is the long way around to do it, as opposed to the normalize VOP.

normalise_long_form_point_vop

We need to find the length of the Vector, as this will be used as the divisor for the x,y,z components of the Vector to be normalized. This is done by taking the x,y,z components and taking each to ^2 power. Then we add those values together and find the square root. Now we have the length of the Vector, and  can use it as the divisor. Voila!

Now it’s time to do the Dot Product! Mysterious I know. But very handy in shading/lighting and other areas of Computer Graphics. The Dot Product is the Cosine of two normalized vectors. Cosine being the trig function equal to the ratio of the side adjacent to an acute angle (in a right-angled triangle) to the hypotenuse. That’s pretty neat!

Below is a quick animation of the Cosine around a unit circle. The unit circle being a radius of 1 of course. The Dot product of two normalized vectors, which we will see is just multiplying their components and adding them together, creates a trigonometric function.

Here is the long way of doing it, instead of using the dot product VOP.

dot_product_long_form_point_vop

First we normalize both Vectors. Then we split the x,y,z components of each vector and multiply them. Adding the results of this all together. Bingo! Very Simple really isn’t it. Additionally, using a trig VOP to use arc cosine along with a radians to degrees, will give you the actual angle between those two vectors.

I Have been working on this for the last six months.

1.) Grab the latest studio pro download for Linux. (12.5.x) as of writing, but  I’m using 13.1.7 alpha.

2) Extract the contents, I’ve just gone “/home/dude/Downloads” and make a new folder in your home directory, “/home/dude/programs” for example.

3) Open a terminal and cd to “/home/dude/Downloads/3delight-13.1.7-Linux-x86_64” and run the following: “./install –prefix home/dude/programs”

4)cd to /home/dude/programs/3delight-13.1.7

5)run: “unset DELIGHT”

6)run: “source .3delight_bash”

7)cd to home

8)sudo gedit .bashrc (and add the following lines)

# set DELIGHT path

export DELIGHT=/home/dude/programs/3delight-13.1.7/Linux-x86_64
source /home/dude/programs/3delight-13.1.7/.3delight_bash
#

9)I had issues with these env variables not being present, so set these too, with the following command.  “export MAYA_PLUG_IN_PATH=/home/dude/programs/3delight-13.1.7/maya/2017/plug-ins”, and MAYA_SCRIPTS_PATH, DL_DISPLAYS_PATH too.

10) Set the frame buffer to be i-display in 3delight prefs in Maya, before you render, or it will crash Maya.

I launch Maya from a terminal, that way everything is set right. Also, if you plan on adding your own custom OSL shaders, set this env too.

_3DFM_USER_OSL_PATH

Voila!

3delight_13_test_v001_nsiRenderSettings1_0001_7

 

 

 

 

 

 

 

Colour Constructor

December 27, 2017

Really neat tool, and super cheap too.

Colour Constructor

untitled1cornellWater

3D Prints

December 18, 2016

So I’ve finally bought a printer. A Zortrax M200 to be exact. Great machine. Rigid construction and a nice closed loop ecosystem. Which means consistent prints.

20161115_100147