- Home /
Self-Shadowing problems on MacBook Pro
Hey there!
Take a look at this screenshot from Unity 3.3 Pro on Mac OSX.
Almost every surface produces artifacts and moir that look like self-shadowing problems.
Fiddling with the project quality settings (shadow cascades etc.) does not remove them, adjusting the light's bias does not help and neither does changing the shaders...
The MacBook Pro, the screenshot was taken on, has an NVidia 9600M GT graphics card.
Any ideas what could cause those? It is really hard to work on the shadows on this system.
Did you test your scene on other hardware? (On my old $$anonymous$$BP with an 8600$$anonymous$$ GT shadows and lights work as expected.)
Yes, on a $$anonymous$$acPro with Bootcamp and Win-7 x64 and several other Windows 7 PCs and Laptops.. works perfectly everywhere else.
Ok, tested it on another $$anonymous$$ac, and the problem persists
Answer by VivienS · Jul 04, 2011 at 07:56 PM
OK, I just found the problem to be an old Vertex-Lit shader... If I remove this one shader file from the project, the problems are gone. I'll try to look deeper into it if I have the time.
Thanks to all!
Edit for Joseph:
Here is the shader's code. I don't know where we got it from initially. Most likely a left-over from a previous version of the built-in shaders package Unity provides on their website, or from the community wiki. Maybe you can identify the code that caused the problem.
Shader "VertexLit" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
// Normal rendering pass
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary DOUBLE, texture * primary
}
}
// Pass to render object as a shadow caster
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Fog {Mode Off}
ZWrite On ZTest Less Cull Off
//Offset [_ShadowBias], [_ShadowBiasSlope]
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile SHADOWS_NATIVE SHADOWS_CUBE
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
};
v2f vert( appdata_base v )
{
v2f o;
TRANSFER_SHADOW_CASTER(o)
return o;
}
float4 frag( v2f i ) : COLOR
{
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
// Pass to render object as a shadow collector
Pass {
Name "ShadowCollector"
Tags { "LightMode" = "ShadowCollector" }
Fog {Mode Off}
ZWrite On ZTest Less
CGPROGRAM
// Upgrade NOTE: excluded shader from Xbox360; has structs without semantics (struct appdata members vertex)
#pragma exclude_renderers xbox360
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#define SHADOW_COLLECTOR_PASS
#include "UnityCG.cginc"
struct appdata {
float4 vertex;
};
struct v2f {
V2F_SHADOW_COLLECTOR;
};
v2f vert (appdata v)
{
v2f o;
TRANSFER_SHADOW_COLLECTOR(o)
return o;
}
half4 frag (v2f i) : COLOR
{
SHADOW_COLLECTOR_FRAGMENT(i)
}
ENDCG
}
}
}
Answer by taoa · Mar 30, 2011 at 02:08 PM
Try adjusting your far clip distance on your camera.
Thanks! I forgot to mention this was amongst the things I already tried.. :-/ Also, it's visible in the scene view port (through the editor camera), independent of where I focus.
Then I suggest sending a bug report! ^^ Not very fancy, I know, but...
Your answer
![](https://koobas.hobune.stream/wayback/20220613115521im_/https://answers.unity.com/themes/thub/images/avi.jpg)