Start a new topic
Solved

Shadow Distance set on Transparent Shadow Receiver

Hi!

I'm working with Wikitude on Unity for Instant Tracking and all works fine, but when I try to change the shadow distance in the quality settings every time I hit play it goes back for 4 meters. 

I need my shadows to appear when my camera is 10 meters away from the model but no matter what I try is always jumps back to 4 and only when I get close to the model it appears. 

I'm attaching the script of the Shader called Transparent Shadow Receiver guessing it has something to do with it.

thanks in advance!


Shader "Custom/Transparent Shadow Receiver" {
Properties { }

SubShader {
Tags {"Queue"="AlphaTest" }
Pass {
 Tags {"LightMode" = "ForwardBase" }
 Cull Back
 ZWrite Off
 Blend SrcAlpha OneMinusSrcAlpha

 CGPROGRAM
 #pragma vertex vert
 #pragma fragment frag
 #pragma multi_compile_fwdbase

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

 struct v2f {
 float4 pos : SV_POSITION;
 LIGHTING_COORDS(0,1)
 };

 v2f vert(appdata_base v) {
 v2f o;
 o.pos = UnityObjectToClipPos (v.vertex);
 TRANSFER_VERTEX_TO_FRAGMENT(o);
 
 return o;
 }

 fixed4 frag(v2f i) : COLOR {
 return fixed4(0001.0f - LIGHT_ATTENUATION(i));
 }
 ENDCG
}
}
Fallback "VertexLit"
}


Hi,


Could you please provide the following details:


  • Which version of the SDK are you using?
  • What Unity version are you using?
  • Is this happening with the sample app or in your own app? If it happens with your own app, Does the sample app work on your device?

Thx and greetings

Nicola

Hi and thank you for your quick response!

I'm working with Unity 2019.3.0a11 with Wikitude SDK sample app version 8.6


Thank you!

Hi, 


The shadow distance is overwritten from the sample code, because different samples need different distances. If you're setting this from Unity, I would just remove it from the scripts. 

You can find it in the SampleController.cs, InstantTrackingController.cs, ObjectTrackingController.cs and ExtendedObjectTrackingController.cs, in their Start methods. The API used is "QualitySettings.shadowDistance".


Best regards,

Alexandru


1 person likes this
Login or Signup to post a comment