Author Topic: Space Game Starter Kit: Shaders not working  (Read 3672 times)

jfouch

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Space Game Starter Kit: Shaders not working
« on: July 19, 2014, 03:47:28 PM »
I recently purchased the space game starter kit and everything is working but the shaders. It shows pink for the initial space ship(spawn/being hit effect/space bar effect), planet, and inside the space station. I have all my project -> quality settings set to fantastic. My gpu is a GeForce GTX 660 Ti. Has anyone had this problem with this kit? If so do you know how to fix it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit: Shaders not working
« Reply #1 on: July 20, 2014, 11:47:05 AM »
Can you post a pic? Did you just import the package into a new project, and nothing else? When you select the shaders used by the pink materials, do you see errors? What's the target platform? (DX11?)

jfouch

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Space Game Starter Kit: Shaders not working
« Reply #2 on: July 20, 2014, 01:14:08 PM »
See the attached image. The target platform is DX11. I imported the package into the project directly from the assets store. I do not see any error whenever the project is running.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit: Shaders not working
« Reply #3 on: July 20, 2014, 07:19:12 PM »
Right -- change the platform to something other than DX11. SGSK is an old package, DX11 didn't exist back then.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Space Game Starter Kit: Shaders not working
« Reply #4 on: July 20, 2014, 07:38:30 PM »
If you want them to work on DX11, you will need to do the following modifications to the shaders:

1. DistortionOne.shader -- remove this:
  1. // Upgrade NOTE: excluded shader from DX11 and Xbox360; has structs without semantics (struct v2f members distortion)
  2. #pragma exclude_renderers d3d11 xbox360
2. In DistortionOne.shader, change:
  1.                                 struct v2f
  2.                                 {
  3.                                         float4 position : POSITION;
  4.                                         float2 uv : TEXCOORD0;
  5.                                         float4 screenPos : TEXCOORD1;
  6.                                         float distortion;
  7.                                 };
to:
  1.                                 struct v2f
  2.                                 {
  3.                                         float4 position : POSITION;
  4.                                         float2 uv : TEXCOORD0;
  5.                                         float4 screenPos : TEXCOORD1;
  6.                                         float distortion : TEXCOORD2;
  7.                                 };
3. Still DistortionOne.shader, change this:
  1.                                         // Time-based movement
  2.                                         screenPos = screenPos * float2(4.0, 12.0) + float2(_Time.w * 3.0);
to this:
  1.                                         // Time-based movement
  2.                                         float f = _Time.w * 3.0;
  3.                                         screenPos = screenPos * float2(4.0, 12.0) + float2(f, f);
4. DistortionTwo.shader needs to have the same changes as DistortionOne.

5. Atmosphere.shader, Planet.shader and Refractive.shader need this at the top of the vertex shader:
  1. #if SHADER_API_D3D11
  2.         UNITY_INITIALIZE_OUTPUT(Input, o);
  3. #endif
P.S. You can also just PM or email me your OR# and I'll send you the updated shaders so you don't have to do any of this yourself.