- Home /
Shader Fallback Windows Store App
Hey guys,
I'm currently building a game for the windows store. I have a simple shader that always calls its FallBack shader once built into a Windows Store App. The shader works excellently in the editor and also on other devices but just not as a Windows Store App.
I have tried changing the the shader target model from 3.0 to both 4.0 & 5.0 with no results.
Shader "Reflective/Bumped Specular" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5,0.5,0.5,1)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
_PatTex ("Base (RGB) RefStrGloss (A)", 2D) = "white" {}
_Cube ("Reflection Cubemap", Cube) = "" { TexGen CubeReflect }
_BumpMap ("Normalmap", 2D) = "bump" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400
//CULL off
CGPROGRAM
#pragma surface surf BlinnPhong
#pragma target 3.0
sampler2D _PatTex;
sampler2D _BumpMap;
samplerCUBE _Cube;
fixed4 _Color;
fixed4 _ReflectColor;
half _Shininess;
struct Input {
float2 uv_PatTex;
float2 uv_BumpMap;
float3 worldRefl;
INTERNAL_DATA
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 tex = tex2D(_PatTex, IN.uv_PatTex);
o.Albedo = lerp(_ReflectColor, tex.rgb, tex.a ).rgb;
tex.a = 1.0f;
o.Gloss = tex.a;
o.Specular = _Shininess;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
float3 worldRefl = WorldReflectionVector (IN, o.Normal);
fixed4 reflcol = texCUBE (_Cube, worldRefl);
reflcol *= tex.a;
o.Emission = reflcol.rgb * _Color.rgb;
o.Alpha = reflcol.a * _Color.a;
}
ENDCG
}
FallBack "Reflective/Bumped Diffuse"
}
*** Any ideas?
I am also getting the same problem. Have you got any solution for this?
Answer by tswalk · Jun 21, 2014 at 05:33 AM
My guess, is that the device you are testing it on may not actually support SM3 or higher.. the default (and baseline requirement) for Windows Store Apps is SM2.0 4_0_level_9_1... or higher. And is therefore "falling back" to that which is probably compiled for everything under the sun.
So you probably will want to use the following pragma for testing:
#pragma only_renderers d3d11_9x d3d11
#pragma target 2.0
note: only_renderers is what I am currently using as I've restricted the shader only for windows devices (and in this case ARM [e.g.: surface RT]).
also, you can actually comment out the fallback while developing with that specific shader.
and finally, what you may need to do, (if you want to offer support for features in higher shader models), is to detect what the hardware actually supports that the game is running on and specify shaders at runtime.
hope that helps some.
I have windows 8.1, 64 bit. GeForce GT620$$anonymous$$, DirectX runtime version 11.0 It should support S$$anonymous$$3. I am not testing the build for AR$$anonymous$$. I am building for x86. Am I doing something wrong in building the package? Please suggest.
have you tried adding #pragma debug and commenting out the fallback?
also, there seems to already be a shader built in called "Reflective/Bumped Specular"... perhaps try a custom name like "Custom/$$anonymous$$yShaderTest", maybe there is some strange conflict.
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Strumpy Shader Editor - Can't view preview window 1 Answer
A node in a childnode? 1 Answer
What is the best way to deactivate ALL pro-shaders only from a project? 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers