3Ds Max – Hiding Layers

In the following video, I explain how you can hide 3D objects and making it easier to work on your scene.

Photoshop – Data Driven Graphics

What is ‘Data Driven Graphics’?

Data-driven graphics make it possible to produce multiple versions of an image quickly and accurately for print or web projects. For example, you can produce 100 versions of a web banner with different text and images, all based on a template design.

In the following tutorial we are going to read data from a CSV file and automatically create a banner for every row contained in the below dataset.

Step 1

In our example, we have two layers named as ‘Christmas Tree’ and ‘Background’ acting together as a very simplistic postcard. Yes, it is very simple.

Capture

Step 2

If we open our sample dataset (the CSV Excel file), we can notice that our database is divided into four columns which are the “Name”, “Surname”, “Street” and “Country”. Do you agree that we need to link Photoshop with this database? Yes? Good. Let’s proceed to the next step.

Capture

Netduino 2 – Introduction to Netduino – Traffic lights

You might ask. What is a Netduino? Netduino is an electronics prototyping platform based on the .NET Micro Framework. Yes, you can use C# and Visual Studio to develop!

NET0012-1_0

To understand how Netduino works we are going to build a traffic lights. I suggest that first you install the .NET Micro Framework on your PC from the following link: http://www.netduino.com/downloads/

For this project we need:

  • Netduino 2 (duh…)
  • Wires
  • Breadboard
  • 3 * 47 Ω (resistors)
  • 1 Red LED
  • 1 Green LED
  • 1 Amber LED

One bought the wires, breadboard, resistors and the LEDs from: http://www.ebay.co.uk/itm/121296151553?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT. The Netduino 2 from: https://www.coolcomponents.co.uk/netduino-plus-2-net-c-development-board.html

Ok let’s start…

A solderless breadboard is a construction base for prototyping of electronics and it does not require soldering thus making it reusable.  The following video explains better how breadboards work and how to attach resistors and LEDs:

Now that you have a better understanding of how to use a breadboard, we can start building our traffic lights. Finally!

Wire the external LEDs and the resistors as shown in the pictures below:

netduinoTrafficLightsPhoto1 netduinoTrafficLightsSetup

In the code below you will notice that one has defined three Output Ports. One port is for our green LED and is set for digital Pin 0. The second port is our amber LED and  is set for digital Pin 1. The third port is our red LED and is set for digital Pin 3. One is also using the Interrupt Port which is the button on the Netduino. When the button is pressed, the traffic light will change it’s state like in the diagram below.

trafficlightStates

The Output port supports a method named ‘Write’ which accepts a Boolean value. When a ‘true’ value is passed our concerned LED will light up and vice versa. The ‘Thread.Sleep’ command is used to pause the traffic light from changing it’s state quickly.

Here is the final result:

IMG_0667

Learn Bubble and Bucket Sort Algorithms by playing a 2D Digital Game

Sorting Algorithms are very difficult to understand. With the help of this game one can understand the fundamental principles of Bubble and Bucket Sorting algorithms. This game is based on the famous game ‘Frogger’, were the student has to collect boxes and sort them according their values by using sorting algorithms rules.

This game has been developed using Microsoft XNA and can be installed freely on any PC that is running Windows. One must not make any profit on such content.

Download Game

Caching Variables in Unity

Today I was reviewing some Unity code and I got puzzled by this statement

private Rigidbody _cacheRigidbody;
void Start () { 
      // Cache reference to rigidbody to improve performance
      _cacheRigidbody = rigidbody;
  }

At first glance, I couldn’t understand what is the scope of declaring a cache variable when it is just referencing the same memory space.

Well…according to the Unity it is faster to cache the reference to the object on start() or awake() method, rather than use the GetComponent<Rigidbody>() or GameObject.Find() everytime you want to use a component.

Reduce GetComponent Calls

Using GetComponent or built-in component accessors can have a noticeable overhead. You can avoid this by getting a reference to the component once and assigning it to a variable (sometimes referred to as “caching” the reference). For example, if you are using something like:-

 
function Update () {
    transform.Translate(0, 1, 0);
}

…you would get better performance by changing it to:-

 
var myTransform : Transform;

function Awake () {
   myTransform = transform;
}

function Update () {
    myTransform.Translate(0, 1, 0);
}

Well that make sense now! 🙂

Unity 3D: Spectator Camera Like in Call of Duty

Like the title says we are going to create a spectator camera view. For those of you who don’t know what I’m taking about just watch this video and understand the goooodness 🙂

Ok let’s start

1) Open Unity (Duh…)

2) Create a C# Script File and name it Spectator.cs

3) Paste the following code

using UnityEngine;
using System.Collections;

public class Spectator : MonoBehaviour {

 //initial speed
 public int speed =20;

 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {

 //press shift to move faster
 if(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
 {
    speed = 40; 
 
 }
 else
 {
    //if shift is not pressed, reset to default speed
    speed =20; 
 }
 //For the following 'if statements' don't include 'else if', so that the user can press multiple buttons at the same time
 //move camera to the left
 if(Input.GetKey(KeyCode.A))
 {
    transform.position = transform.position + Camera.main.transform.right *-1 * speed * Time.deltaTime;
 }

 //move camera backwards
 if(Input.GetKey(KeyCode.S))
 {
    transform.position = transform.position + Camera.main.transform.forward *-1 * speed * Time.deltaTime;
 
 }
 //move camera to the right
 if(Input.GetKey(KeyCode.D))
 {
    transform.position = transform.position + Camera.main.transform.right * speed * Time.deltaTime;
 
 }
 //move camera forward
 if(Input.GetKey(KeyCode.W))
 {
 
    transform.position = transform.position + Camera.main.transform.forward * speed * Time.deltaTime;
 }
 //move camera upwards
 if(Input.GetKey(KeyCode.E))
 {
    transform.position = transform.position + Camera.main.transform.up * speed * Time.deltaTime;
 }
 //move camera downwards
 if(Input.GetKey(KeyCode.Q))
 {
    transform.position = transform.position + Camera.main.transform.up * -1 *speed * Time.deltaTime;
 }

 }
}

4) Attach the Spectator.cs to the main camera

5) Attach the Mouse Look Script (comes as a ready component with Unity) to the main camera

Final Result:

Spectator