Jump to content
Unity Insider Forum
Sign in to follow this  
ZerricK

Kann Sprite Lamp Shader nicht compilen!

Recommended Posts

Hallo!

Da ich in sachen shaders eine totale niete bin, wollte ich hier fragen ob einer so lieb sein könnte und mir helfen kann :D
Den shader hab ich nicht selbst gemacht, es ist ein kostenloser shader von Sprite Lamp, den ersteller hab ich auch schon gefragt aber es kam leider keine antwort.
Immer wenn ich mein spiel compilen will (mit dem Shader) bekomme ich immer einen error:

invalid subscript '_ShadowCoord' 'UnityComputeForwardShadows': no matching 3 parameter function
Compiling Vertex program with DIRECTIONAL SHADOWS_SCREEN
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

Aber in Unity selbst, läuft alles wie gewohnt, ich kann den shader sehn, ändern usw.
Hier nochmal der Link zum shader https://pastebin.com/Htg5p0EP
Nach Unity liegt das problem bei Zeile 414.

Ich bedanke mich schonmal im vorraus für jede Hilfe :)

Share this post


Link to post
Share on other sites

Vermutlich ein Unity-Versionsproblem. Die haben zwischen den Version 5.6 und 2017.xx an den Makro's gedreht die im internen Shaderinclude "AutoLight.cginc" definiert sind. In 5.6 heißen sie noch "SHADOW_COORDS" und in 2017.xx dann "UNITY_SHADOW_COORDS"

Siehe hier, da taucht die gleiche Fehlermeldung auf:
https://forum.unity.com/threads/unique-shadows-broken-in-5-6.467546/

Aber komisch ist es trotzdem, weil eigentlich sollten aktuelle Includes angezogen werden. Vielleicht hast du noch alte Shaderincludes in deinem Projektverzeichnis, schwer zu sagen? Funktioniert der Shader denn, wenn du ihn in einem leeren Projekt buildest?
Wenn dein Shader noch andere Includes anzieht, muss man da auch reinschauen.

Share this post


Link to post
Share on other sites
vor 22 Minuten schrieb Zer0Cool:

Vermutlich ein Unity-Versionsproblem. Die haben zwischen den Version 5.6 und 2017.xx an den Makro's gedreht die im internen Shaderinclude "AutoLight.cginc" definiert sind. In 5.6 heißen sie noch "SHADOW_COORDS" und in 2017.xx dann "UNITY_SHADOW_COORDS"

Siehe hier, da taucht die gleiche Fehlermeldung auf:
https://forum.unity.com/threads/unique-shadows-broken-in-5-6.467546/

Aber komisch ist es trotzdem, weil eigentlich sollten aktuelle Includes angezogen werden. Vielleicht hast du noch alte Shaderincludes in deinem Projektverzeichnis, schwer zu sagen? Funktioniert der Shader denn, wenn du ihn in einem leeren Projekt buildest?
Wenn dein Shader noch andere Includes anzieht, muss man da auch reinschauen.

In einem komplett neuen projekt funktioniert es auch nicht.
Es funktioniert ab und zu mal wenn ich Unity neustarte, aber das ist nicht wirklich schön so es zu fixen ^^

Share this post


Link to post
Share on other sites

Hab den Fehler gefunden, üble Mischung aus Unitybug und Shadercode:

Korrektur in Zeile 329:

	VertexOutput vert(VertexInput input)
	{
		//VertexOutput output;
		UNITY_INITIALIZE_OUTPUT(VertexOutput, output);

		output.pos = UnityObjectToClipPos(input.vertex);
		output.posWorld = mul(unity_ObjectToWorld, input.vertex);
...
...

Unitybug siehe:
https://issuetracker.unity3d.com/issues/incorrect-definition-of-shadowcoord-in-autolight

Kann sein, daß man in Zeile 107 auch noch einmal korrigieren muss, aber bei mir kompiliert er, daher habe ich es weggelassen.

Share this post


Link to post
Share on other sites

Probier mal hiermit. Zumindest geht es ab und zu *g
 

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

// Upgrade NOTE: replaced '_LightMatrix0' with 'unity_WorldToLight'
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

// Shader for Unity integration with SpriteLamp. Currently the 'kitchen sink'
// shader - contains all the effects from Sprite Lamp's preview window using the default shader.
// Based on a shader by Steve Karolewics & Indreams Studios. Final version by Finn Morgan
// Note: Finn is responsible for spelling 'colour' with a U throughout this shader. Find/replace if you must.


Shader "SpriteLamp/Standard_PerTexel"
{
	Properties
	{
		_MainTex("Diffuse Texture", 2D) = "white" {}       //Alpha channel is plain old transparency
	_NormalDepth("Normal Depth", 2D) = "bump" {}       //Normal information in the colour channels, depth in the alpha channel.
	_SpecGloss("Specular Gloss", 2D) = "" {}           //Specular colour in the colour channels, and glossiness in the alpha channel.
	_AmbientOcclusion("Ambient Occlusion", 2D) = "" {} //A greyscale value for precomputed ambient occlusion - not very compact.
	_EmissiveColour("Emissive colour", 2D) = "" {}     //A colour image that is simply added over the final colour. Might eventually have AO packed into its alpha channel.

	_SpecExponent("Specular Exponent", Range(1.0,50.0)) = 10.0        //Multiplied by the alpha channel of the spec map to get the specular exponent.
		_SpecStrength("Specular Strength", Range(0.0,5.0)) = 1.0      //Multiplier that affects the brightness of specular highlights
		_AmplifyDepth("Amplify Depth", Range(0,1.0)) = 0.0    //Affects the 'severity' of the depth map - affects shadows (and shading to a lesser extent).
		_CelShadingLevels("Cel Shading Levels", Float) = 0     //Set to zero to have no cel shading.
		_TextureRes("Texture Resolution", Vector) = (256, 256, 0, 0)    //Leave this to be set via a script.
		_AboveAmbientColour("Upper Ambient Colour", Color) = (0.3, 0.3, 0.3, 0.3)   //Ambient light coming from above.
		_BelowAmbientColour("Lower Ambient Colour", Color) = (0.1, 0.1, 0.1, 0.1)   //Ambient light coming from below.
		_LightWrap("Wraparound lighting", Range(0,1.0)) = 0.0  //Higher values of this will cause diffuse light to 'wrap around' and light the away-facing pixels a bit.
		_AmbientOcclusionStrength("Ambient Occlusion Strength", Range(0,1.0)) = 0.0    //Determines how strong the effect of the ambient occlusion map is.
		_EmissiveStrength("Emissive strength", Range(0, 1.0)) = 0.0 //Emissive map is multiplied by this.
		_AttenuationMultiplier("Attenuation multiplier", Range(0.1, 5.0)) = 1.0 //Distance is multiplied by this for purposes of calculating attenuation
		_SpotlightHardness("Spotlight hardness", Range(1.0, 10.0)) = 2.0    //Higher number makes the edge of a spotlight harder.
	}

		SubShader
	{
		Tags
	{
		"Queue" = "Transparent"
		"IgnoreProjector" = "True"
		"RenderType" = "Transparent"
		"PreviewType" = "Plane"
		"CanUseSpriteAtlas" = "True"
	}

		Cull Off
		Lighting Off
		ZWrite Off
		Fog{ Mode Off }
		Blend SrcAlpha OneMinusSrcAlpha
		AlphaTest NotEqual 0.0

		Pass
	{
		Tags{ "LightMode" = "ForwardBase" }

		CGPROGRAM

#pragma vertex vert  
#pragma fragment frag
#pragma target 3.0

#include "UnityCG.cginc"
#include "AutoLight.cginc"

		uniform sampler2D _MainTex;
	uniform sampler2D _NormalDepth;
	uniform sampler2D _SpecGloss;
	uniform sampler2D _AmbientOcclusion;
	uniform sampler2D _EmissiveColour;
	uniform float4 _AboveAmbientColour;
	uniform float4 _BelowAmbientColour;
	uniform float _AmbientOcclusionStrength;
	uniform float _EmissiveStrength;
	uniform float _AttenuationMultiplier;
	uniform float4 _LightColor0;
	uniform float _SpecExponent;
	uniform float _AmplifyDepth;
	uniform float _CelShadingLevels;
	uniform float4 _TextureRes;
	uniform float _LightWrap;
	uniform float _SpecStrength;
	uniform float4x4 unity_WorldToLight; // transformation
	uniform float _SpotlightHardness;


	struct VertexInput
	{
		float4 vertex : POSITION;
		float4 color : COLOR;
		float4 uv : TEXCOORD0;
	};

	struct VertexOutput
	{
		float4 pos : POSITION;
		float4 color : COLOR;
		float2 uv : TEXCOORD0;
		float4 posWorld : TEXCOORD1;
		float4 posLight : TEXCOORD2;
	};

	VertexOutput vert(VertexInput input)
	{
		VertexOutput output;

		output.pos = UnityObjectToClipPos(input.vertex);
		output.posWorld = mul(unity_ObjectToWorld, input.vertex);

		output.uv = input.uv.xy;
		output.color = input.color;
		output.posLight = mul(unity_WorldToLight, output.posWorld);
		return output;
	}

	float4 frag(VertexOutput input) : COLOR
	{
		float4 diffuseColour = tex2D(_MainTex, input.uv);
		float4 normalDepth = tex2D(_NormalDepth, input.uv);
		float ambientOcclusion = tex2D(_AmbientOcclusion, input.uv).r;
		float3 emissiveColour = tex2D(_EmissiveColour, input.uv).rgb;
		float4 specGlossValues = tex2D(_SpecGloss, input.uv);

		float4 ambientResult;

		ambientOcclusion = (ambientOcclusion * _AmbientOcclusionStrength) + (1.0 - _AmbientOcclusionStrength);

		float3 worldNormalDirection = (normalDepth.xyz - 0.5) * 2.0;

		worldNormalDirection = float3(mul(float4(worldNormalDirection, 1.0), unity_WorldToObject).xyz);

		float upness = worldNormalDirection.y * 0.5 + 0.5; //'upness' - 1.0 means the normal is facing straight up, 0.5 means horizontal, 0.0 straight down, etc.

		float4 ambientColour = (_BelowAmbientColour * (1.0 - upness) + _AboveAmbientColour * upness) * ambientOcclusion;


		ambientResult = float4(ambientColour * diffuseColour + float4(emissiveColour * _EmissiveStrength, 0.0));

		//We have to calculate illumination here too, because the first light that gets rendered
		//gets folded into the ambient pass apparently.
		//Get the real vector for the normal,
		float3 normalDirection = (normalDepth.xyz - 0.5) * 2.0;
		normalDirection.z *= -1.0;
		normalDirection = normalize(normalDirection);




		float depthColour = normalDepth.a;


		////PER TEXEL STUFF STARTS////
		//For per-texel lighting, we recreate the world position based on the sprite's UVs...
		float2 positionOffset = input.uv;
		float2 roundedUVs = input.uv;

		//Intervening here to round the UVs to the nearest 1.0/TextureRes to clamp the world position
		//to the nearest pixel...
		roundedUVs *= _TextureRes.xy;
		roundedUVs = floor(roundedUVs) + 0.5;
		roundedUVs /= _TextureRes.xy;


		//This is the per-texel stuff! It's a work in progress - that's why it's commented out right now.

		float2 uvCorrection = input.uv - roundedUVs;

		//Get tangent and bitangent stuff:
		float3 p_dx = ddx(input.posWorld.xyz);
		float3 p_dy = ddy(input.posWorld.xyz);
		//Rate of change of the texture coords
		float2 tc_dx = ddx(input.uv.xy);
		float2 tc_dy = ddy(input.uv.xy);
		//Initial tangent and bitangent

		float3 fragTangent = (tc_dy.y * p_dx - tc_dx.y * p_dy) / (length(p_dy) * length(p_dy));
		float3 fragBitangent = (tc_dy.x * p_dx - tc_dx.x * p_dy) / (length(p_dx) * length(p_dx));

		fragTangent /= (length(fragTangent) * length(fragTangent));
		fragBitangent /= (length(fragBitangent) * length(fragBitangent));

		//This corrects for nonuniform scales that reverse the handedness of the whole thing.
		float uvCross = clamp((cross(fragTangent, fragBitangent)).z * -10000000.0, -1.0, 1.0);

		float3 uVector = -normalize(fragTangent) * length(fragBitangent) * uvCross;
		float3 vVector = normalize(fragBitangent) * length(fragTangent) * uvCross;

		float3 posWorld = input.posWorld.xyz + uVector * -uvCorrection.x + vVector * -uvCorrection.y;
		///PER TEXEL STUFF ENDS

		posWorld.z -= depthColour * _AmplifyDepth;  //The fragment's Z position is modified based on the depth map value.
		float3 vertexToLightSource;
		float3 lightDirection;
		float attenuation;
		if (0.0 == _WorldSpaceLightPos0.w) // directional light?
		{
			//This handles directional lights
			lightDirection = float3(mul(float4(_WorldSpaceLightPos0.xyz, 1.0), unity_ObjectToWorld).xyz);
			lightDirection = normalize(lightDirection);
		}
		else
		{
			vertexToLightSource = float3(_WorldSpaceLightPos0.xyz) - posWorld;
			lightDirection = float3(mul(float4(vertexToLightSource, 1.0), unity_ObjectToWorld).xyz);
			lightDirection = normalize(lightDirection);
		}
		UNITY_LIGHT_ATTENUATION(attenVal, input, posWorld);
		attenuation = attenVal;


		float aspectRatio = _TextureRes.x / _TextureRes.y;

		//We calculate shadows here. Magic numbers incoming (FIXME).
		float shadowMult = 1.0;
		float3 moveVec = lightDirection.xyz * 0.006 * float3(1.0, aspectRatio, -1.0);
		float thisHeight = depthColour * _AmplifyDepth;

		float3 tapPos = float3(roundedUVs, thisHeight + 0.1);
		//This loop traces along the light ray and checks if that ray is inside the depth map at each point.
		//If it is, darken that pixel a bit.
		for (int i = 0; i < 8; i++)
		{
			tapPos += moveVec;
			float tapDepth = tex2D(_NormalDepth, tapPos.xy).a * _AmplifyDepth;
			if (tapDepth > tapPos.z)
			{
				shadowMult -= 0.125;
			}
		}
		shadowMult = clamp(shadowMult, 0.0, 1.0);





		// Compute diffuse part of lighting
		float normalDotLight = dot(normalDirection, lightDirection);

		//Slightly awkward maths for light wrap.
		float diffuseLevel = clamp(normalDotLight + _LightWrap, 0.0, _LightWrap + 1.0) / (_LightWrap + 1.0) * attenuation * shadowMult;

		// Compute specular part of lighting
		float specularLevel;
		if (normalDotLight < 0.0)
		{
			// Light is on the wrong side, no specular reflection
			specularLevel = 0.0;
		}
		else
		{
			// For the moment, since this is 2D, we'll say the view vector is always (0, 0, -1).
			//This isn't really true when you're not using a orthographic camera though. FIXME.
			float3 viewDirection = float3(0.0, 0.0, -1.0);
			specularLevel = attenuation * pow(max(0.0, dot(reflect(-lightDirection, normalDirection),
				viewDirection)), _SpecExponent * specGlossValues.a) * 0.4;
		}

		// Add cel-shading if enough levels were specified
		if (_CelShadingLevels >= 2.0)
		{
			diffuseLevel = floor(diffuseLevel * _CelShadingLevels) / (_CelShadingLevels - 0.5);
			specularLevel = floor(specularLevel * _CelShadingLevels) / (_CelShadingLevels - 0.5);
		}

		//The easy bits - assemble the final values based on light and map colours and combine.
		float3 diffuseReflection = diffuseColour.xyz * input.color.xyz * _LightColor0.xyz * diffuseLevel;
		float3 specularReflection = _LightColor0.xyz * input.color.xyz * specularLevel * specGlossValues.rgb * _SpecStrength;

		float4 finalColour = float4(diffuseReflection + specularReflection, diffuseColour.a) + ambientResult;

		return finalColour;


	}

		ENDCG
	}

		Pass
	{
		Tags{ "LightMode" = "ForwardAdd" }
		Blend One One // additive blending

		CGPROGRAM

#pragma vertex vert  
#pragma fragment frag
#pragma target 3.0

#include "UnityCG.cginc"
#include "AutoLight.cginc"
#pragma multi_compile_lightpass

		// User-specified properties
		uniform sampler2D _MainTex;
	uniform sampler2D _NormalDepth;
	uniform sampler2D _SpecGloss;
	uniform float4 _LightColor0;
	uniform float _SpecExponent;
	uniform float _AmplifyDepth;
	uniform float _CelShadingLevels;
	uniform float4 _TextureRes;
	uniform float _LightWrap;
	uniform float _AttenuationMultiplier;
	uniform float _SpecStrength;

	uniform float _SpotlightHardness;

	struct VertexInput
	{
		float4 vertex : POSITION;
		float4 color : COLOR;
		float4 uv : TEXCOORD0;
	};

	struct VertexOutput
	{
		float4 pos : POSITION;
		float4 color : COLOR;
		float2 uv : TEXCOORD0;
		float4 posWorld : TEXCOORD1;
		float4 posLight : TEXCOORD2;
	};

	VertexOutput vert(VertexInput input)
	{
		VertexOutput output;
		UNITY_INITIALIZE_OUTPUT(VertexOutput, output);

		output.pos = UnityObjectToClipPos(input.vertex);
		output.posWorld = mul(unity_ObjectToWorld, input.vertex);

		output.uv = input.uv.xy;
		output.color = input.color;
#ifndef DIRECTIONAL
		output.posLight = mul(unity_WorldToLight, output.posWorld);
#endif
		return output;
	}

	float4 frag(VertexOutput input) : COLOR
	{
		//Do texture reads first, because in theory that's a bit quicker...
		float4 diffuseColour = tex2D(_MainTex, input.uv);
		float4 normalDepth = tex2D(_NormalDepth, input.uv);
		float4 specGlossValues = tex2D(_SpecGloss, input.uv);

		//Get the real vector for the normal,
		float3 normalDirection = (normalDepth.xyz - 0.5) * 2.0;
		normalDirection.z *= -1.0;
		normalDirection = normalize(normalDirection);


		float depthColour = normalDepth.a;

		////PER TEXEL STUFF STARTS////
		//For per-texel lighting, we recreate the world position based on the sprite's UVs...
		float2 positionOffset = input.uv;
		float2 roundedUVs = input.uv;

		//Intervening here to round the UVs to the nearest 1.0/TextureRes to clamp the world position
		//to the nearest pixel...
		roundedUVs *= _TextureRes.xy;
		roundedUVs = floor(roundedUVs) + 0.5;
		roundedUVs /= _TextureRes.xy;


		//This is the per-texel stuff! It's a work in progress - that's why it's commented out right now.

		float2 uvCorrection = input.uv - roundedUVs;

		//Get tangent and bitangent stuff:
		float3 p_dx = ddx(input.posWorld.xyz);
		float3 p_dy = ddy(input.posWorld.xyz);
		//Rate of change of the texture coords
		float2 tc_dx = ddx(input.uv.xy);
		float2 tc_dy = ddy(input.uv.xy);
		//Initial tangent and bitangent

		float3 fragTangent = (tc_dy.y * p_dx - tc_dx.y * p_dy) / (length(p_dy) * length(p_dy));
		float3 fragBitangent = (tc_dy.x * p_dx - tc_dx.x * p_dy) / (length(p_dx) * length(p_dx));

		fragTangent /= (length(fragTangent) * length(fragTangent));
		fragBitangent /= (length(fragBitangent) * length(fragBitangent));

		//This corrects for nonuniform scales that reverse the handedness of the whole thing.
		float uvCross = clamp((cross(fragTangent, fragBitangent)).z * -10000000.0, -1.0, 1.0);

		float3 uVector = -normalize(fragTangent) * length(fragBitangent) * uvCross;
		float3 vVector = normalize(fragBitangent) * length(fragTangent) * uvCross;



		float3 posWorld = input.posWorld.xyz + uVector * -uvCorrection.x + vVector * -uvCorrection.y;
		///PER TEXEL STUFF ENDS

		posWorld.z -= depthColour * _AmplifyDepth;  //The fragment's Z position is modified based on the depth map value.
		float3 vertexToLightSource;
		float3 lightDirection;
		float attenuation;
		if (0.0 == _WorldSpaceLightPos0.w) // directional light?
		{
			//This handles directional lights
			lightDirection = float3(mul(float4(_WorldSpaceLightPos0.xyz, 1.0), unity_ObjectToWorld).xyz);
			lightDirection = normalize(lightDirection);
		}
		else
		{
			vertexToLightSource = float3(_WorldSpaceLightPos0.xyz) - posWorld;
			lightDirection = float3(mul(float4(vertexToLightSource, 1.0), unity_ObjectToWorld).xyz);
			lightDirection = normalize(lightDirection);
		}
		UNITY_LIGHT_ATTENUATION(attenVal, input, posWorld); //Das Problem
		attenuation = attenVal;



		float aspectRatio = _TextureRes.x / _TextureRes.y;

		//We calculate shadows here. Magic numbers incoming (FIXME).
		float shadowMult = 1.0;
		float3 moveVec = lightDirection.xyz * 0.006 * float3(1.0, aspectRatio, -1.0);
		float thisHeight = depthColour * _AmplifyDepth;

		float3 tapPos = float3(roundedUVs, thisHeight + 0.1);
		//This loop traces along the light ray and checks if that ray is inside the depth map at each point.
		//If it is, darken that pixel a bit.
		for (int i = 0; i < 8; i++)
		{
			tapPos += moveVec;
			float tapDepth = tex2D(_NormalDepth, tapPos.xy).a * _AmplifyDepth;
			if (tapDepth > tapPos.z)
			{
				shadowMult -= 0.125;
			}
		}
		shadowMult = clamp(shadowMult, 0.0, 1.0);





		// Compute diffuse part of lighting
		float normalDotLight = dot(normalDirection, lightDirection);

		//Slightly awkward maths for light wrap.
		float diffuseLevel = clamp(normalDotLight + _LightWrap, 0.0, _LightWrap + 1.0) / (_LightWrap + 1.0) * attenuation * shadowMult;

		// Compute specular part of lighting
		float specularLevel;
		if (normalDotLight < 0.0)
		{
			// Light is on the wrong side, no specular reflection
			specularLevel = 0.0;
		}
		else
		{
			// For the moment, since this is 2D, we'll say the view vector is always (0, 0, -1).
			//This isn't really true when you're not using a orthographic camera though. FIXME.
			float3 viewDirection = float3(0.0, 0.0, -1.0);
			specularLevel = attenuation * pow(max(0.0, dot(reflect(-lightDirection, normalDirection),
				viewDirection)), _SpecExponent * specGlossValues.a) * 0.4;
		}

		// Add cel-shading if enough levels were specified
		if (_CelShadingLevels >= 2.0)
		{
			diffuseLevel = floor(diffuseLevel * _CelShadingLevels) / (_CelShadingLevels - 0.5);
			specularLevel = floor(specularLevel * _CelShadingLevels) / (_CelShadingLevels - 0.5);
		}

		//The easy bits - assemble the final values based on light and map colours and combine.
		float3 diffuseReflection = diffuseColour.xyz * input.color * _LightColor0.xyz * diffuseLevel;
		float3 specularReflection = _LightColor0.xyz * input.color * specularLevel * specGlossValues.rgb * _SpecStrength;

		float4 finalColour = float4((diffuseReflection + specularReflection) * diffuseColour.a, 0.0);
		return finalColour;

	}

		ENDCG
	}
	}
		// The definition of a fallback shader should be commented out
		// during development:
		Fallback "Transparent/Diffuse"
}

 

Share this post


Link to post
Share on other sites

In Unity 2017.3 läuft der Shader jetzt.

Was kommt denn für eine FM in der Console? Bei Pink sollte da was stehen? Unity notfalls mal durchstarten wenn keine FM erscheint.

Der Shadercode sollte jetzt jedenfalls so aussehen (hab die obere Zeile wieder reingenommen):
Zeile 329:

VertexOutput vert(VertexInput input)
	{
		VertexOutput output;
		UNITY_INITIALIZE_OUTPUT(VertexOutput, output);

 

Share this post


Link to post
Share on other sites
invalid subscript '_ShadowCoord' 'UnityComputeForwardShadows': no matching 3 parameter function at line 415(on d3d11)
Compiling Vertex program with DIRECTIONAL_COOKIE SHADOWS_SCREEN
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

 

Share this post


Link to post
Share on other sites

So letzter Versuch.

An der alten Fehlerstelle folgendes einsetzen (Zeile 414):

#if defined(SHADOWS_SCREEN)
		attenuation = 1;
#else
		UNITY_LIGHT_ATTENUATION(attenVal, input, posWorld); //Das Problem
		attenuation = attenVal;
#endif

Scheinbar nimmt er so bei Schatten des Directional Light die obere Zeile und ohne Schatten die untere... Hat irgendwie was mit mehreren Shadervarianten zu tun... die vermutlich beim Kompilieren erzeugt werden...

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×