블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2794)
Unity3D (852)
Programming (478)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (11)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
출처 : http://deview.kr/2013/detail.nhn?topicSeq=15


반응형
Posted by blueasa
, |


링크 : http://m.todayhumor.co.kr/view.php?table=bestofbest&no=160513

반응형
Posted by blueasa
, |


링크 : http://www.slideshare.net/MrDustinLee/ss-33346625

반응형

'Unity3D > Script' 카테고리의 다른 글

Simple C# Unity Serializer  (0) 2014.09.25
ClipboardHelper  (0) 2014.05.15
ScreenWipe CrossFade with C#  (0) 2014.04.22
A simple cross fade shader for Unity  (0) 2014.04.22
어플을 내렸을때, 어플을 종료할때의 처리  (3) 2014.04.04
Posted by blueasa
, |


[심심풀이 주식강좌]


반응형

'재테크 > 주식' 카테고리의 다른 글

밑꼬리 양봉과 음봉  (0) 2014.06.18
실전 최적 매수패턴 22선  (0) 2014.06.18
이동평균선  (0) 2014.06.12
키움증권 영웅문을 통한 스탑로스(Stoploss) 사용 방법  (0) 2014.05.28
[링크] 주식투자 프로젝트  (0) 2014.04.01
Posted by blueasa
, |


Link : http://speckyboy.com/2013/12/09/top-50-free-icon-sets-2013/

반응형

'Utility' 카테고리의 다른 글

카카오톡 PC버전 광고제거 for Windows  (2) 2014.09.21
눈의 건강과 숙면을 위한 프로그램 'f.lux'  (0) 2014.09.21
Dual Monitor Tools  (0) 2014.02.25
lingoes-extractor(ld2 to txt)  (0) 2014.01.06
Dina Programming Font in TTF format  (0) 2013.02.15
Posted by blueasa
, |




ScreenWipe_For_CSharp.zip





참조 : http://wiki.unity3d.com/index.php?title=CrossFade


출처 : http://answers.unity3d.com/questions/166898/screenwipe-crossfade-with-c.html

반응형

'Unity3D > Script' 카테고리의 다른 글

ClipboardHelper  (0) 2014.05.15
유니티 코루틴 깊이 알고 재미있게 쓰기.  (0) 2014.05.09
A simple cross fade shader for Unity  (0) 2014.04.22
어플을 내렸을때, 어플을 종료할때의 처리  (3) 2014.04.04
Unity Singleton  (0) 2014.03.24
Posted by blueasa
, |

The other day I was putting some polish to Deathfire‘s character generation and we wanted to fade character portraits from one to another when the player makes his selections. Unlike hard cuts, cross fades simply add a bit of elegance to the program that we did not want to miss.

I went through Unity’s documentation and very quickly came across its Material.Lerp function. Just what I needed, I thought, but after a quick implementation it turned out it didn’t do what I had had in mind. I had not read the function description properly, because what it does, is blend between the parameters of two materials and not the actual image the material creates. Since I am working with a texture atlas, this gave me a cool scrolling effect as my material lerped from one end of the atlas to the other but not the kind of cross fade I had had in mind.

It turns out that Unity doesn’t really have the functionality, so I dug a bit deeper and found Ellen’s approach to blending textures. A quick check of her sources showed me that it still did not do what I wanted, but it gave me a good basis to start from as I began writing my own implement of a simple cross fader.

It all starts with the shader itself, which takes two textures without a normal map and renders them on top of another. A variable tells the shader how transparent the top texture should be so we can adjust it on the fly and gradually blend from the first texture to the second. The key feature for my approach was that the shader uses UV coordinates for each of the textures to allow me to use the shader with a texture atlas.

Shader "CrossFade"
{
  Properties
  {
    _Blend ( "Blend", Range ( 0, 1 ) ) = 0.5
    _Color ( "Main Color", Color ) = ( 1, 1, 1, 1 )
    _MainTex ( "Texture 1", 2D ) = "white" {}
    _Texture2 ( "Texture 2", 2D ) = ""
  }

  SubShader
  {
    Tags { "RenderType"="Opaque" }
    LOD 300
    Pass
    {
      SetTexture[_MainTex]
      SetTexture[_Texture2]
      {
        ConstantColor ( 0, 0, 0, [_Blend] )
        Combine texture Lerp( constant ) previous
      }    
    }
  
    CGPROGRAM
    #pragma surface surf Lambert
    
    sampler2D _MainTex;
    sampler2D _Texture2;
    fixed4 _Color;
    float _Blend;
    
    struct Input
    {
      float2 uv_MainTex;
      float2 uv_Texture2;
    };
    
    void surf ( Input IN, inout SurfaceOutput o )
    {
      fixed4 t1  = tex2D( _MainTex, IN.uv_MainTex ) * _Color;
      fixed4 t2  = tex2D ( _Texture2, IN.uv_Texture2 ) * _Color;
      o.Albedo  = lerp( t1, t2, _Blend );
    }
    ENDCG
  }
  FallBack "Diffuse"
}

The second part of the implementation is the C# script that will drive the actual cross fade. It is pretty straight-forward and consists of an initialization function Start(), an Update() function that is called periodically and adjusts the blend factor for the second texture until the fade is complete. And then, of course, there is a function CrossFadeTo() that you call to set up the respective cross fade.

using UnityEngine;
using System.Collections;

public class CrossFade : MonoBehaviour
{
  private Texture    newTexture;
  private Vector2    newOffset;
  private Vector2    newTiling;
  
  public  float    BlendSpeed = 3.0f;
  
  private bool    trigger = false;
  private float    fader = 0f;
  
  void Start ()
  {
    renderer.material.SetFloat( "_Blend", 0f );
  }
  
  void Update ()
  {
    if ( true == trigger )
    {
      fader += Time.deltaTime * BlendSpeed;
      
      renderer.material.SetFloat( "_Blend", fader );
      
      if ( fader >= 1.0f )
      {
        trigger = false;
        fader = 0f;
        
        renderer.material.SetTexture ("_MainTex", newTexture );
        renderer.material.SetTextureOffset ( "_MainTex", newOffset );
        renderer.material.SetTextureScale ( "_MainTex", newTiling );
        renderer.material.SetFloat( "_Blend", 0f );
      }
    }
  }
  
  public void CrossFadeTo( Texture curTexture, Vector2 offset, Vector2 tiling )
  {
    newOffset = offset;
    newTiling = tiling;
    newTexture = curTexture;
    renderer.material.SetTexture( "_Texture2", curTexture );
    renderer.material.SetTextureOffset ( "_Texture2", newOffset );
    renderer.material.SetTextureScale ( "_Texture2", newTiling );
    trigger = true;
  }
}

The script also contains a public variable called BlendSpeed, which is used to determine how quickly the fade will occur. Smaller numbers will result in slower fades, while larger numbers create more rapid cross fades.

In order to use these scripts, all you have to do is add the shader and the script to your Unity project. Attach the C# script to the object you want to perform the cross fade and then from your application simply call CrossFadeTo() with proper texture parameters to make it happen. That is all there really is to it.


  CrossFade bt = gameObject.GetComponent();
  bt.CrossFadeTo( myTexture, myUVOffset, myScale );

I hope some of you may find this little script useful.

- See more at: http://guidohenkel.com/2013/04/a-simple-cross-fade-shader-for-unity/#comment-125802



출처 : http://networkedblogs.com/Kx9ce

반응형
Posted by blueasa
, |

ObjectPool

Unity3D/Extensions / 2014. 4. 22. 18:02

[File] Unity 5.6.3 기준

ObjectPool_withNGUI.unitypackage



[추가] by blueasa

- NGUI에 쓰기 위해 NGUI 맞게 수정 및 추가(NGUI 3.11.4 기준)

- PreLoad 기능 추가




출처 : http://unitypatterns.com/resource/objectpool/

반응형

'Unity3D > Extensions' 카테고리의 다른 글

Extension Methods  (0) 2014.08.18
Nullable Types  (0) 2014.08.18
인스펙터 상의 GUI를 비활성화 시키고 싶을 때..  (0) 2014.04.02
Save Scene while on play mode  (0) 2014.01.12
Auto-Save Scene on Run  (0) 2014.01.12
Posted by blueasa
, |

static bool BuildAssetBundle(Object mainAsset, Object[] assets, string pathName, uint crcBuildAssetBundleOptionsassetBundleOptions = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,BuildTarget targetPlatform = BuildTarget.WebPlayer);

 이 함수를 사용해서 애셋번들을 생성하면 crc값을 얻을 수 있는데요 애셋번들에 포함되어있는 애셋들의 변경 사항이 있는 경우에 저 값이 변하더라고요. 이전에 만든 번들과 crc값이 다르면 수정된거라고 보고 패치를 진행하는 방식으로 구현했습니다.



반응형
Posted by blueasa
, |

링크 : http://funsmartlife.com/rf-card-blocker/


반응형
Posted by blueasa
, |