gpt4 book ai didi

blender - 在 React VR 中,光泽、自发光和镜面反射不是该 Material 的属性

转载 作者:行者123 更新时间:2023-12-02 08:14:52 29 4
gpt4 key购买 nike

我正在使用 React VR 开发一个应用程序,并使用 blender 创建了一个 3D pokeball。我已将其导出为 Wavefront .obj 文件,并在我的 React VR 应用程序中使用它。

在控制台中我看到以下警告:

THREE.MeshBasicMaterial: shininess, emissive and specular are not a property of this material.

您可以在下面找到我的代码:

import React from 'react';
import { AppRegistry, asset, StyleSheet, Pano, Text, View, Mesh } from 'react-vr';

class pokemongo extends React.Component {
render() {
return (
<View>
<Pano source={asset('sky.jpg')} />
<Mesh source={{ mesh: asset('pokeball.obj'), mtl: asset('pokeball.mtl') }}
style={{ height: 1 }}
transform={{ rotate: '0 90 0' }}></Mesh>
</View>
);
}
};

AppRegistry.registerComponent('pokemongo', () => pokemongo);

这是渲染的输出

然后this GitHub Gist您可以找到 objmtl 文件,并且可以下载 blend 文件。

在这里你可以在 Blender 中看到我的 Sprite 球。

我在互联网上搜索过,但没有找到与 React VR 相关的问题的解决方案或文档。

我做错了什么?

最佳答案

这在 react-vr > 0.2.1 中不再是一个问题,比如 Github issue州。

此外,如果您希望使用颜色和阴影渲染模型,则需要向场景应用一些灯光。这是通过在模型上启用 lit 属性并在您的模型中使用 AmbientLightSpotLightDirectionalLight 组件来完成的。场景。

import React from "react";
import {
AppRegistry,
asset,
Pano,
View,
Model,
AmbientLight,
SpotLight
} from "react-vr";

class pokemongo extends React.Component {
render() {
return (
<View>
<Pano source={asset("chess-world.jpg")} />
<AmbientLight intensity={0.5} />
<SpotLight
intensity={1}
style={{ transform: [{ translate: [-5, 5, 0] }] }}
/>
<Model
source={{
obj: asset("pokeball.obj"),
mtl: asset("pokeball.mtl")
}}
style={{
layoutOrigin: [0.5, 0.5],
transform: [
{ translate: [0, 0, -10] }
]
}}
lit={true}
/>
</View>
);
}
}

AppRegistry.registerComponent("pokemongo", () => pokemongo);

3d model in vr

对于旋转动画,您可以查看 ModelSample看看它是如何制作的。

关于blender - 在 React VR 中,光泽、自发光和镜面反射不是该 Material 的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42675253/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com