Get it on Google Play


Wm뮤 :: 'Unity' 카테고리의 글 목록 (5 Page)

블로그 이미지
가끔 그림그리거나 3D모델링하거나
취미로 로봇만드는
퇴직한 전자과 게임프로그래머
2020.3.48f1 , 2022.3.6f1 주로 사용
모카쨩
@Ahzkwid

Recent Comment

Archive


'Unity'에 해당되는 글 181건

  1. 2023.01.20 스크린 오버레이 샘플
  2. 2023.01.16 유니티 스카이박스 관련
  3. 2022.06.18 유니티 창위치 설정
  4. 2022.04.30 유니티 csv 에셋
  5. 2022.04.24 유니티 차트
  6. 2022.04.23 유니티 Log 확인 에셋
  7. 2022.04.02 유니티 문자인식
  8. 2022.03.15 유니티 Mesh Boolean
2023. 1. 20. 07:49 Unity/shader

 

1:1

 

2:1 크롭

 

 

Shader "Ahzkwid/ScreenOverlay"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;
            float4 _MainTex_TexelSize;
            

            v2f vert (appdata v)
            {
                v2f o;
				o.uv = float4(TRANSFORM_TEX(v.uv, _MainTex),1,1);
				o.vertex.xy = o.uv;
				o.vertex.xy -= 0.5;
				o.vertex.xy *= 2;
				o.vertex.y = -o.vertex.y;
				o.vertex.zw = 1;

                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed2 uv=i.uv;
                
				float screenWid = _ScreenParams.x / _ScreenParams.y;
				float texelWid = _MainTex_TexelSize.z / _MainTex_TexelSize.w;
                if(screenWid>texelWid)
                {
                    uv.x*=screenWid;
			        uv.x -= screenWid / 2;
			        uv.x += texelWid / 2;
                    uv.x/=texelWid;
                }
                else
                {

				    float screenHei = 1/screenWid;
				    float texelHei = 1/texelWid;

                    uv.y*=screenHei;
			        uv.y -= screenHei / 2;
			        uv.y += texelHei / 2;
                    uv.y/=texelHei;
                }

                fixed4 col = tex2D(_MainTex, uv);
                col.a*=all(uv==saturate(uv));
                return lerp(0,col,col.a);
            }
            ENDCG
        }
    }
}

'Unity > shader' 카테고리의 다른 글

PerlinNoise HLSL  (0) 2023.04.25
유니티 스카이박스 관련  (0) 2023.01.16
함수 그래프 모음  (0) 2022.01.15
posted by 모카쨩
2023. 1. 16. 21:41 Unity/shader
Shader "Skybox/Sample"
{
    Properties
    {
        [NoScaleOffset] _Tex ("Cubemap   (HDR)", Cube) = "grey" {}
    }
    SubShader
    {
        Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                float3 texcoord : TEXCOORD0;
                UNITY_VERTEX_OUTPUT_STEREO
            };
            
            samplerCUBE _Tex;
            half4 _Tex_HDR;

            v2f vert (appdata v)
            {
                v2f o;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.texcoord = v.vertex.xyz;
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                half4 tex = texCUBE (_Tex, i.texcoord);
                fixed3 col = DecodeHDR (tex, _Tex_HDR);
                return half4(col, 1);
            }
            ENDCG
        }
    }
}

샘플코드

 

 

 

'Unity > shader' 카테고리의 다른 글

스크린 오버레이 샘플  (0) 2023.01.20
함수 그래프 모음  (0) 2022.01.15
Decal Shader  (0) 2022.01.13
posted by 모카쨩
2022. 6. 18. 10:37 Unity

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using System.Runtime.InteropServices;
using System;

public class WindowPosition : MonoBehaviour
{

    public int x = 0;
    public int y = 0;
#if UNITY_STANDALONE_WIN

    [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
    private static extern bool SetWindowPos(IntPtr hwnd, int hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);

    [DllImport("user32.dll", EntryPoint = "FindWindow")]
    public static extern IntPtr FindWindow(string className, string windowName);

    public IEnumerator SetWindowPosition(int x, int y)
    {
        yield return new WaitForEndOfFrame();
        yield return new WaitForEndOfFrame();
        SetWindowPos(FindWindow(null, Application.productName), 0, x, y, 0, 0, 5);
    }

    public IEnumerator SetWindowPosition(float x, float y)
    {
        StartCoroutine(SetWindowPosition(Screen.width * x, Screen.height * y));
        yield return null;
    }

#endif
    // Start is called before the first frame update
    void Start()
    {

#if UNITY_STANDALONE_WIN
        StartCoroutine(SetWindowPosition(x,y));

#endif
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

https://forum.unity.com/threads/setting-player-window-position.534733/

이쪽 소스를 간략화 한 버전으로 만들어봤다

 

 

 

윈도우모드 설정시

 

 

'Unity' 카테고리의 다른 글

유니티 파티클, 트레일, 라인 렌더러  (0) 2023.01.21
유니티 csv 에셋  (0) 2022.04.30
유니티 차트  (0) 2022.04.24
posted by 모카쨩
2022. 4. 30. 11:46 Unity

 

 

 

https://assetstore.unity.com/packages/tools/integration/csv-serialize-135763

 

CSV Serialize | 기능 통합 | Unity Asset Store

Use the CSV Serialize from VisualWorks on your next project. Find this integration tool & more on the Unity Asset Store.

assetstore.unity.com

 

 

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Demo : MonoBehaviour
{

    public Test[] tests;
    [System.Serializable]
    public class Test
    {
        public int num = 0;
        public string name = "";
    }
        // Start is called before the first frame update
    void Start()
    {

        var csv = "num,name\n0,\"mom\"\r\n1,dad\n\"2\",\"me\"\n\"3\",\"한국어\"";
        tests = CSVSerializer.Deserialize<Test>(csv);
        var list = CSVSerializer.ParseCSV(csv);
        for (int x = 0; x < list.Count; x++)
        {
            for (int y = 0; y < list[x].Length; y++)
            {
                Debug.Log($"[{x}][{y}]{list[x][y]}");
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

 

 

잘된다

'Unity' 카테고리의 다른 글

유니티 창위치 설정  (0) 2022.06.18
유니티 차트  (0) 2022.04.24
유니티 Log 확인 에셋  (0) 2022.04.23
posted by 모카쨩
2022. 4. 24. 01:16

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

2022. 4. 23. 12:18 Unity

 

 

Log Viewer

 

더보기

 

 

https://assetstore.unity.com/packages/tools/integration/log-viewer-12047

 

Log Viewer | 기능 통합 | Unity Asset Store

Use the Log Viewer from dreammakersgroup on your next project. Find this integration tool & more on the Unity Asset Store.

assetstore.unity.com

 

 

이녀석을 디버그빌드에서만 사용하게 온오프걸면 된다

반시계로 마우스를 돌리면 활성화된다

 

단점은 닫기버튼이 작은화면에선 안 보이고 뒤쪽 UGUI도 눌려버려서 기분 더럽다

 

 

 

 

In-game Debug Console

 

 

 

'Unity' 카테고리의 다른 글

유니티 차트  (0) 2022.04.24
유니티 문자인식  (0) 2022.04.02
유니티 Mesh Boolean  (0) 2022.03.15
posted by 모카쨩
2022. 4. 2. 12:23 Unity

 

 

 

https://github.com/Neelarghya/tesseract-unity

 

GitHub - Neelarghya/tesseract-unity: Standalone OCR plugin for Unity using Tesseract

Standalone OCR plugin for Unity using Tesseract. Contribute to Neelarghya/tesseract-unity development by creating an account on GitHub.

github.com

 

 

 

 

Main Scene을 열어서 돌려보면 된다

StreamingAssets는 경로참조를 하기 때문에 최상단에 있어야한다

 

 

 

이미지는 저걸 바꾸면 됨

간단하게 쓰려면 Display Text에서 text를 추출해도 된다

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

결과물

 

'Unity' 카테고리의 다른 글

유니티 Log 확인 에셋  (0) 2022.04.23
유니티 Mesh Boolean  (0) 2022.03.15
유니티 IOS 인터페이스  (0) 2022.02.25
posted by 모카쨩
2022. 3. 15. 15:00

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.


  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입