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

카테고리

분류 전체보기 (2741)
Unity3D (30)
Programming (475)
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 (54)
Android (15)
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
05-19 00:09

[요약]

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
, |

 

[출처] https://www.nl.go.kr/NL/onlineFileIdDownload.do?fileId=FILE-00013421076

 

반응형
Posted by blueasa
, |

[Crash 내용]

com.apple.root.default-qos SIGABRT ABORT 0x00000001e01bf4c4

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

 

오랜만에 iOS 빌드하는 프로젝트에서 빌드는 잘되는데 실행하니 일부 아이폰에서 위와 같은 크래시레포트를 뱉으면서 앱이 죽는다.

찾아보니 권한을 사용하려는데 Privacy Description이 없어서 죽는 것 같다.

이번에 내 경우는 NSUserTrackingUsageDescription 였는데,

어떤 Privacy Description이 없어서 크래시가 나는지는 본인이 체크하고 추가해줘야 될 것 같다.

 

 

[참조]

https://walkthinksleep.tistory.com/entry/Crashed-comapplerootdefaultqos-%EC%9D%B4%EC%8A%88

 

iOS, Crashed: com.apple.root.default-qos 이슈

crashed 1 times in __TCCAccessRequest_block_invoke.85! 라고 연락(?)이 왔고,Crashed: com.apple.root.default-qos 라고 Fabric이 얘기해줬다. 구글링을 해보면 주로 privacy에 관련된 내용이 생길때 나타나는 에러 같았다.

walkthinksleep.tistory.com

 

반응형
Posted by blueasa
, |

[추가] 2023-07-20

Unity 2022.3.5f1에서 이슈 해결된 것 확인함

(몇 버전부터 해결된건지는 확인 못함)

 

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

Unity 2022.2.18f1

Firebase 10.7.0

----

 

[빌드에러 #1]

> Configure project :unityLibrary
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'unityLibrary\build.gradle'


...

 

[빌드에러 #2]

Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.


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

 

 

Unity 2021에서 Unity 2022로 포팅하는 중에 위와 같은 빌드 에러가 떠서 찾아보니

Gradle 관련 Unity 2022 버그가 있는 것 같다.

 

[수정]

[참조] 링크 내용대로 아래와 같이 Gradle을 수정하고 정상적으로 빌드 되는 걸 확인 함.

간단히 정리하면 settingsTemplate.gradle에 있던 걸 baseProjectTemplate.gradle로 옮겨야 한다.

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

256p commented on Jan 24

Also, there is another workaround that keeps the Gradle version (in case some android lib requires it).
For that workaround, you will need to copy a file from /Applications/Unity/Hub/Editor/2022.2.3f1/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/settingsTemplate.gradle to Assets/Plugins/Android/settingsTemplate.gradle. That way Unity will use your template in Assets/Plugins/Android. (It's weird that Unity doesn't has a checkbox for that)
For my version of unity, it looks like that:

 

[Before] ../Assets/Plugins/Android/settingsTemplate.gradle

pluginManagement {
    repositories {
        **ARTIFACTORYREPOSITORY**
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

include ':launcher', ':unityLibrary'
**INCLUDES**

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

 

The conflicting part is RepositoriesMode.PREFER_SETTINGS. But you can safely delete the whole dependencyResolutionManagement block from here. Since the android project still needs to know about local dependencies, copy the repositories block, you will need it later.
Now settingsTemplate.gradle should look like this:

 

[After] ../Assets/Plugins/Android/settingsTemplate.gradle

pluginManagement {
    repositories {
        **ARTIFACTORYREPOSITORY**
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

include ':launcher', ':unityLibrary'
**INCLUDES**

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

Now in Project Settings > Player > Publishing Settings for Android enable Custom Base Gradle Template
Initially, it will look like that:

 

[Before] ../Assets/Plugins/Android/baseProjectTemplate.gradle

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    **BUILD_SCRIPT_DEPS**
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

Now create allprojects block and paste repositories copied in the settings template. As a result base template will look like that:

 

[After] ../Assets/Plugins/Android/baseProjectTemplate.gradle

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    **BUILD_SCRIPT_DEPS**
}

allprojects {
    repositories {
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

Now Gradle should build successfully.

 

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

 

[참조] https://github.com/googlesamples/unity-jar-resolver/issues/594

 

[Bug] Android Gradle project repositories block don't work for the latest Unity versions · Issue #594 · googlesamples/unity-ja

[REQUIRED] Please fill in the following fields: Unity editor version: 2022.2.2f1 External Dependency Manager version: 1.2.175 Source you installed EDM4U: .unitypackage Features in External Dependen...

github.com

 

 

반응형
Posted by blueasa
, |