- Sort Posts
- 13 replies
- Last post
Shadows
Shadows
Shadows
I checked with the Dev team on this and it appears that the target geometry is only used for editor visualisation and as such will not support shadows.
However it is possible to support shadows by overlaying a plane and then using a custom shader on it which will give you the appearance as shown in the attached picture, provided that
1 The alpha cut-off is set to 0
2 The material colour is fully white
I got the shader from here: http://forum.unity3d.com/threads/14438-Matte-Shadow?highlight=matte+shadow
and modified it slightly:
Shader "FX/Matte Shadow" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200
Blend Zero SrcColor
CGPROGRAM
#pragma surface surf ShadowOnly alphatest:_Cutoff
fixed4 _Color;
struct Input {
float2 uv_MainTex;
} ;
inline fixed4 LightingShadowOnly (SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed4 c;
c.rgb = s.Albedo*atten;
c.a = s.Alpha;
return c;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = _Color;
o.Albedo = c.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
HTH
N
Attachment | Size |
---|---|
![]() | 157.17 KB |
Shadows
Shadows
Shadows can take quite a bit of setting up, so in my experience you need to spend some time experimenting.
I was able to get the Image Targets scene to show a shadow as per the picture attached by setting the shader to diffuse (so it is affected by light). However there is a small issue in that the shader seems to set itself back to unlit / texture.
The other points to check are the shadow distance in quality settings, plus the shadow settings of the light and each individual object. The other thing that can help is rotating the light in real-time just in case the directions are incorrect.
HTH
N
Attachment | Size |
---|---|
![]() | 68.95 KB |
Shadows
Shadows
As Alessandro said this is more a Unity issue, so your best bet is to create a non Vuforia scene with some shadows, just to see if it works in the first instance, and then port it over to the Vuforia scene.
The Unity forums will help you more in this, as will searching the web.
N
Shadows
Hi,I have the same problem of shadow things.i want to make the model has shadow on my print target that i can see it through my virtual camera.i have opened the lights shadow in my unity project, but i got nothing at imagetarget.Is there anyway to get it? will very thanks for help!!!
Shadows already discussed here (with solution):
https://developer.vuforia.com/forum/issues-and-bugs/shadows-dont-work-latest-vuforia-unity-sdk