3D model is half black
Macieyou opened this issue · 1 comments
Macieyou commented
Environment
- Windows, Android
- Android
- ViroReact ^2.20.2, React 18.0.0
- Xiaomi redmi note 8 pro
Description
Hi,
I am new to viroReact and have a problem with a 3D model (.obj).
The model is half completely black and I don't know why. Is it related to the light I set or maybe the .obj file itself?
Can someone with more experience with this library help me with this? I wish the bottom was darker but not completely black.
ViroMaterials.createMaterials({
uranus: {
lightingModel: 'Blinn',
diffuseTexture: require(`${modelPath}/uranus/uranus_2K.jpg`),
},
});
<ViroNode>
<ViroSpotLight
innerAngle={5}
outerAngle={25}
direction={[0, -1, -0.2]}
position={[0, 3, 1]}
color="#ffffff"
castsShadow={true}
shadowMapSize={2048}
influenceBitMask={4}
shadowNearZ={2}
shadowFarZ={5}
intensity={3500}
shadowOpacity={0.7}
/>
<Viro3DObject
source={require('./uranus/uranus.obj')}
scale={[0.04, 0.04, 0.04]}
position={[0, 0.15, 0]}
materials={'uranus'}
animation={{
name: 'rotate',
loop: true,
run: true,
}}
lightReceivingBitMask={6}
shadowCastingBitMask={4}
type="OBJ"
/>
<ViroQuad
position={[0, 0, 0]}
rotation={[-90, 0, 0]}
width={4}
height={4}
arShadowReceiver={true}
lightReceivingBitMask={4}
/>
</ViroNode>
Macieyou commented
I managed to solve the problem by adding new light sources:
<ViroAmbientLight color="#ffffff" intensity={200} /> <ViroDirectionalLight color="#ffffff" direction={[0, -1, -0.2]} />
and decreasing the value of the 'lightReceivingBitMask' to 3