2013년 7월 30일 화요일

Fake BRDF Samlple code for Unity3d



  1. Shader "Custom/TestShader" {
  2.     Properties {
  3.         _MainTex ("Base (RGB)", 2D) = "white" {}
  4.         _BRDFTex ("BRDF (RGB)", 2D) = ""{}
  5.     }
  6.     SubShader {
  7.         Tags { "RenderType"="Opaque" }
  8.         LOD 200
  9.        
  10.         CGPROGRAM
  11.         #pragma surface surf NoLighting
  12.         sampler2D _MainTex;
  13.         sampler2D _BRDFTex;
  14.         struct Input {
  15.             float2 uv_MainTex;
  16.             float2 uv_BRDFTex;
  17.         };
  18.         void surf (Input IN, inout SurfaceOutput o) {
  19.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
  20.             o.Albedo = c.rgb;
  21.             o.Alpha = c.a;
  22.         }
  23.         fixed4 LightingNoLighting (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten){
  24.        
  25.             half NdotL = dot(s.Normal, lightDir);
  26.            
  27.             half NdotV = dot(s.Normal, viewDir);
  28.            
  29.             half HalfNdotL = (NdotL*0.5f)+0.5f;
  30.       
  31.       half4 c;
  32.        
  33.       fixed4 ramp = tex2D (_BRDFTex,float2(NdotV,HalfNdotL));
  34.       
  35.       c.rgb = s.Albedo * _LightColor0.rgb * ramp.rgb *( atten *2);
  36.       
  37.       c.a = s.Alpha;
  38.       
  39.       return c;   
  40.         }
  41.         ENDCG
  42.     }
  43.     FallBack "Diffuse"
  44. }
    sample picture.

    texture

    X is NdotV, Y is Halfdiffuse(Half Lambert)



2013년 7월 28일 일요일

Flyball, 2D, Android

This is my first publishing game.

It is made by IFU Games.

I made all of playing scene and ball's physical.

Madness - PC, 3D

First 3D game by Gamebryo.  DEC, 2011

My team made this game for four month.
I learned Rendering pipelines. It is my last project in University.