AsyncSceneInheritOutline, acts very weirdly with modular character. Flickering and non flowed outlines
@komadori First of all thank you so much for such a handy crate, you majestic chad. If you want acess to the base code just ping me
It seens there is something wrong with the manner you use to insert the outline logic on child scene meshes, on 0.10.2. Cant tell you exactly what it is. But when it utilize the AsyncScene component, the following occurs
Video of the bug in question
https://github.com/user-attachments/assets/71900e0a-f097-4bbf-aa5d-f5c6e1ab7031
As a pseudo fix, I utilized the code in one of my material crates. When done so, it acts as expected (dont know why ).
```rust
pub(crate) fn observe_scene_roots(
trigger: Trigger<SceneInstanceReady>,
has_shader: Query<&GrafittyShader>,
children: Query<&Children>,
handle_pbr_material: Query<&MeshMaterial3d<StandardMaterial>>,
pbr_materials: Res<Assets<StandardMaterial>>,
mut materials: ResMut<Assets<ExtendedMaterial<StandardMaterial, GrafittyShader>>>,
mut commands: Commands,
) {
let scene_root = trigger.target();
// Check if has our unique shader
let Ok(shader) = has_shader.get(scene_root) else {
return;
};
// Check if has previous material if not it means it is probably one of those useless child entities!
for child in children.iter_descendants(scene_root) {
let Ok(handle) = handle_pbr_material.get(child) else {
continue;
};
let base_material = pbr_materials.get(handle).unwrap();
// Here we basically create a new shade from the given pbr material and our shader
let end_material = materials.add(ExtendedMaterial {
base: base_material.clone(),
extension: shader.clone(),
});
// Adds end result material to our gltf!
commands
.entity(child)
.insert((
MeshMaterial3d(end_material),
OutlineVolume {
visible: true,
width: 3.0,
colour: Color::WHITE,
},
))
.remove::<MeshMaterial3d<StandardMaterial>>();
}
}
```
关闭于 2025-06-24 12 条评论