在React VR中,光泽,发光和镜面反射不属于此材质

时间:2017-03-08 15:23:58

标签: blender wavefront webvr react-360

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

在控制台中我看到了这个警告:

  

THREE.MeshBasicMaterial shininessemissivespecular不是此资料的属性。

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

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看到我的pokeball。

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

我做错了什么?

1 个答案:

答案 0 :(得分:6)

react-vr > 0.2.1Github 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以了解它是如何制作的。