-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support displacement mapping via shaders #171
Comments
Depending on your usecase, you might be interested in parallax mapping[1] (POM). Usecase:
links: |
Thanks for the suggestion, your crate looks perfect for my use-case! Is there a way to automatically use a displacement map that is included in a GLTF, like how |
Annoyingly, the base GLTF spec doesn't include an height map (or bump map) https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material. There is a proposal to extend the standard with such a texture here: KhronosGroup/glTF#2196. though it does look like a lot of work is needed to get it merged. Furthermore, it is bevy that loads the GLTF, so we are stuck with whatever material & textures it loads. I think generating a height map based on the normal map is possible (see the TODO section of the README) But doing that at runtime is a bit beyond what I find acceptable in terms of performance. This is where a bevy asset preprocessing pipeline would be useful (planned for 0.11 I think) |
@nicopap do I see it right that bevyengine/bevy#5928 will do most of the lifting for this in Bevy 0.11? :) |
So if by "at runtime" you mean "in user code" the answer currently is "yes". As long as we don't somehow push the depth map (for parallax mapping, we should talk about "depth map" over height map) into the gltf model, we'll have to somehow tell bevy to load height maps. Currently the only way to tell bevy anything is through code. cart has been talking about "meta files" for the future asset pipeline which could also fulfills this role. Though, time to plug my normal2depth map plugin. 🚀 If your gltf comes with a normal map but not a depth map, you can now generate it! Nothing easier, use the |
Woah, that crate sounds really useful, thanks! I'll be sure to use it once Bevy 0.11 rolls out. |
well, I've just started testing it and it doesn't work quite well yet. 😅 So I'd reserve judgement until it's complete. |
I decided that this is out of scope for the template |
I'm no expert on this, but we should be able to shift a vertex in the vertex shader by the displacement map's level in the normal direction
The text was updated successfully, but these errors were encountered: