Archive

Archive for the ‘Game and CG’ Category

Toon Shading

December 6, 2015 1 comment

Introduction

Toon shading is 3D technique based on a specific shading method, which consist in recreate the look of traditional 2D animation cels with the use of flat colours for shading 3D objects in a unrealistic way.

Flat

This shading technique has been used in several games. There are several games that use this tehcnique, such as: Ni No Kuni, Legend of Zelda, Ōkami, Naruto Shippuden, etc.

games.png

There are two main topics in Toon shading, First is shading it self and the second one is Outline.

Shading

Toon shading used the enhancement of Diffuse/Lambertian Reflection, called Half Lambert.

What is Diffuse reflection?

When incoming light touch the surface it will be reflected off the surface in all direction equally. The light intensity of a point in the surface can be computed using the surface normal vector N and the light vector L

diffuse

 

Half Lambert is Technique first developed in the original Half-Life. Way of getting the lighting to show the surface of an object in low-light areas

half_lambert

Example of Half lambert equation in CG Language:

toon_shading_cg

Outline

For the outline we can use Silhouette. A silhouette is an edge shared by one front and one back-facing polygon.

silhouette

To get the outline more appeared we can enlarge back-facing polygon.

backface_poligon

If you look into unity toon shading package, you will see following code in ToonBasicOutline shader to produce the outline.

silhouette_cg

Try out with 3D Model

This is the result when i tried out a 3d model with diffuse shading and toon shading.

unity_result

Categories: Game and CG, Uncategorized

Nintendo 3DS Region Unlock

November 29, 2015 Leave a comment

I have bought old Nintendo 3DS from Japan, but sadly there’s a region lock that not permit us to play 3ds games that have different region with the console it self.

3DS games Sellers in my country rarely sell japanese regional games. To buy game, i had my friend in japan to buy the game for me. that’s suck. I did once anyway.

So, I google how to ‘jailbreak’ it, and found out that we can use Gateway 3DS to do that.

Requirements:

  1. Gateway 3ds Catridges:
    • Blue Catridge
    • Red Catridge
  2. Micro SD cards:
    • 2 GB or less for Gateway3ds Firmware
    • 8 GB or more to store your 3DS games
  3. SD Card to store saved game data
  4. Latest Gateway 3DS firmware
  5. Nintendo 3DS (firmware up to version 9)
  6. Original Game catridge (optional)

Steps needed:

  1. Format 2 GB micro SD card with Fat partition
  2. Copy all Files inside “Blue Card (R4i)” folder (from downloaded gateway 3ds firmware)  to root directory of 2 GB micro SD card
  3. Copy Launcher.dat to SD card
  4. Insert 2 GB micro SD card to Gateway 3DS Blue catridge.
  5. Insert Blue catridge to Nintendo 3DS catridge slot
  6. Boot into Gateway Menu. If it not working, then try to open nintendo 3ds browser, go to

    http://go.gateway-3ds.com – when the bottom screen changes to white, Press and hold the Left Shoulder button and your 3DS/2DS will boot to the Gateway Menu.

  7. Backup current 3ds firmware to SD card by selecting “Backup System Nand” menu. cut and paste backup file to a folder in your computer
  8. Downgrade 3ds firmware to version 4.4-4.5
  9. Reboot 3DS, check current 3ds firmware version
  10. Boot into Gateway Menu again
  11. Create EmuNand
  12. Insert original game catridge and save the game file into sd card. cut and paste the file (with extension .3DS) to 8GB micro SD card (exFat formatted). Insert it into Gateway Red catridge
  13. Boot into Emunand from Gateway Menu and update to the latest 3ds firmware.
  14. Insert Gateway Red catridge into 3ds catridge slot
  15. Press “select” button and select available game, your saved game in step 12 should appear
  16. Play the game!!

 

Categories: Game and CG, Nintendo 3DS

Create Simple Loading Screen

December 16, 2014 Leave a comment

Just try to create simple Loading screen during the idle time …

  1. Create Folders Scripts, Scenes, and Textures in Assets Folder
    • Scenes
      • Loading.unity (Set Background in Main Camera to Black)
      • Scene01.unity
      • Scene02.unity
    • Scripts
      • Base
        • PersistentObject.cs
      • Game
        • Scene01Controller.cs
        • Scene02Controller.cs
      • Loading
        • LoadingManager.cs
        • LoadingScript.cs
        • Fading.cs
    • Textures
      • fadeout_texture.png (black image 2×2 pixels) imported as texture
  2. Write Script
    • PersistentObject.cs
      using UnityEngine;
      using System.Collections;
      
      public abstract class PersistentObject<T> : 
      MonoBehaviour where T : Component {
          private static T instance;
          
          void Awake() {
              if (instance == null) {
                  instance = GetComponent<T>();
                  DontDestroyOnLoad(gameObject);
                  OnAwake();
              } else {
                  Destroy(gameObject);
              }
          }
          
          protected virtual void OnAwake() {
              
          }
      }
    • Fading.cs
      using UnityEngine;
      using System.Collections;
      
      public class Fading : MonoBehaviour 
      {
          public Texture2D fadeOutTexture;
          public float fadeSpeed = 0.8f;
      
          private int drawDepth = -1000;
          private float alpha = 1.0f;
          private int fadeDir = -1;
      
          void OnGUI()
          {
            alpha += fadeDir * fadeSpeed * Time.deltaTime;
            alpha = Mathf.Clamp01(alpha);
      
            GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,alpha);
            GUI.depth = drawDepth;
            GUI.DrawTexture(new Rect(0,0, Screen.width, Screen.height), 
                            fadeOutTexture);
      
          }
      
          public float BeginFade(int direction)
          {
              fadeDir = direction;
              return fadeSpeed;
          }
      
          void OnLevelWasLoaded()
          {
              BeginFade(-1);
          }
      }
    • LoadingManager.cs
      using UnityEngine;
      using System.Collections;
      
      public class LoadingManager : PersistentObject<LoadingManager
      {
          private string _nextScene = "Scene01";
          public string NextScene { get { return _nextScene;} }
          public void Load (string name) {
              _nextScene = name;
              Application.LoadLevel("Loading");
          }
          IEnumerator WaitAndLoad() { 
              float fadeTime = Component.FindObjectOfType<Fading>().BeginFade(1);
              yield return new WaitForSeconds(fadeTime);
              Application.LoadLevel("Loading");
          }
       }
    • LoadingScript.cs
      using UnityEngine;
      using System.Collections;
      
      public class LoadingScript : MonoBehaviour 
      {
          [SerializeFieldprivate GUIText textLbl;
          private float progress;
          AsyncOperation op;
          
          IEnumerator Start() {
              yield return new WaitForSeconds(0.2f);
              LoadingManager loadingManager = 
              Component.FindObjectOfType<LoadingManager>();
              op = Application.LoadLevelAsync(loadingManager.NextScene);
              yield return op;
          }
          
         void Update() {
              if( (op!=null) && (!op.isDone) ) {
                  progress = op.progress * 100f;
                  textLbl.text = "Loading.. " + progress" %";
              }
          }
      }
      
    • Scene01Controller.cs
      using UnityEngine;
      using System.Collections;
      
      public class Scene01Controller : MonoBehaviour 
      {
          void OnGUI() {
              GUILayout.BeginArea (new Rect (10,10,100,100));
              if(GUILayout.Button("Scene02")) {
                  var loadingManager = 
                  Component.FindObjectOfType<LoadingManager>();
                  loadingManager.Load("Scene02");
              }
              GUILayout.EndArea ();
          }
      }
    • Scene02Controller.cs
      using UnityEngine;
      using System.Collections;
      
      public class Scene02Controller : MonoBehaviour 
      {
          void OnGUI() {
              GUILayout.BeginArea (new Rect (10,10,100,100));
              if(GUILayout.Button("Scene01")) {
                  var loadingManager = 
                  Component.FindObjectOfType<LoadingManager>();
                  loadingManager.Load("Scene01");
              }
              GUILayout.EndArea ();
          }
      }
  3. Attach Script
    • LoadingScript.cs & LoadingManager.cs
      Create 2 empty game objects (LoadingScript and LoadingManager) in Loading.unity and attach these script
    • Fading.cs
      Attach this script to LoadingManager game object in scene Loading.unity and assign fadeout_texture texture
    • Scene01Controller.cs
      Create 1  empty game object in Scene01.unity and attach this script
    • Scene02Controller.cs
      Create 1 empty game object in Scene02.unity and attach this script
  4. Attach GUIText Component
    • Attach GUIText Component to LoadingScript.cs empty game object (step3)
    • Set text to “Loading ..”
    • Set position to (0.5,0.5,0.0)
    • Set Anchor value to “middle center” and Alignment to “center”
    • Drag this GUIText Component to variable textLbl in LoadingScript.cs inspector
  5. Include Scenes in Build Settings
    • Loading.unity
    • Scene01.unity
    • Scene02.unity
  6. Test
Categories: Game and CG, Programming, Unity

Warcraft 3 Running on Mac OS X Mountain Lion

December 26, 2012 1 comment

This is step2 that i did to run Warcraft 3 on Mac OS X Mountain Lion (10.8).  It need Snow Leopard or below version of Mac OS X with Intel x86 processor in order to install warcraft 3. and then copy installed warcraft 3  to mountain lion. I did the following step:

  1. Install VMWare (Virtual Machine) Fusion 5.0.1 on Mountain Lion
  2. Install Snow Leopard with VMWare, you need:
  3. Install warcraft 3 Reign of Chaos on Snow Leopard
  4. Install Frozen Throne expansion pack on Snow Leopard
  5. Install warcraft 3 latest patch from : http://ftp.blizzard.com/pub/war3x/patches/Mac/
    • In my case i use War3TFT_1xx-126a_English.zip
  6. Zip installed Warcraft 3 from Snow Leopard and copy to Mountain Lion
  7. Unzip it in the /Applications/ folder of Mountain Lion
  8. In the mountain lion : Under the /Applications/warcraft3 folder, Right click “The Frozen Throne.app”, then select “Show Package Contents”
  9. Under the directory “MacOS” double click “The Frozen Throne” to run the game.
  10. Good Luck and Have Fun!

This is The Result

Categories: Game and CG, Mac Os

Game elements

October 16, 2012 2 comments

According to “The Art of Game Design” there are 4 basic elements of game, which are :

  1. Mechanics : these are the procedures and rules of your game. Which consists of : space, objects, actions, rules, skill, chance
  2. Story : this is sequence of events that unfolds in your game
  3. Aesthetic : This is how your game looks, sounds, smells, tastes, and feels
  4. Technology : it’s not exclusively referring to “high technology”, instead any materials and interactions that makes your game possible, such as: paper and pencils, plastics chits, or high-powered lasers
Categories: Game and CG

Multiplayer FPS Game

August 5, 2012 1 comment

Preparing for second test. now with little AI. Client-Server model with RakNet. hope it will finish soon. thanks to Sigit Kusumanugraha for the icon.

Server Spec:
● Linux (Debian) kernel 2.6.32-5-686
● RakNet 4

Client Spec:
● Windows 7
● Unity 3D
● RakNet 4

インドネシアにあるオンラインゲーム出版社

March 31, 2012 1 comment

メモしておこう。

  1. LYTO
    • URL:http://www.lyto.net/about/
    • ゲーム:Soul of Heroes, Ragnarok Online, RF Online, Luna Online, Rohan Online, Cross Fire etc.
  2. Megaxus
    • URL:http://int.megaxus.com/
    • ゲーム:Audition AyoDance, Lineage II, War Rock, Grand Chase, Counter-Strike Online, etc.
  3. IAHgames Indonesia
    • URL:http://www.iahgames.com/#onlinegame
    • ゲーム:EA Sport FIFA Online 2, Dragonica, Granado Espada, Emil Chronicle Online, etc.
  4. Wavegame (PT. Wave Wahana Wisesa)
    • URL:http://www.wavegame.net/
    • ゲーム:Angle Love Online, 3 Kingdoms, Heroes Kingdoms online, Gods War Online, Red Cliff Online, etc.
Categories: Game and CG