You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use bevy::prelude::*;fnmain(){App::new().insert_resource(Msaa{samples:4}).add_plugins(DefaultPlugins).add_startup_system(setup).run();}/// set up a simple 3D scenefnsetup(mutcommands:Commands,mutmeshes:ResMut<Assets<Mesh>>,mutmaterials:ResMut<Assets<StandardMaterial>>,){// plane
commands.spawn_bundle(PbrBundle{mesh: meshes.add(Mesh::from(shape::Plane{size:5.0})),material: materials.add(Color::rgb(0.3,0.5,0.3).into()),
..Default::default()});// squarelet square_material = materials.add(StandardMaterial{base_color:Color::rgb(0.8,0.7,0.6),double_sided:true,
..Default::default()});
commands.spawn_bundle(PbrBundle{mesh: meshes.add(Mesh::from(shape::Quad::default())),material: square_material,transform:Transform::from_xyz(0.0,0.5,0.0).with_rotation(Quat::from_rotation_y(std::f32::consts::PI)),
..Default::default()});// light
commands.spawn_bundle(PointLightBundle{point_light:PointLight{intensity:1500.0,shadows_enabled:true,
..Default::default()},transform:Transform::from_xyz(4.0,8.0,4.0),
..Default::default()});// camera
commands.spawn_bundle(PerspectiveCameraBundle{transform:Transform::from_xyz(-2.0,2.5,5.0).looking_at(Vec3::ZERO,Vec3::Y),
..Default::default()});}
What you expected to happen
Square and shadow
What actually happened
Just shadow
Additional information
@superdump mentioned on discord that this is a bug and double_sided should be affecting culling. It looks like there's some code in the shaders that's flipping normals, but as far as I can tell, there's no machinery that might affect culling.
I was able to fix this by adding specialization for cull_mode, and hooking double_sized up to it, but something is slightly off with the lighting so I may not have done that correctly.
I'm also not sure whether it's more appropriate to use 2 bits to represent every possible cull mode, or just one to enable/disable culling.
If I have time later though, I'll disentangle the code from another idea I was working on and throw a PR up, but this should be a pretty quick one for someone who actually knows what they're doing in bevy's renderer.
The text was updated successfully, but these errors were encountered:
Bevy version
main (cb2ba19)
Operating system & version
Macos 12.0.1. (M1)
What you did
Modify the
3d_scene
example in the following wayWhat you expected to happen
Square and shadow
What actually happened
Just shadow
Additional information
@superdump
mentioned on discord that this is a bug anddouble_sided
should be affecting culling. It looks like there's some code in the shaders that's flipping normals, but as far as I can tell, there's no machinery that might affect culling.I was able to fix this by adding specialization for
cull_mode
, and hookingdouble_sized
up to it, but something is slightly off with the lighting so I may not have done that correctly.I'm also not sure whether it's more appropriate to use 2 bits to represent every possible cull mode, or just one to enable/disable culling.
If I have time later though, I'll disentangle the code from another idea I was working on and throw a PR up, but this should be a pretty quick one for someone who actually knows what they're doing in bevy's renderer.
The text was updated successfully, but these errors were encountered: