近期热门
粉丝7
关注 0
获赞 0
关于U3D heatdistort效果的问题

[问答] 关于U3D heatdistort效果的问题

[复制链接]
4276 5 0 0 8年前 举报
场景里面有个贴图还上了热扭曲效果,draw calls 没有爆炸,显示也正常
因为Ngui的问题,我直接吧图片丢进U3D场景,附于了Heat的材质,一切正常,也不卡
但是打包,地图走到有热扭曲的地方就卡的飞起这是为啥?百度了半天也没结果
0
点赞
0
打赏
0
添加到收藏夹

0

点击复制链接

使用微信扫码分享
一次扣10个券
全部评论5
您需要登录后才可以回帖 登录 | 立即注册

dreameng 发表于 2015-12-14 19:19
不是太懂代码  大神能否帮忙看一下?
Shader "HeatDistort_WLJ" {
Properties {

我也不懂代码的亲,我也遇到掉帧严重的问题,我们程序说是这个问题,觉得你还是请教下程序的好

8年前
回复

使用道具 举报

{:1_337:}
8年前
回复

使用道具 举报

白银 发表于 2015-12-14 18:00
打开shader看代码,里面硬挨有检测gpu3.0的一行代码,如果有那个的话在移动端掉帧会很厉害

不是太懂代码  大神能否帮忙看一下?
Shader "HeatDistort_WLJ" {
Properties {
        _TintColor ("Tint Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "black" {}
_CutOut ("Alpha Mask", 2D) = "black" {}
        _BumpMap ("Normalmap", 2D) = "bump" {}
_ColorStrength ("Color Strength", Float) = 1
_BumpAmt ("Distortion", Float) = 10
_InvFade ("Soft Particles Factor", Range(0,10)) = 1.0
}

Category {

Tags { "Queue"="Transparent"  "IgnoreProjector"="True"  "RenderType"="Opaque" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off}

SubShader {
GrabPass {
Name "BASE"
Tags { "LightMode" = "Always" }
  }
Pass {
Name "BASE"
Tags { "LightMode" = "Always" }

CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_particles
#include "UnityCG.cginc"

struct appdata_t {
float4 vertex : POSITION;
float2 texcoord: TEXCOORD0;
fixed4 color : COLOR;
};

struct v2f {
float4 vertex : POSITION;
float4 uvgrab : TEXCOORD0;
float2 uvbump : TEXCOORD1;
float2 uvmain : TEXCOORD2;
float2 uvcutout : TEXCOORD3;
fixed4 color : COLOR;
#ifdef SOFTPARTICLES_ON
float4 projPos : TEXCOORD4;
#endif
};

sampler2D _MainTex;
sampler2D _CutOut;
sampler2D _BumpMap;

float _BumpAmt;
float _ColorStrength;
sampler2D _GrabTexture;
float4 _GrabTexture_TexelSize;
fixed4 _TintColor;


float4 _BumpMap_ST;
float4 _MainTex_ST;
float4 _CutOut_ST;

v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
#ifdef SOFTPARTICLES_ON
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
#endif
o.color = v.color;
#if UNITY_UV_STARTS_AT_TOP
float scale = -1.0;
#else
float scale = 1.0;
#endif
o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
o.uvgrab.zw = o.vertex.zw;
o.uvbump = TRANSFORM_TEX( v.texcoord, _BumpMap );
o.uvmain = TRANSFORM_TEX( v.texcoord, _MainTex );
o.uvcutout = TRANSFORM_TEX( v.texcoord, _CutOut );

return o;
}

sampler2D _CameraDepthTexture;
float _InvFade;

half4 frag( v2f i ) : COLOR
{
#ifdef SOFTPARTICLES_ON
if(_InvFade > 0.0001) {
float sceneZ = LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))));
float partZ = i.projPos.z;
float fade = saturate (_InvFade * (sceneZ-partZ));
i.color.a *= fade;
}
#endif
half2 bump = UnpackNormal(tex2D( _BumpMap, i.uvbump )).rg;
float2 offset = bump * _BumpAmt * _GrabTexture_TexelSize.xy;
i.uvgrab.xy = offset * i.uvgrab.z + i.uvgrab.xy;

half4 col = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(i.uvgrab));
fixed4 tex = tex2D(_MainTex, i.uvmain) * i.color;
fixed4 cut = tex2D(_CutOut, i.uvcutout) * i.color;
fixed4 emission = col * i.color + tex * _ColorStrength * _TintColor;
    emission.a = _TintColor.a * i.color.a * (cut.a);
return emission;
}
ENDCG
}
}

SubShader {
Blend DstColor Zero
Pass {
Name "BASE"
SetTexture [_MainTex] { combine texture }
}
}
}

}

8年前
回复

使用道具 举报

打开shader看代码,里面硬挨有检测gpu3.0的一行代码,如果有那个的话在移动端掉帧会很厉害
8年前
回复

使用道具 举报

是不是我哪边没勾上或者选择性错误?
QQ图片20151214170939.png
8年前
回复

使用道具 举报

您当前使用的浏览器IE内核版本过低会导致网站显示错误

请使用高速内核浏览器或其他浏览器