材质测试数据
程序员文章站
2022-03-04 12:33:57
...
_frag:
#pragma arguments
float a=1.0;
float3 cameraPosition=float3(0,0,0);
texturecube<float> sTexture;
#pragma body
float4 eyePosition=normalize(float4(_surface.view,1.0));
//eyePosition=-eyePosition;
float4 newNormal=normalize(float4(_surface.normal,1.0));
//newNormal=-newNormal;
constexpr sampler s(address::repeat);//filter::linear,mip_filter::linear,
float4 vTextureCoord=refract(eyePosition,newNormal,0.85);
//float4 vTextureCoord=reflect(eyePosition,newNormal);
float4 finalColor=sTexture.sample(s,vTextureCoord.xyz);//yzx
//_output.color=finalColor*a;
float3 lightDirection=float3(1.0);
_lightingContribution.ambient=float3(0.88);
_lightingContribution.diffuse=max(dot(lightDirection,-_surface.normal),0.0);
float3 hV=normalize(lightDirection)+normalize(_surface.view);
_lightingContribution.specular=float3(pow(max(dot(normalize(hV),-_surface.normal),0.0),50)*1.0);
_output.color.xyz=(finalColor.xyz*_lightingContribution.ambient+finalColor.xyz*_lightingContribution.diffuse+finalColor.xyz*_lightingContribution.specular)*a;;
_geom:
_geometry.normal=-_geometry.normal;
上一篇: C# 判断数组中是否存在某个值
下一篇: C#中判断服务器图片是否存在