欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

材质测试数据

程序员文章站 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;




相关标签: 材质测试