浏览代码

Updated custom shaders

/lw-hw19-volume-env
André McGrail 5 年前
当前提交
6718afae
共有 6 个文件被更改,包括 18 次插入16 次删除
  1. 6
      Assets/Shaders/PackedPBR/InputSurfacePackedDialectric.hlsl
  2. 2
      Assets/Shaders/Vegetation/LWVegetationShader.shader
  3. 9
      Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl
  4. 2
      Packages/com.verasl.water-system/Shaders/WaterFXFoamOnly.shader
  5. 12
      Packages/com.verasl.water-system/Shaders/WaterLighting.hlsl
  6. 3
      Packages/com.verasl.water-system/Shaders/WaterTessellation.hlsl

6
Assets/Shaders/PackedPBR/InputSurfacePackedDialectric.hlsl


#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/SurfaceInput.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half4 _Color; // only temp
float4 _BaseMap_ST;
half4 _BaseColor; // only temp
half _Cutoff; // only temp
half _BumpScale;
CBUFFER_END

half4 albedoRoughness = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv);
half4 albedoRoughness = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv);
outSurfaceData.alpha = 1;
outSurfaceData.albedo = albedoRoughness.rgb;

2
Assets/Shaders/Vegetation/LWVegetationShader.shader


VertexPositionInputs vertexPosition = GetVertexPositionInputs(input.positionOS);
VertexNormalInputs vertexTBN = GetVertexNormalInputs(input.normalOS, input.tangentOS);
half3 vertexLight = VertexLighting(vertexPosition.positionWS, output.normal.xyz);
half fogFactor = ComputeFogFactor(vertexPosition.positionCS.z);
half fogFactor = ComputeFogFactor(vertexPosition);
half3 viewDir = GetCameraPositionWS() - vertexPosition.positionWS;
output.clipPos = vertexPosition.positionCS;

9
Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl


return data;
}
WaterVertexOutput WaveVertexOperations(WaterVertexOutput input)
WaterVertexOutput WaveVertexOperations(WaterVertexOutput input, VertexPositionInputs vertexInput)
{
input.normal = float3(0, 1, 0);
input.uv.zw = input.posWS.xz;

input.viewDir = SafeNormalize(_WorldSpaceCameraPos - input.posWS);
// Fog
input.fogFactorNoise.x = ComputeFogFactor(input.clipPos.z);
input.fogFactorNoise.x = ComputeFogFactor(vertexInput);
input.preWaveSP = screenUV.xyz; // pre-displaced screenUVs
// Additional data

UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
o.posWS = TransformObjectToWorld(v.vertex.xyz);
o.posWS = vertexInput.positionWS;
o = WaveVertexOperations(o);
o = WaveVertexOperations(o, vertexInput);
return o;
}

2
Packages/com.verasl.water-system/Shaders/WaterFXFoamOnly.shader


#define _NORMALMAP 1
#include "LWRP/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
struct appdata
{

12
Packages/com.verasl.water-system/Shaders/WaterLighting.hlsl


///////////////////////////////////////////////////////////////////////////////
//diffuse
half4 VertexLightingAndFog(half3 normalWS, half3 posWS, half3 clipPos)
{
half3 vertexLight = VertexLighting(posWS, normalWS);
half fogFactor = ComputeFogFactor(clipPos.z);
return half4(fogFactor, vertexLight);
}
//half4 VertexLightingAndFog(half3 normalWS, half3 posWS, half3 clipPos)
//{
// half3 vertexLight = VertexLighting(posWS, normalWS);
// half fogFactor = ComputeFogFactor(clipPos.z);
// return half4(fogFactor, vertexLight);
//}
//specular
half3 Highlights(half3 positionWS, half roughness, half3 normalWS, half3 viewDirectionWS)

3
Packages/com.verasl.water-system/Shaders/WaterTessellation.hlsl


float fW = BarycentricCoords.z;
float4 vertex = Input[0].vertex * fU + Input[1].vertex * fV + Input[2].vertex * fW;
VertexPositionInputs vertexInput = GetVertexPositionInputs(vertex.xyz);
o = WaveVertexOperations(o);
o = WaveVertexOperations(o, vertexInput);
return o;
}
正在加载...
取消
保存