shader model 3.0下载3.0地址下载给一个,我...

各位大神帮忙看下我的shader为何不能编译target3.0
网上下载了一个shader 机子#pragma target 3.0就报错了726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" style="max-width:726max-height:700" title="点击查看原图" onclick="if(this.parentNode.tagName!='A') window.open('/forum/attachment/1511/thread/2_3a31d77a1b.jpg');" />我的unity是4.3.4,显卡726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" style="max-width:726max-height:700" title="点击查看原图" onclick="if(this.parentNode.tagName!='A') window.open('/forum/attachment/1511/thread/2_548ba9393.jpg');" />,在Edit--Graphic Emulation--Shader Model 3也设置了,为何会报错啊。求大神指点
要评论请先&或者&
我发现不是shader 3.0的问题,是没法获取我自定义的cginc文档,怎么破??我把代码贴出来cginc文件#ifndef MY_FUNCS_CGINC#define MY_FUNCS_CGINCstruct MyLightingInfo {
float4 lightD
float4 lightC //};float4 DoLightDir_Atten (float4 lightPos, float4 worldSpaceVertex) {
float4 lightDir = float4(0,0,0,0);
if (lightPos.w ==0)
lightDir.xyz = lightP
lightDir.w = 1.0;
else //Point/Spot//为点光源
lightDir.xyz = (lightPos - worldSpaceVertex).
lightDir.w = 1/(1+length(lightDir.xyz));
lightDir.xyz = normalize(lightDir.xyz);
return lightD} float4 DoMyLighting(MyLightingInfo info) { //计算灯光的照明
float diff = max(0,dot(info.vNormal, info.lightDir.xyz));
float4 c = info.lightColor *diff *info.lightDir.a;
}shader代码
Tags {&LightMode& = &ForwardBase&}
#pragma vertex vert
#pragma fragment frag
#include &UnityCG.cginc&
#include &MyFuncs.cginc&
#pragma multi_compile _fwdbase
#include &Lighting.cginc&
struct vertOut {
float4 pos : SV_POSITION;
float4 color : COLOR;
vertOut vert (appdata_base v) {
float3 n = (mul(float4(v.normal,0.0), _World2Object)).xyz
n = normalize(n);
float4 lightD
float4 diffColor = float4(0,0,0,0);
float4 worldSpaceVertex = mul(_Object2World, v.vertex);
float4 myLightPos = _WorldSpaceLightPos0;
myLightPos = DoLightDir_Atten(myLightPos,worldSpaceVertex);
MyLightingI
info.vNormal =
info .lightDir = myLightP
info.lightColor = _LightColor0;
diffColor = DoMyLighting(info);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = diffC
float4 frag (vertOut i) :COLOR {
& &FallBack &Diffuse&}
对shader不太了解

参考资料

 

随机推荐