Current Flash build doesn't seem to support point filtering (?) I would really like to know if: a) it can be enabled somehow in the developer preview b) it will be supported ever I have huge effort invested in a (future) Asset Store product which pretty much relies on point filtering. I was planning to take part in the Flash compo too. Even yes/no answer without any explanation would be very helpful at this point.
Code (csharp): Shader "Flashy/Nearest" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _TexWidth ("Texture width", Float) = 128.0 _TexHeight ("Texture height", Float) = 128.0 } SubShader { Tags { "Queue" = "Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Pass { ZWrite Off Cull off Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; float _TexWidth; float _TexHeight; struct VertOut { float4 position : POSITION; float4 color : COLOR; float4 texcoord : TEXCOORD0; }; struct VertIn { float4 vertex : POSITION; float4 color : COLOR; float4 texcoord : TEXCOORD0; }; VertOut vert(VertIn input) { VertOut output; output.position = mul(UNITY_MATRIX_MVP,input.vertex); output.color = input.color; output.texcoord = float4( input.texcoord.xy, 0, 0); return output; } struct FragOut { float4 color : COLOR; }; FragOut frag(VertIn input) { FragOut output; half4 texcol = tex2D(_MainTex, float2(float(int(input.texcoord.x * _TexWidth) + 0.5) / _TexWidth, float(int(input.texcoord.y * _TexHeight) + 0.5) / _TexHeight)); output.color = input.color * texcol; return output; } ENDCG } } FallBack "Diffuse" } I know it's xmas eve and all that, but I just couldn't let this be. Gotta give me some points for dedication This is a CG shader that emulates Unity "point"-filtering and works in Flash builds too. You have to provide the texture width and height in shader properties. I never wrote CG shader before in my life so any suggestions appreciated.
Thanks Keely! I was wondering about this too. It pretty much excluded me from the flash competition (though clearly I wasn't as dedicated as you about solving the problem).
There's no deep technical reason why point filtering doesn't work yet. It's just a bit of a hassle to implement, that's all (technical reason: filtering mode needs to be in the shader itself, so we need to patch AGAL pixel shaders depending on what filtering is used). We'll see whether we can do it for the initial real release, or whether that would have to come later.
Still not working out of the box in Unity 4.0.1 Any change this is going to be supported properly in 4.1? Update: Point filtering is actually properly supported. It appeared something odd was going on with an imported FBX file.