ar吧 关注:12,071贴子:24,789
  • 5回复贴,共1

【疑问】为什么在工程内可以显示阴影但是在AR实景中不显示阴影?

只看楼主收藏回复




IP属地:上海1楼2016-05-12 17:07回复
    楼主解决了吗


    2楼2016-12-23 13:47
    回复
      楼主用什么软件做的


      IP属地:湖北3楼2017-03-15 17:19
      回复
        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"
        }
        --------------------------------------------------------------------
        5.0有个Bug要在ArCamera里添加另外一个脚本
        ---------------------------------------------------------
        using UnityEngine;
        using System.Collections;
        using Vuforia;
        public class FixProjectionMatrix : MonoBehaviour, IVideoBackgroundEventHandler
        {
        private Camera[] mCameras;
        // Use this for initialization
        void Start()
        {
        mCameras = VuforiaBehaviour.Instance.GetComponentsInChildren<Camera>();
        VuforiaBehaviour.Instance.RegisterVideoBgEventHandler(this);
        }
        // Update is called once per frame
        void Update()
        {
        }
        public void OnVideoBackgroundConfigChanged()
        {
        foreach (var cam in mCameras)
        {
        var projMatrix = cam.projectionMatrix;
        for (int i = 0; i < 16; i++)
        {
        if (System.Math.Abs(projMatrix[i]) < 1e-6)
        {
        projMatrix[i] = 0.0f;
        }
        }
        cam.projectionMatrix = projMatrix;
        }
        }
        }


        来自Android客户端4楼2017-03-16 13:23
        回复(1)
          如果是unity开发,这个问题我以前也遇到过,需要在底面放一个地板,加上透明材质,让后在网上找接受阴影的shader.


          IP属地:安徽5楼2019-12-09 16:24
          回复