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

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
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
04-26 17:51

[요약]

1) Tags { "Queue"="Transparent" "RenderType" = "Opaque" }

2) #pragma surface surf Lambert alpha

 

----------------------------------------------------------------------------

Three steps:

Add objects rendered with this shader to the Transparent queue by adding “Queue”=“Transparent” to the subshader’s Tags list.
Add “alpha” to the surface function declaration, after the lighting function declaration, so the line becomes “#pragma surface surf Lambert alpha”
Actually set the alpha to something in the surface function, i.e. set o.Alpha = whatever you want.
I have done these modifications and used the _ColorTint’s alpha channel in the example. Then the shader becomes this:

 

Shader "-smn-/GlowingBorder" {
    Properties {
       _ColorTint("ColorTint", Color) = (1,1,1,1)
       _MainTex("Main Texture", 2D) = "white" {}
       _BumpMap("Normal Map", 2D) = "bump" {}
       _RimColorOuter("Rim Color Outer", Color) = (1,1,1,1)
       _RimColorInner("Rim Color Inner", Color) = (1,1,1,1)
       _RimPowerOuter("Rim Power Outer", Range(0.0, 7.0)) = 3.0
       _RimPowerInner("Rim Power Inner", Range(0.0, 20.0)) = 3.0
    }
    SubShader {
       Tags { "Queue"="Transparent" "RenderType" = "Opaque" }
 
 
       CGPROGRAM
       #pragma surface surf Lambert alpha
 
       struct Input {
         float4 color : COLOR;
         float2 uv_MainTex;
         float2 uv_BumpMap;
         float3 viewDir;
       };
 
       float4 _ColorTint;
       sampler2D _MainTex;
       sampler2D _BumpMap;
       float4 _RimColorOuter;
       float4 _RimColorInner;
       float _RimPowerOuter;
       float _RimPowerInner;
 
       void surf (Input IN, inout SurfaceOutput o) {
         IN.color = _ColorTint;
         o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * IN.color;
         o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
 		 o.Alpha = _ColorTint.a; // For example. Could also be the alpha channel on the interpolated vertex color (IN.color.a), or the one from the texture.
		
         half rimOuter = 1.0 -saturate(dot(normalize(IN.viewDir), o.Normal));
         half rimInner = saturate(dot(normalize(IN.viewDir), o.Normal));
         o.Emission = (_RimColorOuter.rgb * pow(rimOuter, _RimPowerOuter)) + (_RimColorInner.rgb * pow(rimInner, _RimPowerInner)) ;
       }
       ENDCG
    } 
    FallBack "Diffuse"
}

 

 

[출처] https://discussions.unity.com/t/how-can-i-add-alpha-channel-to-this-shader/100942

 

How can I add alpha-channel to this shader?

Hello, I have this shader that does not support alpha map. How can I modify it so I can adjust the alpha channel so as to be transparent? Thanks! Shader "-smn-/GlowingBorder" { Properties { _ColorTint("ColorTint", Color) = (1,1,1,1) _MainTex("Main Texture"

discussions.unity.com

 

 

반응형
Posted by blueasa
, |

[링크] https://liveupdate.tistory.com/308

 

[unity3d] 서피스 쉐이더 정리

ShaderLab : http://liveupdate.tistory.com/336 Unity3D 쉐이더 레퍼런스 : https://docs.unity3d.com/kr/530/Manual/SL-Reference.html 서피스 쉐이더 Shader "이름" {Properties {_프로퍼티("이름", 타입) = 값} Subshaders {Tags {// 유니티

liveupdate.tistory.com

 

반응형
Posted by blueasa
, |

유니티 (Unity)에서 멀티 키 딕셔너리 (Multi Key Dictionary)를 사용하는 방법에 대해 검색 결과를 제공해드리겠습니다.

멀티 키 딕셔너리는 두 개 이상의 키로 값을 저장하고 검색할 수 있는 자료구조입니다. 유니티에서는 기본적으로 이러한 기능을 제공하지 않지만, 다음과 같은 방법을 사용하여 멀티 키 딕셔너리를 구현할 수 있습니다:

Tuple을 사용한 멀티 키 딕셔너리 구현: Tuple을 이용하여 여러 키를 하나의 키로 묶고, 해당 키에 대한 값을 딕셔너리에 저장하는 방식입니다. 이렇게 하면 여러 키로 값을 조회하거나 저장할 수 있습니다.

using System;
using System.Collections.Generic;

public class MultiKeyDictionary<TKeyTuple, TValue>
{
    private Dictionary<TKeyTuple, TValue> dictionary = new Dictionary<TKeyTuple, TValue>();

    public void Add(TKeyTuple keys, TValue value)
    {
        dictionary[keys] = value;
    }

    public bool TryGetValue(TKeyTuple keys, out TValue value)
    {
        return dictionary.TryGetValue(keys, out value);
    }
}

// 사용 예시
var multiKeyDict = new MultiKeyDictionary<(int, string), int>();
multiKeyDict.Add((1, "key1"), 100);
multiKeyDict.Add((2, "key2"), 200);

if (multiKeyDict.TryGetValue((1, "key1"), out int result))
{
    Debug.Log("Value found: " + result);
}


C# 9의 init-only 프로퍼티와 튜플 사용: C# 9부터 init-only 프로퍼티를 사용하여 딕셔너리의 값을 읽기 전용으로 설정하고, 튜플을 활용하여 멀티 키를 표현할 수 있습니다.

using System;
using System.Collections.Generic;

public class MultiKeyDictionary<TValue>
{
    private Dictionary<(int, string), TValue> dictionary = new Dictionary<(int, string), TValue>();

    public void Add(int key1, string key2, TValue value)
    {
        dictionary[(key1, key2)] = value;
    }

    public IReadOnlyDictionary<(int, string), TValue> Dictionary => dictionary;
}

// 사용 예시
var multiKeyDict = new MultiKeyDictionary<int>();
multiKeyDict.Add(1, "key1", 100);
multiKeyDict.Add(2, "key2", 200);

if (multiKeyDict.Dictionary.TryGetValue((1, "key1"), out int result))
{
    Debug.Log("Value found: " + result);
}

이렇게 유니티에서 멀티 키 딕셔너리를 구현할 수 있습니다. 코드는 예시일 뿐이며, 실제 프로젝트에서 적절한 방식으로 적용하셔야 합니다.

 

[출처] ChatGPT

 

[참조] https://stackoverflow.com/questions/1171812/multi-key-dictionary-in-c

 

Multi-key dictionary in c#?

I know there isn't one in the BCL but can anyone point me to a good opensource one? By Multi I mean 2 keys. ;-)

stackoverflow.com

 

 

반응형
Posted by blueasa
, |

[링크] https://github.com/agens-no/iMessageStickerUnity

 

GitHub - agens-no/iMessageStickerUnity: An iMessage Sticker plugin for Unity3d that adds a Sticker extension target to an xCode

An iMessage Sticker plugin for Unity3d that adds a Sticker extension target to an xCode project created by Unity3d - GitHub - agens-no/iMessageStickerUnity: An iMessage Sticker plugin for Unity3d t...

github.com

 

 

반응형
Posted by blueasa
, |

[링크] https://hanamoni.tistory.com/31

 

Unity - Dictionary 를 Inspector 에 간단하게..

유니티에서 사용하는 Dictionary 는 Inspector 에서 보이지 않아서 데이터 확인해야 할때 불편하다. 그래서 이미 사용하고 있는 Dictionary 데이터들을 간단하게 인스펙터에 표시하기 위해서 만든 클래

hanamoni.tistory.com

 

 

반응형
Posted by blueasa
, |

[파일]

Transparent - Cutout ChromakeyShader.shader
0.00MB

 

[링크] https://seokiki0413.tistory.com/1

 

[Unity] Chromakey 동영상 투명하게 플레이 하는 Tip

유니티에서 동영상 배경을 투명하게 처리하는 방법은 Shader를 이용해서 합니다.Shader란 정의를 찾아보았으나 없었고,제가 생각하기에 Shader란 자바스크립트 계열의 일종으로 보입니다.(제 생각)

seokiki0413.tistory.com

 

 

반응형
Posted by blueasa
, |



반응형
Posted by blueasa
, |

 [링크] http://lancekun.com/blog/?p=599

 

안드로이드 Gradle / IL2CPP 환경에서 프로세스 남는 현상 – 랜스군의 게임공작소

유니티2018.3.12 에서gradle로 빌드시에 Application.Quit 으로 종료이후 다시 재실행시 UnityIAP 초기화가 실패하는 경우가 있습니다. 대략적으로 Inventory를 갱신시켜준후 Java프록시 호출이 실패하는 이슈(

lancekun.com

 

반응형
Posted by blueasa
, |

[추가]

아래 방법은 Mono 전용으로IL2CPP에서는 런타임 오류가 난다.

IL2CPP 빌드로 바껴서 현재는 사용 못할 것 같다.

-----------------------------------------------------------------

 

System.Diagnostics.ProcessThreadCollection pt = System.Diagnostics.Process.GetCurrentProcess().Threads;
foreach (System.Diagnostics.ProcessThread p in pt)
{
    p.Dispose();
}
System.Diagnostics.Process.GetCurrentProcess().Kill();

 

[링크] https://chopchops.tistory.com/17

 

[Unity] 게임 재실행시 튕기는 오류

게임을 재시작했을때 게임이 갑자기 꺼지는 기이한 현상 해결 1 ) 게임이 종료될때 모든 Thread가 종료되지 않아서 발생하는 문제라는 의견 -> 게임종료시 모든 스레드 종료 1 2 3 4 5 6 7 8 9 10 11 privat

chopchops.tistory.com

 

[참조1] https://202psj.tistory.com/1341

 

[Unity] 유니티 종료,Quit, Exit 관련

================================= ================================= ================================= 출처: https://hyunity3d.tistory.com/386 using UnityEngine; using System.Collections; public class CsGameManager : MonoBehaviour { // Use this for initia

202psj.tistory.com

[참조2] https://blog.naver.com/captainj/221103098214

 

Application.Quit으로 앱종료시 오류 메시지가 뜰때

종종 유니티에서 Application.Quit() 함수로 앱을 종료하는 경우, 앱은 정상적으로 종료는 되지만 오류 ...

blog.naver.com

 

반응형
Posted by blueasa
, |

Unity 2021.3.32f1

----

 

[추가3] 2024-03-27

Play Asset Delivery v1.9.0(2024-03-27 기준 최신)이 업데이트 됐다.

1.9.0은 최소 Unity 버전이 2017.4로 표기돼있다.(버전별 문제를 해결한건가..?)

 

[추가2]

AssetDelivery 1.7.0으로 iOS 빌드 하면서 ./GooglePlayPlugins/com.google.play.assetdelivery/Samples 폴더 관련 소스에서 에러가 나서 삭제 함.

 

[추가]

aab파일 150mb 초과해서 구글스토어 올리려고 알아보고

아래 [링크]의 내용대로 진행해서  Play Asset Delivery v1.8.2(2023-04-25 기준 최신)를 설치해서 빌드해보니,

빌드는 잘 되지만 실행하면 크래시 나면서 앱이 죽는다.

버전 정보를 보면 Play Asset Delivery v1.8.0 이상부터는 Unity 최소 버전이 2023.1.0 (베타)이다.

(1.8.0이상은 2023.1.0 이상이라고 돼있지만 2022.2.18f1에서 정상동작 하는걸 확인했다.)

 

[참조] https://github.com/google/play-unity-plugins/issues/187

 

Crash at Android 12 · Issue #187 · google/play-unity-plugins

Hello I'm now experiencing crash on android devices with Android 12 only. thread.cc:2372] Throwing new exception 'No interface method getPackStates(Ljava/util/List;)Lcom/google/android/play/core/ta...

github.com

 

크래시 내용을 찾아보니 위[참조]와 같은 내용이 있다.

Firebase와 PAD(Play Asset Delevery)와 호환성 문제가 있는 것 같다.

 

참조 링크의 내용대로면 현재 Play Asset Delivery v1.8.x 버전은 제대로 안되고, Play Asset Delivery v1.7.0을 사용해서 성공했다고 한다.

 

[Github:Play Unity Plugins v1.7.0] https://github.com/google/play-unity-plugins/releases/tag/v1.7.0

 

Release v1.7.0 · google/play-unity-plugins

com.google.play.integrity (v1.0.0) New Features Initial release Unchanged Packages com.google.android.appbundle (v1.7.0) com.google.play.appupdate (v1.7.0) com.google.play.assetdelivery (v1.7.0)...

github.com

[Google Play:Play Asset Delivery] https://developers.google.com/unity/archive?hl=ko#play_asset_delivery

 

Unity용 Google 패키지 다운로드  |  Google Developers

이 페이지는 Cloud Translation API를 통해 번역되었습니다. Switch to English Unity용 Google 패키지 다운로드 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 이 보관 파

developers.google.com

 

위 Play Asset Delivery 링크에서 1.7.0버전 UnityPackage를 다운로드해서 Import하고,

정상 빌드 되는 것을 확인했다.

 

[결론]

Unity 2021 이하 Play Asset Delivery 1.7.0을 사용하고,

Unity 2022 이상은 Play Asset Delivery 1.8.2(2023-05-12 기준 최신)을 사용하자.

(Unity 2021에서도 gradle 4.2.0을 적용하면 Play Asset Delivery 1.8.2 이상을 사용할 수 있다.

  2024-03-27 기준 1.9.0이 나와있으니 1.9.0을 사용하자.)

 

 

--------------------------------------------------------------------------------------------------------------------------------------------

 

[링크] https://devgod.tistory.com/49

 

[Unity] Unity Play Asset Delivery 앱 빌드, Unity 대용량 앱 빌드

2021년 8월부터 Google Play Store에선 obb를 이용한 대용량 앱 업로드가 사라지고, 무조건 Play Asset Delivery(PAD)를 통해 앱을 업로드 해야합니다. 제발 정책좀 그만 변경했으면 좋겠습니다. 먼저 제가 궁

devgod.tistory.com

반응형
Posted by blueasa
, |