我正在尝试使用新的Google API API环境HDR进行照明估算。我正在按照开发人员指南中的说明进行操作,但是我不知道如何实现特定于应用程序的代码。
我已经像这样配置会话:
config.setLightEstimationMode(Config.LightEstimationMode.ENVIRONMENTAL_HDR);
session.configure(config);
Run Code Online (Sandbox Code Playgroud)
并将此代码放入我的更新调用中
private void onSceneUpdate(FrameTime frameTime) {
if (fragment instanceof ArFragment && loadedRenderable) {
if ( frame == null )
return;
LightEstimate lightEstimate = frame.getLightEstimate();
// note - currently only out param.
float[] intensity = lightEstimate.getEnvironmentalHdrMainLightIntensity();
float[] direction = lightEstimate.getEnvironmentalHdrMainLightDirection();
//app.setDirectionalLightValues(intensity, direction);
float[] harmonics = lightEstimate.getEnvironmentalHdrAmbientSphericalHarmonics();
//app.setAmbientSphericalHarmonicsLightValues(harmonics); // app-specific code.
// Get HDR environmental lighting as a cubemap in linear color space.
Image[] lightmaps = lightEstimate.acquireEnvironmentalHdrCubeMap();
for (int i = 0; i < …
Run Code Online (Sandbox Code Playgroud) 在ARCore示例中,andy.obj文件的意义是什么?假设我们用新图像替换andy.png,我们如何为新图像生成OBJ文件.
我正在Android Project中使用Sceneform SDK。
我的项目中有sfb
和sfa
对象,并且我希望对象的初始旋转被旋转90度。我该如何实现?
我在这些文件中找到了下一个代码,并更改了比例。
但是我没有找到轮换的方法。
model: {
attributes: [
"Position",
"TexCoord",
"Orientation",
],
collision: {},
file: "sampledata/models/redmixer.obj",
name: "redmixer",
scale: 0.010015,
},
Run Code Online (Sandbox Code Playgroud) 我在sceneform AR Fragment中的垂直平面上添加了一个图像.但它总是被轮换.代码在水平面上工作正常.我在垂直平面上放置图像的代码如下.
arFragment.setOnTapArPlaneListener { hitResult: HitResult,
plane: Plane,
motionEvent: MotionEvent ->
if(!isOnceTapedOnSurface) {
val anchor = hitResult.createAnchor()
val anchorNode = AnchorNode(anchor)
anchorNode.setParent(arFragment.arSceneView.scene)
andy = TransformableNode(arFragment.transformationSystem)
if(plane.type == Plane.Type.VERTICAL) {
val anchorUp = anchorNode.up
andy.setLookDirection(Vector3.up(), anchorUp)
}
andy.setParent(anchorNode)
andy.renderable = andyRenderable
andy.select()
// arFragment.arSceneView.planeRenderer.isVisible = false
isOnceTapedOnSurface = true
}
}
Run Code Online (Sandbox Code Playgroud) 我正在关注此 Sceneform SDK 教程 ( https://www.raywenderlich.com/5485-arcore-sceneform-sdk-getting-started ),并且在构建 Gradle 时遇到了一些问题。这是我的应用 build.gradle 文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.kotlinfirstapp"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.ar.ar:core:1.10.0'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.10.0'
implementation 'com.google.ar.sceneform:core:1.10.0'
}
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/models/andy.obj', …
Run Code Online (Sandbox Code Playgroud) 我正在关注关于在 SceneView 中将光添加到节点的谷歌开发人员指南:
https://developers.google.com/sceneform/develop/build-scene
Light spotLightYellow =
Light.builder(this, Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
Run Code Online (Sandbox Code Playgroud)
但是它似乎对我的渲染模型没有任何作用。
还有什么我想念的吗?
ModelRenderable.builder()
.setSource(
this,
Uri.parse(card)
)
.build()
.thenAccept(
modelRenderable -> {
node.setParent(scene);
node.setLocalPosition(vector3);
node.setLocalScale(new Vector3(1.4f, 1.4f, 1.4f));
node.setName("Test");
Light light =
Light.builder(Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
node.setLight(light);
node.setRenderable(modelRenderable);
})
.exceptionally(
throwable -> {
Toast toast =
Toast.makeText(this, "Unable to load Fox renderable" + throwable, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return null;
});
Run Code Online (Sandbox Code Playgroud) 我的理解是有几种环境支持 ARCore,Unity 和 Sceneform SDK 是其中一些选项。
我想知道除了一个在 Java 中,另一个在 C# 中之外,它们之间有什么不同?除了语言偏好之外,为什么有人会选择一种而不是另一种?
谢谢
unity-game-engine augmented-reality android-augmented-reality arcore sceneform
我想在 SceneView 中展示模型时使用正交相机(没有 AR)。在 API 中找不到这样做的方法。我是否遗漏了什么或缺少该功能?
当我尝试导入场景形式资产并在弹出的窗口上按完成时,没有任何反应。没有生成 .sfa、.sfb 文件。在 build.gradle 文件中也没有生成任何内容。我不得不提一下,我导入了之前在同一个项目中的场景资产,一切正常,但现在(一段时间后)当我再次尝试时它不起作用。