欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Unity3D Shader實現(xiàn)動態(tài)星空

 更新時間:2020年04月29日 11:52:55   作者:忘夕  
這篇文章主要為大家詳細介紹了Unity3D Shader實現(xiàn)動態(tài)星空,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Unity3D Shader實現(xiàn)動態(tài)星空的具體代碼,供大家參考,具體內(nèi)容如下

Shader "Unlit/Test"
{
Properties
{
[Gamma][Header(CubeMap)]_MainColor("MainColor",COLOR)=(0.5,0.5,0.5,1)
_Spec("Spec",Range(1,8))=1
[NoScaleOffset]_Tex("CubeMap",CUBE)="black"{}
[Header(Rotation)][Toggle(_ENABLEROTATION_ON)]_EnableRotation("Enable Rotation",Float)=0
[IntRange]_Rotation("Rotation",Range(0,360))=0
_RotationSpeed("RotationSpeed",float)=1
[Header(Fog)][Toggle(_ENABLEFOG_ON)]_EnableFog("Enable Fog",float)=0
_FogHeight("FogHeight",Range(0,1))=1
_FogSmooth("FogSmooth",Range(0.01,1))=0.01
_FogHill("FogHill",Range(0,1))=0.5
 
 
}
SubShader
{
Tags { "RenderType"="Background" "Queue"="Background" "IgnoreProjector"="True" "ForceNoShadowCasting"="True"}
LOD 100
Cull Off
ZWrite Off
CGPROGRAM
#include "UnityShaderVariables.cginc"
#include "UnityCG.cginc"
#pragma target 3.0
#pragma shader_feature _ENABLEROTATION_ON
#pragma shader_feature _ENABLEFOG_ON
#pragma surface surf Lint keepalpha noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nofog nometa noforwardadd vertex:vertexRo
 
 
struct Input
{
float3 worldPos;
float3 vertextofrag;
};
 
 
uniform float4 _MainColor;
uniform float _Spec;
uniform samplerCUBE _Tex;
uniform half _Rotation;
uniform half _RotationSpeed;
uniform half _FogHeight;
uniform half _FogSmooth;
uniform half _FogHill;
uniform half4 _Tex_HDR;
 
 
half3 decode_HDR(half4 data)
{
return DecodeHDR(data,_Tex_HDR);
}
void vertexRo(inout appdata_full v,out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o);
float3 _worldPos=mul(unity_ObjectToWorld,v.vertex);
float _lerpResult=lerp(1.0,(unity_OrthoParams.y/unity_OrthoParams.x),unity_OrthoParams.w);
float3 _append=float3(_worldPos.x,_worldPos.y*_lerpResult,_worldPos.z);
float3 _nor_append=normalize(_append);
float _timeMove=_Time.y;
float3 _timeMove1=float3(cos(radians(_Rotation+_timeMove*_RotationSpeed)),0,sin(radians(_Rotation+_timeMove*_RotationSpeed))*-1);
float3 _timeMove2=float3(0,_lerpResult,0);
float3 _timeMove3=float3(sin(radians(_Rotation+_timeMove*_RotationSpeed)),0,cos(radians(_Rotation+_timeMove*_RotationSpeed)));
float3 _nor_worldPos=normalize(_worldPos);
#ifdef _ENABLEROTATION_ON 
o.vertextofrag=mul(float3x3(_timeMove1,_timeMove2,_timeMove3),_nor_worldPos);
#else
o.vertextofrag=_nor_append;
#endif
 
 
}
fixed4 LightingLint(SurfaceOutput s,float3 lightDir,float atten)
{
return fixed4(0,0,0,s.Alpha);
}
void surf(Input i,inout SurfaceOutput o)
{
half4 CUBEdata=texCUBE(_Tex,i.vertextofrag);
half3 CUBEdataHDR=decode_HDR(CUBEdata);
float4 CUBEColor=(float4(CUBEdataHDR,0))*_MainColor*_Spec*unity_ColorSpaceDouble;
float3 _nor_worldPos=normalize(i.worldPos);
float _lerpFog=lerp(saturate(pow(_nor_worldPos.y/_FogHeight,1-_FogSmooth)),0,_FogHill);
float4 FinalColor=lerp(unity_FogColor,CUBEColor,_lerpFog);
#ifdef _ENABLEFOG_ON
o.Emission=FinalColor.rgb;
#else
o.Emission=CUBEColor.rgb;
#endif
o.Alpha=1;
 
 
}
ENDCG
}
 
}

Spec:亮度

Rotation:開始旋轉(zhuǎn)角度,可以調(diào)節(jié)

RotationSpeed:旋轉(zhuǎn)速度

Fog開頭:霧化效果,可以看算法實現(xiàn)

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C# 實現(xiàn)連連看功能(推薦)

    C# 實現(xiàn)連連看功能(推薦)

    本文是利用C#實現(xiàn)連連看的小例子,使用線程thread實現(xiàn)后臺運行時間控制,實現(xiàn)代碼簡單易懂,非常不錯,具有參考借鑒價值,需要的朋友參考下吧
    2017-07-07
  • C#中Property和Attribute的區(qū)別實例詳解

    C#中Property和Attribute的區(qū)別實例詳解

    這篇文章主要介紹了C#中Property和Attribute的區(qū)別,較為詳細的分析了C#中Property和Attribute的功能、定義、區(qū)別及使用時的相關(guān)注意事項,需要的朋友可以參考下
    2015-06-06
  • C# ManualResetEvent使用方法詳解

    C# ManualResetEvent使用方法詳解

    這篇文章主要為大家詳細介紹了ManualResetEvent使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-05-05
  • C#實現(xiàn)順序表(線性表)完整實例

    C#實現(xiàn)順序表(線性表)完整實例

    這篇文章主要介紹了C#實現(xiàn)順序表(線性表)的方法,結(jié)合完整實例形式分析了順序表的原理及C#相關(guān)實現(xiàn)技巧,需要的朋友可以參考下
    2016-06-06
  • C#?網(wǎng)域賬號(Domain)驗證的實現(xiàn)

    C#?網(wǎng)域賬號(Domain)驗證的實現(xiàn)

    本文主要介紹了C#?網(wǎng)域賬號(Domain)驗證的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友們下面隨著小編來一起學(xué)習學(xué)習吧
    2024-04-04
  • C# MemoryStream類案例詳解

    C# MemoryStream類案例詳解

    這篇文章主要介紹了C# MemoryStream類案例詳解,本篇文章通過簡要的案例,講解了該項技術(shù)的了解與使用,以下就是詳細內(nèi)容,需要的朋友可以參考下
    2021-08-08
  • unity實現(xiàn)物體延時出現(xiàn)

    unity實現(xiàn)物體延時出現(xiàn)

    這篇文章主要為大家詳細介紹了unity實現(xiàn)物體延時出現(xiàn),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-04-04
  • C#實現(xiàn)圖像銳化的方法

    C#實現(xiàn)圖像銳化的方法

    這篇文章主要介紹了C#實現(xiàn)圖像銳化的方法,涉及C#操作圖像的相關(guān)技巧,需要的朋友可以參考下
    2015-04-04
  • WPF實現(xiàn)類似ChatGPT逐字打印效果的示例代碼

    WPF實現(xiàn)類似ChatGPT逐字打印效果的示例代碼

    前一段時間ChatGPT類的應(yīng)用十分火爆,這類應(yīng)用在回答用戶的問題時逐字打印輸出,像極了真人打字回復(fù)消息,本文就來利用WPF模擬一下這種逐字打印的效果吧
    2023-08-08
  • 詳解C#批量插入數(shù)據(jù)到Sqlserver中的四種方式

    詳解C#批量插入數(shù)據(jù)到Sqlserver中的四種方式

    本文主要講解一下在Sqlserver中批量插入數(shù)據(jù)。文中大數(shù)據(jù)批量插入方式一和方式四盡量避免使用,而方式二和方式三都是非常高效的批量插入數(shù)據(jù)方式,需要的朋友可以看下
    2016-12-12

最新評論