Johnny G Junior's NoteBook Treasures: April 2009

Wednesday, April 29, 2009

3DS Max Color Key: Materials ID colors




when rendering out a scene in 3ds max... you might want to render off a pass using Materials ID as a matte. This is a color key for the # assignments.

Monday, April 27, 2009

Painting



This is a painting i did while hanging out with my laptop one night. it was fun :)

Sunday, April 26, 2009

Photoshop - Non Destructive Matting using Channels

Here is an example of Non destructive masking using the channels panel to help. For this example, we will remove the sky background from this chicageee image ...



Step 1: Open your photo... :)




Step 2: Click on the channels tab and search through each channel to see which one gives you the best contrast difference between the objects you want to matte out. In this case, the BLUE CHANNEL works great for this particular image. (1) Drag the blue channel down to "Create New Channel" icon. (2) is created



Step 3: while the "blue copy" or the channel you copied is selected, go to IMAGE | ADJUSTMENTS | LEVELS




Step 4: Adjust the levels to blow out the lights or darks. You don't want to go to hard because you still want some of the fine details, for example the flag poles in this image. The idea here is to get a really good separation line between the 2 items.



Step 5: Now that we have a good amount of white, its time to blacken out the opposite area. We can do this very quickly by making a selection and filling in the dark area with black. lets start by selecting the magic wand and select the white area.



Step 6: Inverse the selection, press SHIFT + f5 to pull up the FILL command. YOu want to make sure that BLACK is the foreground color... then click OK.

**** NOTE, you can also use the PAINT BRUSH on this channel to add or remove some details.. use black and white and or feathered brushes.. *****



Step 7: This is the result after the fill.



Step 8: Turn the RED, BLUE and Green channels back on and turn off the BLUE COPY layer.



Step 9: Lets go back to the layers panel and now lets LOAD the selection we just created. From the file menu go to SELECT | LOAD SELECTION



Step 10: Choose the channel you want to select from.



STEP 11: Make sure your selection is right. You MAY need to inverse this selection. In this example we needed to. If you wanted to avoid this step, in step 10 there is an INVERSE check box... you could just select that and you'd skip this step all together.



STEP 12: while the selection is still active, click on the "ADD LAYER MASK" (1) and it will create a Matte on the layer (2). The

The rest of the image is not deleted, but rather is is masked away on this channel. You can still modify the matte by clicking on the image on the layer that represents the matte and paint using the paint brush, black or white. Black makes 100% transparent, white makes it 100% solid. Anywhere inbetween white and black adds opacity to the image.

Saturday, April 25, 2009

AfterFX Expression: Rotation driven by position

While surfing the web, i run into many great resources that help make life a whole lot easier to live. For example this expression for after fx from creativecow.net.

Use this expression to figure out the spin rotation rate of a wheel compared to the movement(translations) of the BODY its attached to. EXAMPLE (car, tracker, wheelborrow, BIKE).





Alt Click on ROTATION to set an expression and add this.


d=width;
pi=Math.PI;
circ=d*pi;
rot = 360/circ;

movex=thisComp.layer("body").transform.position[0];
scaler=thisComp.layer("body".transform.scale[0]/100;

rot*movex/scaler;



Math is great - especially High School Math. circumference of a circle is circ = pie x diameter.



[pie = 3.14 (Math.PI), diameter = width = pixels]. rotation is for every (CIRC) we want it revolve 1 REVOLUTION (or 360 DEGREES).. Rotation = 360/circ * pixels traveled on x

The scaler variable comes in just incase you want to change the scale of an object without throwing off the script.

it whole equation is Rotation = (360/circ) * pixels traveled / scale.

[d, pi, circ, rot, movex, scaler] are all variables. They are just storage names that are referenced throughout the script.

[rot*movex/scaler] is the equation.

Sunday, April 19, 2009

Logout script php

whats a login script good for unless you have a logout script to follow it.
   
$Session_start();    
     
$session_unregister("valid");    
     
$session_unset();    
     
$session_destroy();    
     
$header ("Location: http://YOUR URL YOU WANT TO GO TO ONCE LOGGED OUT");    
   
   

Simple Username and Password Login PHP/MYSQL



I place NOTES in the actual script.... notes start with /// which are disabled in the script


 session_start();  
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');   
 header('Cache-Control: no-store, no-cache, must-revalidate');   
 header('Cache-Control: post-check=0, pre-check=0', FALSE);   
 header('Pragma: no-cache');  
   
 /// NOTE FOR YOU - write a connection to your mysql   
   
 $user = $_POST["username"];  
 $pass = $_POST["password"];  
 $table = "WRITE TABLE HERE";  
 $field = "WRITE FIELD HERE";  
   
   
   
 if(isset($_POST['op'])) {  /// if the form is submitted  
   
   //// if Username is NOT Empty and Password is NOT EMPTY  
   if (!empty($_POST['username']) && !empty($_POST['password'])){  
   
 /// create an SQL variable to check username and password  
 $sql = "SELECT $field FROM $table WHERE username='$user' AND password='$pass'";  
   
 $result = mysql_query($sql);  ///  QUERY  
 $num = mysql_num_rows($result); //// evaluate the # of entries from $result  
   
   
 if ($num == 0 || $num > 1) { //// if $num = 0 or is greater than 1   
   
 //// if posted username is NOT equal to username OR posted password is NOT equal..  
   
 if ($_POST['username'] != 'username' || $_POST['password'] !='password'){  
   
 $msg = "Bad Login - Try again"; /// create a variable called $msg to store message  
 $_SESSION['valid'] = 'invalid'; // SESSION = invalid  
 }  
 } else { /// else if the post IS equal  
 $_SESSION['valid'] = 'yes'; // SESSION = yes  
 header('location:http://www.YOURLOCATION.com'); // change location  
 exit; // exit the rest of the script  
 }  
 } else {  //// if you didnt enter in anything in either the user or password field  
 $msg = "Please enter username AND password";  
 }  
 }  
 ?>  



Lets make a form now in the same PHP file.. QUICK NOTE.. this form is missing quotes because i could not get this to publish without some modification. Create a form and add the php script and hidden elements just like the form below.

Username:
Password: