国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Unity中Shader的Standard材質(zhì)解析(二)

這篇具有很好參考價(jià)值的文章主要介紹了Unity中Shader的Standard材質(zhì)解析(二)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。


前言

Unity中Shader的Standard材質(zhì)解析(二),對(duì) Standard 的 PBR 的 GI 進(jìn)行解析

  • Unity中Shader的Standard材質(zhì)解析(一)

一、我們對(duì) Standard 的 PBR 的 GI 進(jìn)行解析

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

1、我們先創(chuàng)建一個(gè)PBR的.cginc文件,用于整理用到的函數(shù)

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

2、然后在Standard的Shader中引用該cginc文件

#include “CGInclude/MyPhysicallyBasedRendering.cginc”


二、依次整理函數(shù)到該cginc文件中

  • 整理 LightingStandard_GI1(o, giInput, gi); 中的數(shù)據(jù)

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • Unity_GlossyEnvironmentData表示GI中的反射準(zhǔn)備數(shù)據(jù)

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 準(zhǔn)備好反射數(shù)據(jù)后,計(jì)算得出GI中的 漫反射 和 鏡面反射

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 輸出漫反射看看效果

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎
unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 輸出鏡面反射看看效果

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 我們可以自定義一下Cubemap,看看不同的反射效果

(這就是PBR的優(yōu)點(diǎn),可以根據(jù)不同的環(huán)境,直接呈現(xiàn)效果,不用再根據(jù)環(huán)境調(diào)節(jié)參數(shù))

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

我們來看一下PBR中GI的鏡面反射做了些什么

  • 這個(gè)程序塊只會(huì)在,反射探針中開啟Box Projection時(shí),才會(huì)運(yùn)行

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎
unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎
這選項(xiàng)的作用是:使用反射探針的物體在移動(dòng)時(shí),效果不會(huì)變,只有在攝像機(jī)方向變時(shí),效果才會(huì)變化。那么,要讓物體動(dòng)時(shí),反射效果同時(shí)改變的話,就需要開啟該選項(xiàng)。

  • 在取消了材質(zhì)的Reflection后,會(huì)運(yùn)行該程序塊
  • 反之,運(yùn)行之后的部分

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 在開啟反射效果后,對(duì)于感性粗糙度的計(jì)算。
  • 在Unity中的粗糙度,使用分級(jí)貼圖來模擬粗糙度(節(jié)省性能)

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

  • 由于粗糙度與反射探針的mip變化不呈現(xiàn)線性正比,所以需要一個(gè)公式來改變

//r = r * (1.7 - 0.7r)
perceptualRoughness = perceptualRoughness
(1.7 - 0.7*perceptualRoughness);

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

在Blender中,粗糙度是按數(shù)值改變的:
unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

在Unity中,反射探針是按貼圖分級(jí)來模擬的粗糙度:

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎

unity材質(zhì)球standard格式,Unity,unity,材質(zhì),游戲引擎文章來源地址http://www.zghlxwxcb.cn/news/detail-766691.html


二、最終代碼

.cginc代碼:

#ifndef MYPHYSICALLYBASERENDERING_INCLUDE
    #define MYPHYSICALLYBASERENDERING_INCLUDE

    half3 Unity_GlossyEnvironment1 (UNITY_ARGS_TEXCUBE(tex), half4 hdr, Unity_GlossyEnvironmentData glossIn)
    {
        half perceptualRoughness = glossIn.roughness /* perceptualRoughness */ ;

        // TODO: CAUTION: remap from Morten may work only with offline convolution, see impact with runtime convolution!
        // For now disabled
        #if 0
        float m = PerceptualRoughnessToRoughness(perceptualRoughness); // m is the real roughness parameter
        const float fEps = 1.192092896e-07F;        // smallest such that 1.0+FLT_EPSILON != 1.0  (+1e-4h is NOT good here. is visibly very wrong)
        float n =  (2.0/max(fEps, m*m))-2.0;        // remap to spec power. See eq. 21 in --> https://dl.dropboxusercontent.com/u/55891920/papers/mm_brdf.pdf

        n /= 4;                                     // remap from n_dot_h formulatino to n_dot_r. See section "Pre-convolved Cube Maps vs Path Tracers" --> https://s3.amazonaws.com/docs.knaldtech.com/knald/1.0.0/lys_power_drops.html

        perceptualRoughness = pow( 2/(n+2), 0.25);      // remap back to square root of real roughness (0.25 include both the sqrt root of the conversion and sqrt for going from roughness to perceptualRoughness)
        #else
        // MM: came up with a surprisingly close approximation to what the #if 0'ed out code above does.
        //r = r * (1.7 - 0.7*r)
        //由于粗糙度與反射探針的mip變化不呈現(xiàn)線性正比,所以需要一個(gè)公式來改變
        perceptualRoughness = perceptualRoughness*(1.7 - 0.7*perceptualRoughness);
        #endif

        //UNITY_SPECCUBE_LOD_STEPS = 6,表示反射探針的mip級(jí)別有 6 檔。粗糙度X6得到最終得mip級(jí)別
        half mip = perceptualRoughnessToMipmapLevel(perceptualRoughness);
        half3 R = glossIn.reflUVW;
        half4 rgbm = UNITY_SAMPLE_TEXCUBE_LOD(tex, R, mip);

        return DecodeHDR(rgbm, hdr);
    }



    //GI中的鏡面反射
    inline half3 UnityGI_IndirectSpecular1(UnityGIInput data, half occlusion, Unity_GlossyEnvironmentData glossIn)
    {
        half3 specular;
        //如果開啟了反射探針的Box Projection
        #ifdef UNITY_SPECCUBE_BOX_PROJECTION
        // we will tweak reflUVW in glossIn directly (as we pass it to Unity_GlossyEnvironment twice for probe0 and probe1), so keep original to pass into BoxProjectedCubemapDirection
        half3 originalReflUVW = glossIn.reflUVW;
        glossIn.reflUVW = BoxProjectedCubemapDirection (originalReflUVW, data.worldPos, data.probePosition[0], data.boxMin[0], data.boxMax[0]);
        #endif

        #ifdef _GLOSSYREFLECTIONS_OFF
        specular = unity_IndirectSpecColor.rgb;
        #else
        half3 env0 = Unity_GlossyEnvironment1 (UNITY_PASS_TEXCUBE(unity_SpecCube0), data.probeHDR[0], glossIn);
        //如果開啟了反射探針混合
        #ifdef UNITY_SPECCUBE_BLENDING
        const float kBlendFactor = 0.99999;
        float blendLerp = data.boxMin[0].w;
        UNITY_BRANCH
        if (blendLerp < kBlendFactor)
        {
            #ifdef UNITY_SPECCUBE_BOX_PROJECTION
            glossIn.reflUVW = BoxProjectedCubemapDirection (originalReflUVW, data.worldPos, data.probePosition[1], data.boxMin[1], data.boxMax[1]);
            #endif

            half3 env1 = Unity_GlossyEnvironment (UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1,unity_SpecCube0), data.probeHDR[1], glossIn);
            specular = lerp(env1, env0, blendLerp);
        }
        else
        {
            specular = env0;
        }
        #else
        specular = env0;
        #endif
        #endif

        return specular * occlusion;
    }


    inline UnityGI UnityGlobalIllumination1 (UnityGIInput data, half occlusion, half3 normalWorld)
    {
        return UnityGI_Base(data, occlusion, normalWorld);
    }
    //GI計(jì)算
    inline UnityGI UnityGlobalIllumination1 (UnityGIInput data, half occlusion, half3 normalWorld, Unity_GlossyEnvironmentData glossIn)
    {
        //計(jì)算得出GI中的漫反射
        UnityGI o_gi = UnityGI_Base(data, occlusion, normalWorld);
        //計(jì)算得出GI中的鏡面反射
        o_gi.indirect.specular = UnityGI_IndirectSpecular1(data, occlusion, glossIn);
        return o_gi;
    }
    float SmoothnessToPerceptualRoughness1(float smoothness)
    {
        return (1 - smoothness);
    }
    Unity_GlossyEnvironmentData UnityGlossyEnvironmentSetup1(half Smoothness, half3 worldViewDir, half3 Normal, half3 fresnel0)
    {
        Unity_GlossyEnvironmentData g;
        //粗糙度
        g.roughness /* perceptualRoughness */   = SmoothnessToPerceptualRoughness1(Smoothness);
        //反射球的采樣坐標(biāo)
        g.reflUVW   = reflect(-worldViewDir, Normal);

        return g;
    }

    //PBR光照模型的GI計(jì)算
    inline void LightingStandard_GI1(
        SurfaceOutputStandard s,
        UnityGIInput data,
        inout UnityGI gi)
    {
        //如果是延遲渲染PASS并且開啟了延遲渲染反射探針的話
        #if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS
        gi = UnityGlobalIllumination1(data, s.Occlusion, s.Normal);
        #else

        //Unity_GlossyEnvironmentData表示GI中的反射準(zhǔn)備數(shù)據(jù)
        Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup1(s.Smoothness, data.worldViewDir, s.Normal,
                                                                    lerp(unity_ColorSpaceDielectricSpec.rgb, s.Albedo,
                                                                         s.Metallic));
        //進(jìn)行GI計(jì)算并返回輸出gi
        gi = UnityGlobalIllumination1(data, s.Occlusion, s.Normal, g);
        #endif
    }


#endif

Shader代碼:

//Standard材質(zhì)
Shader "MyShader/P2_2_5"
{
    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        [NoScaleOffset]_MetallicTex("Metallic(R) Smoothness(G) AO(B)",2D) = "white" {}
        [NoScaleOffset][Normal]_NormalTex("NormalTex",2D) = "bump" {}
        
        _Glossiness ("Smoothness", Range(0,1)) = 0.0
        _Metallic ("Metallic", Range(0,1)) = 0.0
        _AO("AO",Range(0,1)) = 1.0
    }
    SubShader
    {
        Tags
        {
            "RenderType"="Opaque"
        }
        LOD 200

        // ---- forward rendering base pass:
        Pass
        {
            Name "FORWARD"
            Tags
            {
                "LightMode" = "ForwardBase"
            }

            CGPROGRAM
            // compile directives
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 3.0
            #pragma multi_compile_instancing
            #pragma multi_compile_fog
            #pragma multi_compile_fwdbase

            #include "UnityCG.cginc"
            #include "Lighting.cginc"
            #include "UnityPBSLighting.cginc"
            #include "AutoLight.cginc"
            #include "CGInclude/MyPhysicallyBasedRendering.cginc"
                
            sampler2D _MainTex;
            float4 _MainTex_ST;
            half _Glossiness;
            half _Metallic;
            fixed4 _Color;
            sampler2D _MetallicTex;
            half _AO;
            sampler2D _NormalTex;
            
            struct appdata
            {
                float4 vertex : POSITION;
                float4 tangent : TANGENT;
                float3 normal : NORMAL;
                float4 texcoord : TEXCOORD0;
                float4 texcoord1 : TEXCOORD1;
                float4 texcoord2 : TEXCOORD2;
                float4 texcoord3 : TEXCOORD3;
                fixed4 color : COLOR;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            // vertex-to-fragment interpolation data
            // no lightmaps:
            struct v2f
            {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0; // _MainTex
                float3 worldNormal : TEXCOORD1;
                float3 worldPos : TEXCOORD2;
                #if UNITY_SHOULD_SAMPLE_SH
                    half3 sh : TEXCOORD3; // SH
                #endif
                //切線空間需要使用的矩陣
                float3 tSpace0 : TEXCOORD4;
                float3 tSpace1 : TEXCOORD5;
                float3 tSpace2 : TEXCOORD6;

                UNITY_FOG_COORDS(7)
                UNITY_SHADOW_COORDS(8)
            };

            // vertex shader
            v2f vert(appdata v)
            {
                v2f o;

                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
                float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
                float3 worldNormal = UnityObjectToWorldNormal(v.normal);

                //世界空間下的切線
                half3 worldTangent = UnityObjectToWorldDir(v.tangent);
                //切線方向
                half tangentSign = v.tangent.w * unity_WorldTransformParams.w;
                //世界空間下的副切線
                half3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign;
                //切線矩陣
                o.tSpace0 = float3(worldTangent.x, worldBinormal.x, worldNormal.x);
                o.tSpace1 = float3(worldTangent.y, worldBinormal.y, worldNormal.y);
                o.tSpace2 = float3(worldTangent.z, worldBinormal.z, worldNormal.z);

                o.worldPos.xyz = worldPos;
                o.worldNormal = worldNormal;

                // SH/ambient and vertex lights

                #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
                    o.sh = 0;
                    // Approximated illumination from non-important point lights
                #ifdef VERTEXLIGHT_ON
                    o.sh += Shade4PointLights (
                    unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
                    unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
                    unity_4LightAtten0, worldPos, worldNormal);
                #endif
                    o.sh = ShadeSHPerVertex (worldNormal, o.sh);
                #endif


                UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy);

                UNITY_TRANSFER_FOG(o, o.pos); // pass fog coordinates to pixel shader

                return o;
            }

            // fragment shader
            fixed4 frag(v2f i) : SV_Target
            {
                UNITY_EXTRACT_FOG(i);
                
                float3 worldPos = i.worldPos.xyz;
                
                float3 worldViewDir = normalize(UnityWorldSpaceViewDir(worldPos));

                SurfaceOutputStandard o;
                UNITY_INITIALIZE_OUTPUT(SurfaceOutputStandard, o);

                fixed4 mainTex = tex2D(_MainTex, i.uv);
                o.Albedo = mainTex.rgb * _Color;

                o.Emission = 0.0;

                fixed4 metallicTex = tex2D(_MetallicTex, i.uv);
                o.Metallic = metallicTex.r * _Metallic;
                o.Smoothness = metallicTex.g * _Glossiness;
                o.Occlusion = metallicTex.b * _AO;
                o.Alpha = 1;


                half3 normalTex = UnpackNormal(tex2D(_NormalTex,i.uv));
                half3 worldNormal = half3(dot(i.tSpace0,normalTex),dot(i.tSpace1,normalTex),dot(i.tSpace2,normalTex));
                o.Normal = worldNormal;


                // compute lighting & shadowing factor
                UNITY_LIGHT_ATTENUATION(atten, i, worldPos)

                // Setup lighting environment
                UnityGI gi;
                UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
                gi.indirect.diffuse = 0;
                gi.indirect.specular = 0;
                gi.light.color = _LightColor0.rgb;
                gi.light.dir = _WorldSpaceLightPos0.xyz;
                // Call GI (lightmaps/SH/reflections) lighting function
                UnityGIInput giInput;
                UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
                giInput.light = gi.light;
                giInput.worldPos = worldPos;
                giInput.worldViewDir = worldViewDir;
                giInput.atten = atten;
                #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
                    giInput.lightmapUV = IN.lmap;
                #else
                giInput.lightmapUV = 0.0;
                #endif
                #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
                    giInput.ambient = i.sh;
                #else
                giInput.ambient.rgb = 0.0;
                #endif
                giInput.probeHDR[0] = unity_SpecCube0_HDR;
                giInput.probeHDR[1] = unity_SpecCube1_HDR;
                #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
                    giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
                #endif
                #ifdef UNITY_SPECCUBE_BOX_PROJECTION
                    giInput.boxMax[0] = unity_SpecCube0_BoxMax;
                    giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
                    giInput.boxMax[1] = unity_SpecCube1_BoxMax;
                    giInput.boxMin[1] = unity_SpecCube1_BoxMin;
                    giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
                #endif
                
                LightingStandard_GI1(o, giInput, gi);
                
                //return fixed4(gi.indirect.specular,1);
                
                // PBS的核心計(jì)算
                fixed4 c = LightingStandard(o, worldViewDir, gi);
                
                UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog
                UNITY_OPAQUE_ALPHA(c.a); //把c的Alpha置1
                return c;
            }
            ENDCG

        }
    }

}

到了這里,關(guān)于Unity中Shader的Standard材質(zhì)解析(二)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Unity | Shader(著色器)和material(材質(zhì))的關(guān)系

    Unity | Shader(著色器)和material(材質(zhì))的關(guān)系

    一、前言 在上一篇文章中 【精選】Unity | Shader基礎(chǔ)知識(shí)(什么是shader)_unity shader_菌菌巧樂茲的博客-CSDN博客 我們講了什么是shader,今天我們講一下shder和material的關(guān)系 二、在unity中shader的本質(zhì) unity中,shader就是一串代碼,如下圖shader(就是一個(gè)平平無奇的shader) 但是,這個(gè)sh

    2024年02月02日
    瀏覽(22)
  • Unity中C#如何訪問并修改Shader材質(zhì)

    Unity中C#如何訪問并修改Shader材質(zhì)

    我們寫好Shader后,很多效果是需要結(jié)合腳本來控制顯示的。我們?cè)谶@篇文章中,使用C#腳本來訪問修改材質(zhì)中的屬性,來體驗(yàn)一下腳本怎么控制Shader材質(zhì)在游戲中互動(dòng)時(shí)變化 我們 OnGUI 這個(gè)生命周期函數(shù)中,進(jìn)行操作 void OnGUI() { } 使用GUI.Button(position,text);可以繪制一個(gè)按鈕 pu

    2024年02月04日
    瀏覽(20)
  • Unity中C#使用協(xié)程控制Shader材質(zhì)變化

    Unity中C#使用協(xié)程控制Shader材質(zhì)變化

    在上一篇文章實(shí)現(xiàn)了C#腳本簡單修改Shader材質(zhì)的效果后,我們使用按鈕點(diǎn)擊結(jié)合協(xié)程來實(shí)現(xiàn)一下游戲中角色常見的效果:受擊、中毒、消融效果 我們繼續(xù)使用上一篇的 Shader 和 C# 腳本來繼續(xù)測試 Unity中C#如何訪問并修改Shader材質(zhì) Unity中的協(xié)程可以理解為 C# 中多線程的作用,在

    2024年02月04日
    瀏覽(27)
  • 【Unity Shader】從入門到領(lǐng)悟(1)基本概念:什么是網(wǎng)格?什么是材質(zhì)和Shader?

    【Unity Shader】從入門到領(lǐng)悟(1)基本概念:什么是網(wǎng)格?什么是材質(zhì)和Shader?

    如上圖,模型的三角形面就叫做網(wǎng)格(Mesh),網(wǎng)格的本質(zhì)是一堆頂點(diǎn)數(shù)據(jù)的規(guī)則排序,在Unity和UE中由三角形表示,Maya等DCC軟件(Digital Content Creation)中則通常由四邊形表示(倆個(gè)三角形剛好組成一個(gè)四邊形)。 在Unity中我們新建一個(gè)Cube,

    2024年02月06日
    瀏覽(20)
  • 【Unity Shader】從入門到感慨(1)基本概念:什么是網(wǎng)格?什么是材質(zhì)和Shader?

    【Unity Shader】從入門到感慨(1)基本概念:什么是網(wǎng)格?什么是材質(zhì)和Shader?

    如上圖,模型的三角形面就叫做網(wǎng)格(Mesh),網(wǎng)格的本質(zhì)是一堆頂點(diǎn)數(shù)據(jù)的規(guī)則排序,在Unity和UE中由三角形表示,Maya等DCC軟件(Digital Content Creation)中則通常由四邊形表示(倆個(gè)三角形剛好組成一個(gè)四邊形)。 在Unity中我們新建一個(gè)Cube,

    2024年02月11日
    瀏覽(21)
  • 【unity shader】水體渲染基礎(chǔ)-基于texture distortion的流體流動(dòng)材質(zhì)

    【unity shader】水體渲染基礎(chǔ)-基于texture distortion的流體流動(dòng)材質(zhì)

    當(dāng)液體靜止時(shí),它在視覺上與固體沒有太大區(qū)別。 但大多數(shù)時(shí)候,我們的性能不一定支持去實(shí)現(xiàn)特別復(fù)雜的水物理模擬, 需要的只是在常規(guī)的靜態(tài)材料的表面上讓其運(yùn)動(dòng)起來。我們可以對(duì)網(wǎng)格的 UV 坐標(biāo)實(shí)現(xiàn)動(dòng)態(tài)變化,從而讓表面的紋理效果實(shí)現(xiàn)變形的動(dòng)態(tài)變化。 1.1. uv實(shí)時(shí)

    2024年02月03日
    瀏覽(28)
  • 【Unity100個(gè)實(shí)用小技巧】如何修改UI上材質(zhì)的Shader

    【Unity100個(gè)實(shí)用小技巧】如何修改UI上材質(zhì)的Shader

    ??博客主頁:CSDN博客主頁 ??本文由 萌萌的小木屋 原創(chuàng),首發(fā)于 CSDN ?? ??學(xué)習(xí)專欄推薦:面試匯總 ??游戲框架專欄推薦:游戲?qū)嵱每蚣軐???點(diǎn)贊 ?? 收藏 ?留言 ??,如有錯(cuò)誤請(qǐng)指正 ?? 未來很長,值得我們?nèi)Ρ几案篮玫纳? ------------------??分割線?

    2024年02月14日
    瀏覽(40)
  • 《Unity的URP項(xiàng)目中使用自定義shader導(dǎo)致材質(zhì)消失的解決辦法》

    《Unity的URP項(xiàng)目中使用自定義shader導(dǎo)致材質(zhì)消失的解決辦法》

    ????????在Unity中使用URP時(shí),會(huì)有需求使用自定義的一些shader來實(shí)現(xiàn)特殊效果,這時(shí)如果我們直接使用新建材質(zhì)與無光照著色器(Unlit shader),可能會(huì)發(fā)生一個(gè)對(duì)于新手而言意料之外的問題—— 物體!消失了! ????????打開你正在使用的的 通用渲染器(Universal Rendere

    2024年02月06日
    瀏覽(194)
  • Unity極坐標(biāo)Shader特效,以及使用Instanced Property實(shí)現(xiàn)相同材質(zhì)不同參數(shù)

    Unity極坐標(biāo)Shader特效,以及使用Instanced Property實(shí)現(xiàn)相同材質(zhì)不同參數(shù)

    先看看效果 Unity極坐標(biāo)Shader特效 有時(shí)候我們需要在場景中擺放一些熱點(diǎn),用戶點(diǎn)擊之后出現(xiàn)互動(dòng),當(dāng)然實(shí)現(xiàn)這個(gè)功能的方法有很多,作為一名程序員,當(dāng)然是要用最簡單的實(shí)現(xiàn)。用shader程序化實(shí)現(xiàn)它。 啥是極坐標(biāo) 極坐標(biāo),又稱極座標(biāo)系。它是一種表示平面直角坐標(biāo)系中點(diǎn)的

    2024年02月09日
    瀏覽(22)
  • unity游戲破解 修改粒子材質(zhì)

    unity游戲破解 修改粒子材質(zhì)

    游戲漢化 遇到一個(gè) 比較文化差異的 問題? 最近從google play 逆向一個(gè)殺人游戲 準(zhǔn)備漢化 處理 其中游戲殺人的效果 血是紅色的 那這時(shí)候小朋友的家長就要說了呀?。。。。?! 哎呀? 這游戲太血腥 太暴力啦 不行 不能讓娃娃玩 ?。。。?那沒辦法呀 改 改 改 首先呢 這血的效果

    2023年04月08日
    瀏覽(32)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包