Tuesday, May 21, 2013

Today, i want write about BGE Tutorial. I've write Tutorial Game 3D Dasar Pergerakan Objek on my bahasa site. After that, i write it in english for help other people arround world understand with my tutorial. Before following this tutorial, you need to install Blender in your PC / Laptop. In this tutorial i am using Blender 2.67. This tutorial for beginners.

On the first step, please choose Blender Game mode, it make Blender using as Game Engine. This mode not really important for the tutorial. But you will need it for creating game with Blender Game Engine.
Blender Game
Blender Game
I will use default cube for this tutorial. So you can make the cube move when you press a key on keyboard. Before playing with game engine, i think you need to change the window mode to Game Logic.
Game Logic Mode
Game Logic Mode
I assume you already understand the navigation in Blender. If you are not understand the navigation, please learn the navigation first. It will helpfull. Let start the tutorial

Select the cube first and look at the bottom of 3D view window. You will know 3 parts of BGE Logic, they are Sensors, Controllers and Actuators.

  • Sensors are the logic bricks that cause the logic to do anything. Sensors give an output when something happens, e.g. a trigger event such as a collision between two objects, a key pressed on the keyboard, or a timer for a timed event going off. When a sensor is triggered, a positive pulse is sent to all controllers that are linked to it. 
  • The Controllers are the bricks that collect data sent by the sensors, and also specify the state for which they operate. After performing the specified logic operations, they send out pusle signals to drive the actuators to which they are connected.
  • Actuators perform actions, such as move, create objects, play a sound. The actuators initiate their functions when they get a positive pulse from one (or more) of their controllers.

At this time, i want to make the cube move when i press a button on keyboard. For do that, we need to add a Keyboard sensor. On sensor input i add up arrow. Your sensors will look like the image below
Sensors Keyboard
Sensors Keyboard
Let continue by adding the add controller, then connect the sensors to the controllers so that it looks like the image below.
Controller And
Controller And
After that, add motion actuator so that the object can be moved in accordance with what we want. On motion actuator there are several parameters that Loc, Rot, which can be changed on the X-axis, Y and Z. Connect with controllers before attempting to run.
Actuators Motion
Actuators Motion
There is a need to consider before setting motion parameters, namely the position of the axis and the value of the parameters that I will try to explain below.

On Blender navigation, the X axis is represented in red, green Y-axis and Z-axis in blue. If you want to move the object to the right / left use the X-axis, forward / back axis Y and upward / downward axis Z.
xyz axis
xyz axis
For the parameter values ​​do not immediately fill with 1, because the object will move directly away. Blender using Blender Unit, 1 Blender unit size of the box as shown below.
Blender Unit
Blender Unit

Use a positive value to move the object to the right (X) to the front (Y) and to the (Z). And use a negative value to reverse. Add another keyboard according to your wishes :D. To run the game press the button P.

Oh yes, I include the file that contains the 4 buttons keyboard, and their movements. May be used to practice and understand the concept of movement.

Download File on Dropbox

Monday, May 13, 2013

Bumblebee project is an open source project for Nvidia graphic card that support optimus technology. I am using Nvidia GeForce GT540M that supported with optimus technology.  Here is step by step bumblebee instalation
  1. Check your vga card using command
    sudo lspci -vnn |grep '\[030[02]\]'
    VGA has been detected in my laptop, so i get message below
    00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) (prog-if 00 [VGA controller]) 
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108 [GeForce GT 540M] [10de:0df4] (rev a1) (prog-if 00 [VGA controller]) 
  2. Add Bumblebee Repository
    sudo apt-add-repository ppa:bumblebee/stable
    sudo apt-add-repository ppa:Ubuntu-x-swat/x-updates
  3. Update nvidia-current package if you've install optimus card before
    sudo apt-get purge nvidia-current
  4. Update repository list
    sudo apt-get update
  5. Install bumblebee with the nvidia driver
    sudo apt-get install bumblebee bumblebee-nvidia
  6. Restart your machine
    
    
After installing Bumblebee, by default we do not use the nvidia card when running a program. For that we need to add optirun command on the terminal to running an application using nvida card, for example
optirun blender 

We can display our nvidia card properties with this command

optirun nvidia-settings -c :8
nvidia gt540m
nvidia gt540m

Might be a bit complicated to run applications with the terminal, with optirun anyway. I have two tips for running applications with bumblebee.

Using Gnome Shell
If you are using gnome shell you can using shortcut Alt + F2. You will get an box and write
optirun blender
so you can run without terminal. But i think it's same with using terminal. The differences you don't need to keep terminal open

Using Bumblebee-UI
You can using UI for running an application that must use bumblebee. There is step by step install the bumblebee ui on your machine. You must connected into internet first before follow this step.

  1. Install git first
    sudo apt-get install git
  2. Create a folder for git
    mkdir git
  3. Go to the git folder with terminal
    cd git
  4. Download bumblebee-ui from git repositroy
     git clone https://github.com/Bumblebee-Project/bumblebee-ui.git
  5. Go to folder bumblebee-ui
    cd bumblebee-ui
  6. Install bumblebee-ui
    sudo ./INSTALL
  7. After install Bumblebee UI, open Startup Application menu and add bumblebee aplication that you can run when computer on with this command
    /usr/local/bin/bumblebee-indicator
  8. Restart ccomputer and you will get an icon on top (unity) and bottom (gnome-shell) that you can use to select which program that will be run using bumblebee.
If you are Blender user and want to use cycles in Ubuntu, you need more instalation i will write in next post.

Tulisan ini dalam bentuk bahasa Indonesia: Cara Install Nvidia Optimus di Ubuntu

Sunday, May 12, 2013

Have you ever got this error message "Cannot Access PPA (ppa url) to get PPA Information, please check your internet connection"? But in the same time we can browsing some webpage and download files. Why we can't acces the ppa? After search on the forum i get the answer, it's because of what we type in terminal

For example in the screenshot below is
sudo add-apt-repository ppa:irie/Blender

cannot access PPA to get PPA Information, please check your internet connection
cannot access PPA to get the information
We need to change all letters to lowercase, so we can add the ppa repository in our machine. The code look like this
sudo add-apt-repository ppa:irie/blender

After change all letters into loweracase, the ppa can be added
add ppa success
add ppa success
I hope can help everyone who are frustrated because can't  ppa to repository list :D

Wednesday, May 8, 2013

My brother has a tv tuner that has not been used. Now, i try to use it in Ubuntu 12.10. I try to search linux driver on hardware website but i am not found the driver. But i found an ubuntu package that can use for watching tv, the package called tvtime. To install this package just run
sudo apt-get install tvtime

tv tunner
tv tunner
Although there are a tvtime package, but the application does not run so well for my gadmei. I think because it was too old, about 5 years ago. There are a few things I do to fix the application to be compatible with the hardware I have. The problems that I experienced after the installation is

TVTIME not detect the video source from Gadmei. By default, tvtime detect video source such as a webcam on the laptop. We can figure out the problem by running tvtime in a terminal. Would appear an error message like this
videoinput: Driver won't tell us its norm: Invalid argument
videoinput: Can't get tuner info: Inappropriate ioctl for device
    Your capture card driver: uvcvideo [Laptop_Integrated_Webcam_2HDM/usb-0000:00:1a.0-1.4/19
    does not support full size studio-quality images required by tvtime.
    This is true for many low-quality webcams.  Please select a
    different video device for tvtime to use with the command line
    option --device.

To fix this, go sourcelist of tvtime in the folder / etc by running the command
 sudo gedit /etc/tvtime.xml 

search for code below
 <option name="V4LDevice" value="/dev/video0"/>

Change the video0 to video1 so the code will be look like this
<option name="V4LDevice" value="/dev/video1"/>


Before start watching we need to scan the tv frequency on our location :D. So we can save the frequency of  tv station in our area. To scan tv frequency, run this command to terminal
 tvtime-scanner

tvtime-scanner
tvtime-scanner
After that just rung tvtime and you will can watch television in your ubuntu desktop.

watching television on ubuntu
watching television on ubuntu