Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ARCore Sceneform ChromaKeyVideo Sampleproject如何仅使用视频功能_Android_Arcore_Sceneform - Fatal编程技术网

Android ARCore Sceneform ChromaKeyVideo Sampleproject如何仅使用视频功能

Android ARCore Sceneform ChromaKeyVideo Sampleproject如何仅使用视频功能,android,arcore,sceneform,Android,Arcore,Sceneform,我查看了最近发布的ARCores Sceneform示例项目 我想使用该功能在ar场景中显示视频,但不使用色度键功能。在示例项目中,他们使用纹理为背景等设置关键帧 但是,如何将此示例转换为仅显示.mp4视频文件? 目前,我必须使用OpenGL渲染器的实现。如果改用Sceneform来实现这一点,那就太好了。显然这是可能的。但我不知道我必须使用哪种材料才能显示一个稳定的视频 那么,我该如何更改此示例以仅显示完整视频而不显示色度键功能呢 您可以创建仅使用外部纹理的新自定义材质。您可以在sampled

我查看了最近发布的ARCores Sceneform示例项目

我想使用该功能在ar场景中显示视频,但不使用色度键功能。在示例项目中,他们使用纹理为背景等设置关键帧

但是,如何将此示例转换为仅显示.mp4视频文件? 目前,我必须使用OpenGL渲染器的实现。如果改用Sceneform来实现这一点,那就太好了。显然这是可能的。但我不知道我必须使用哪种材料才能显示一个稳定的视频


那么,我该如何更改此示例以仅显示完整视频而不显示色度键功能呢

您可以创建仅使用外部纹理的新自定义材质。您可以在sampledata/models目录中创建一个名为
externalTexture.mat
的新.mat文件:

// Copyright 2018 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
material {
    "name" : "Chroma Key Video Material",
    "defines" : [
        "baseColor"
    ],
    "parameters" : [
        {
           // The texture displaying the frames of the video.
           "type" : "samplerExternal",
           "name" : "videoTexture"
        }
    ],
    "requires" : [
        "position",
        "uv0"
    ],
    "shadingModel" : "unlit",
    // Blending is "masked" instead of "transparent" so that the shadows account for the
    // transparent regions of the video instead of just the shape of the mesh.
    "blending" : "masked",
    // Material is double sided so that the video is visible when walking behind it.
    "doubleSided" : true
}

fragment {
    void material(inout MaterialInputs material) {
        prepareMaterial(material);

        vec2 uv = getUV0();

        if (!gl_FrontFacing) {
          uv.x = 1.0 - uv.x;
        }

        material.baseColor = texture(materialParams_videoTexture, uv).rgba;
    }
}
然后在.sfa文件中将材质源更改为externalTexture.mat:

     source: "sampledata/models/externalTexture.mat",

谢谢你的回答。不知怎么的,它看起来还是不对劲。背景的某些部分仍然被剪掉。对于我在问题中链接的github项目的示例代码,是否还需要对其应用任何更改?我想这与我在这里提出的问题相同:检查答案(答案相同,但代码更多)