bevyengine / bevyengine/bevy

A box mesh made using shape::Box::From is missing tangent vectors, which prevents applying normal maps

Open
#3,121 3 comments 1 reaction 0 assignees View on GitHub
A-Rendering C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

Normal maps are a pretty standard cheap way to make meshes look a bit better. Often when prototyping you use basic shapes, and it would be quite nice to test real materials on these shapes.

Error:
```
thread 'Compute Task Pool (0)' panicked at 'Attribute Vertex_Tangent is required by shader, but not supplied by mesh. Either remove the attribute from the shader or supply the attribute (Vertex_Tangent) to the mesh.', C:\Users\_\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_render-0.5.0\src\pipeline\pipeline_compiler.rs:231:17
```

I checked the code and the issue seems to still exist in the current version of main.

## What solution would you like?

The [`From for Mesh`](https://github.com/bevyengine/bevy/blob/8b30dc635450363661397e7f63d054e6efbce547/crates/bevy_render/src/mesh/shape/mod.rs#L59) function should generate tangents in addition to normals and UV coordinates.

## What alternative(s) have you considered?

You could write your own box generator, and I will but I think this is a pretty basic feature.

## Additional context

I could probably fix this myself and submit a MR if you think this is a worthwhile feature. No guarantees.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.