'공부 > 프로그래밍' 카테고리의 다른 글

페이스북(Meta) 테스트 광고 관련(iOS)  (0) 2023.12.27

using UnityEngine;
using System.Collections;

public class EyeTrackBlink : MonoBehaviour
{
   
    public float eyeMaxOffset = 0.3f; // max amount the eyes are clamped to
    public Renderer eyeRend; // eyeball renderer
    public Renderer lidRend; // eyelid renderer
    public float blinkingTextureAmount = 4f; // amount of frames of blinking animation
    public float blinkTimer = 4f; // timer for when to blink again
    public float blinkTransition = 0.05f;
    Vector2 eyeOffset;
    Vector2 eyelidOffset;
    float blinkOffset;
    float blinkTimerR;
   
    void Start()
    {
        blinkTimerR = blinkTimer;
        blinkOffset = 1 / blinkingTextureAmount;
        eyelidOffset = new Vector2(0,0);
        lidRend.materials[1].SetTextureScale("_MainTex", new Vector2(blinkOffset, 1));

    }
    void Update()
    {
        blinkTimerR -= Time.deltaTime;
        if (blinkTimerR <= 0.0f)
        {
            StartCoroutine(Blink());

        }
      
        eyeOffset = new Vector2(transform.localPosition.x, -transform.localPosition.y);
           // clamp so the eye doesnt disappear  
        if(eyeOffset.x < -eyeMaxOffset || eyeOffset.x > eyeMaxOffset)
        {
            eyeOffset.x = Mathf.Clamp(eyeOffset.x, -eyeMaxOffset, eyeMaxOffset);
        }
         if(eyeOffset.y < -eyeMaxOffset || eyeOffset.y > eyeMaxOffset)
        {
            eyeOffset.y = Mathf.Clamp(eyeOffset.y, -eyeMaxOffset, eyeMaxOffset);
        }
       // send offset to shader
        eyeRend.material.SetTextureOffset("_MainTex", eyeOffset);
        
    }

    IEnumerator Blink()
    {
        // animating 1 - 2 - 3 - 4 - 3 - 1, if you have more or less blinking animation frames, add or delete them here
        blinkTimerR = blinkTimer + Random.Range(-1,1); // slight randomisation to the blinking
        lidRend.materials[1].SetTextureOffset("_MainTex", eyelidOffset); //1
        yield return new WaitForSeconds(blinkTransition);
        lidRend.materials[1].SetTextureOffset("_MainTex", new Vector2(eyelidOffset.x + blinkOffset, 0)); //2
        yield return new WaitForSeconds(blinkTransition);
        lidRend.materials[1].SetTextureOffset("_MainTex", new Vector2(eyelidOffset.x + (blinkOffset * 2), 0)); //3
        yield return new WaitForSeconds(blinkTransition);
        lidRend.materials[1].SetTextureOffset("_MainTex", new Vector2(eyelidOffset.x + (blinkOffset * 3), 0)); //4
        yield return new WaitForSeconds(blinkTransition);
        lidRend.materials[1].SetTextureOffset("_MainTex", new Vector2(eyelidOffset.x + (blinkOffset * 2), 0)); //3
        yield return new WaitForSeconds(blinkTransition);
        lidRend.materials[1].SetTextureOffset("_MainTex", eyelidOffset); //1
       

    }
}

 

 

출처 : https://twitter.com/minionsart/status/948235509825966080

 

Joyce[MinionsArt] on Twitter

“Using SetTextureOffset to animate a texture sheet, and track an object with eyes in #unity3d, like in Legend of Zelda - Twilight Princess #gamedev #unitytips #indiedev Sample code in first reply More stuff > https://t.co/FqAsMb9Plg https://t.co/9ES4iBrsX1

twitter.com

 

- 추가

위 자료처럼 분리해서 위치를 잡아준 뒤, Unity Timeline상에서 Material의 Offset값을 애니메이션하여 적용함

 

출처 - https://docs.unity3d.com/Manual/ExecutionOrder.html

==================================================================================

매번 유니티 홈페이지까지 가서 찾기 귀찮아서 긁어옴


출처 - https://docs.unity3d.com/Manual/CollidersOverview.html

 

 

출처 - http://tsubakit1.hateblo.jp/entry/2016/09/28/235632

 

Encoding Format Description
L Luminance-only
LA Luminance with transparency
L+A Luminance with uncorrelated transparency
X+Y Surface normals
RGB Full color
XY+Z Surface normals with uncorrelated Z
RGBA Full color with transparency
RGB+A Full color with uncorrelated transparency

출처 - https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression#Hardware_support

Block size

(WxH)

BPP
4x4 8.00
5x4 6.40
5x5 5.12
6x5 4.27
6x6 3.56
8x5 3.20
8x6 2.67
10x5 2.56
10x6 2.13
8x8 2.00
10x8 1.60
10x10 1.28
12x10 1.07
12x12 0.89

 

 

출처 - https://www.khronos.org/opengl/wiki/ASTC_Texture_Compression

 

 모든 OpenGL ES 3.2 및 OpenGL ES 3.1+AEP GPU와 일부 OpenGL ES 3.0 GPU에서 지원합니다

{

Supported by Windows, Linux, Android (since version 5.0) on devices with appropriate hardware and drivers,[45] including:

  • Adreno 400 series[46][47]
  • Adreno 500 series (Mesa 18.1 for Linux and Android)
  • AMD Terascale and actual GCN-architecture (Windows, Linux (r600, radeonSI))
  • Intel HD Graphics for Intel Atom Z3700 series (Android)
  • Intel HD Graphics for Intel Celeron N and J series (Android)
  • Intel HD Graphics for Intel Pentium N and J series (Android)
  • Intel HD Graphics Haswell and higher (Linux Mesa: previous Ivy Bridge nearly without stencil texturing)[48]
  • Mali T6xx (midgard) series onwards[49] (Android, Linux)
  • Nvidia GeForce 400 series onwards (Windows, Linux)
  • Nvidia Tegra K1 (Android, Linux)
  • Nvidia Tegra X1 (Android)
  • PowerVR Series 6, 6XE, 6XT, 7XE and 7XT (Linux, Android)
  • Vivante GC2000 series onwards (optional with GC800 and GC1000)[50]
  • v3d: Driver for Broadcom ARM raspberry in Mesa (Linux)
  • VIRGL: virtual Driver for virtual machines in 2018 with Mesa 18.1 (See Mesamatrix.net)
  • LLVMpipe: software driver in Mesa 20.2 (Linux)
  • softpipe: software driver in Mesa 20.3 (Linux)
  • Zink: emulation driver in Mesa 21.1 (Linux)

출처 - https://en.wikipedia.org/wiki/OpenGL_ES

}

 

ETC2, PVRTC에 비해 실용적.

 

자세한 사항은 추후에 체크 후 업로드 예정

'공부' 카테고리의 다른 글

jar plugin exclude BuildConfig  (0) 2021.12.13
git ignore 목록 사이트  (0) 2019.01.09
ios Push 관련 코드 저장용  (1) 2017.06.16
git branch 삭제 후 복구 하기  (0) 2017.05.17
game mechanic explorer  (0) 2017.01.31


Mac Path: ~/Library/Caches/Unity/

Windows path: C:\Users\\AppData\LocalLow\Unity\WebPlayer\Cache\



출처 : http://answers.unity3d.com/questions/956259/where-is-the-cache-folder-for-wwwloadfromcacheordo.html

- 기사 발췌 -
음. 게임을 단순한 상품으로만 여기지 말고, 철학을 가지고 만들어 주셨으면 좋겠어요. 탈출구가 없는 아이들은 업계에 있는 분들이 상상하는 것 이상으로 게임을 통해 많은 것을 하거든요.

http://www.thisisgame.com/webzine/news/nboard/5/?n=73755


+ Recent posts