Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upfeat: Vertex skinning #545
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Jan 18, 2018
Member
@Rhuagh maybe you want to try to make it with new renderer instead?
It's almost ready.
|
@Rhuagh maybe you want to try to make it with new renderer instead? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 18, 2018
Member
Tbh, most of the code is independent of the renderer, it's just a vertex shader, a single component, and some wiring. I will fix that when the new renderer lands.
|
Tbh, most of the code is independent of the renderer, it's just a vertex shader, a single component, and some wiring. I will fix that when the new renderer lands. |
Rhuagh
added
status: ready
and removed
status: working
labels
Jan 18, 2018
Rhuagh
changed the title from
[WIP] feat: Vertex skinning
to
feat: Vertex skinning
Jan 18, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I will squash after reviews are done. |
Xaeroxe
requested changes
Jan 20, 2018
This looks great! Thank you! I have a couple nits, and some questions about the gltf example.
-
What's the licensing on the monster + animation? Who made them? What are our legal obligations in using it?
-
When I run the example and press space bar the monster jumps to a new position before animating, and facing the wrong direction. What do we need to do to make him animate in place?
| + }) | ||
| +} | ||
| + | ||
| +fn _flip_check(uv: [f32; 2], flip_v: bool) -> [f32; 2] { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Jan 20, 2018
Member
method isn't public so the leading underscore naming scheme is redundant and inconsistent with the rest of the code.
Xaeroxe
Jan 20, 2018
Member
method isn't public so the leading underscore naming scheme is redundant and inconsistent with the rest of the code.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 20, 2018
Member
Yeah, sorry about that, I'm currently working mostly with python at work, and there you need to put _ at the start of functions for them to be private.. I forgot that here I was working with a real language.
Rhuagh
Jan 20, 2018
Member
Yeah, sorry about that, I'm currently working mostly with python at work, and there you need to put _ at the start of functions for them to be private.. I forgot that here I was working with a real language.
| @@ -8,14 +8,18 @@ use super::local_virtual_key_code::LocalVirtualKeyCode; | ||
| pub enum Button { | ||
| /// Virtual Keyboard keys, use this when the letter on the key matters | ||
| /// more than the position of the key. | ||
| - Key(#[serde(with = "LocalVirtualKeyCode")] VirtualKeyCode), | ||
| + Key(#[serde(with = "LocalVirtualKeyCode")] | ||
| + VirtualKeyCode), |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Jan 20, 2018
Member
This is strange. It's not following the same formatting as a nearly identical enum variant just a few lines below.
Xaeroxe
Jan 20, 2018
Member
This is strange. It's not following the same formatting as a nearly identical enum variant just a few lines below.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| @@ -116,6 +107,8 @@ where | ||
| model: *global.as_ref(), | ||
| }); | ||
| + println!("{:?}", vertex_args); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| use tex::Texture; | ||
| use types::{Encoder, Factory}; | ||
| use vertex::{Position, Separate, TexCoord, VertexFormat}; | ||
| /// Draw mesh without lighting | ||
| #[derive(Derivative, Clone, Debug, PartialEq)] | ||
| #[derivative(Default(bound = "Self: Pass"))] | ||
| -pub struct DrawFlatSeparate; | ||
| +pub struct DrawFlatSeparate { | ||
| + skinning: bool, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 20, 2018
Member
The model is from the official gltf sample models and is free to use for testing and educational purposes.
The model jumps to a new position because that's how the animation is defined in the gltf. I tested it with 2 separate gltf viewers and they both gave the same results.
There's a problem here though which I forgot about, the only pass that works atm is the flat one because for some reason the gfx version we use have a 4 vertex attribute limit. I will look into that tonight.
|
The model is from the official gltf sample models and is free to use for testing and educational purposes. The model jumps to a new position because that's how the animation is defined in the gltf. I tested it with 2 separate gltf viewers and they both gave the same results. There's a problem here though which I forgot about, the only pass that works atm is the flat one because for some reason the gfx version we use have a 4 vertex attribute limit. I will look into that tonight. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
The last issue is fixed in gfx-rs/gfx#1750. |
| + combo: AnimatedVertexBufferCombination, | ||
| + renderer: &mut Renderer, | ||
| +) -> ::error::Result<Mesh> { | ||
| + build_mesh_with_some!( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| + }; | ||
| + if self.skinning { | ||
| + builder | ||
| + .with_raw_vertex_buffer( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Jan 20, 2018
Member
I should check that such boilerplate are taken care of in new renderer.
omni-viral
Jan 20, 2018
Member
I should check that such boilerplate are taken care of in new renderer.
Rhuagh
added
status: working
and removed
status: ready
labels
Jan 20, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 20, 2018
Member
Need to wait for gfx to be released with the fix before this can be pushed through.
|
Need to wait for gfx to be released with the fix before this can be pushed through. |
Rhuagh
added some commits
Jan 18, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 21, 2018
Member
This is a great PR, I just marked some nits. I reviewed all the files, but I didn't check out the repo and run the examples.
Reviewed 22 of 40 files at r1, 3 of 9 files at r2, 3 of 4 files at r3, 18 of 18 files at r4.
Review status: all files reviewed at latest revision, 11 unresolved discussions.
amethyst_animation/src/skinning/systems.rs, line 34 at r4 (raw file):
.join() .map(|(joint, _)| joint.skin) .collect::<HashSet<Entity>>();
I don't think this collect is necessary.
amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
// TODO: morph targets, cameras // TODO: KHR_materials_common extension debug!("Loading nodes");
Could include name here.
amethyst_renderer/src/lib.rs, line 95 at r4 (raw file):
mod config; #[macro_use] mod macros;
Local macros should go before the other modules, because that's necessary for using them. Once you want to use a macro from e.g. cam or color, you'll just get a confusing error. Thus, I think putting it above all the other modules is a good practice to avoid this.x
amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
combo: AnimatedVertexBufferCombination, renderer: &mut Renderer, ) -> ::error::Result<Mesh> {
nit: Can use an import here.
amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
/// Create a new combo mesh creator with the given combo pub fn new(combo: AnimatedVertexBufferCombination) -> Self { Self { combo }
Meh, I think using Self for the construction of a struct looks confusing. But I think that's just me :)
amethyst_renderer/src/system.rs, line 57 at r4 (raw file):
Ok(pipe) => Ok(Self::new(pipe, renderer)), Err(err) => { error!("Failed creating pipeline: {}", err);
Is the error message better now? Maybe we can include both the Display and the Debug output.
amethyst_renderer/src/pass/shaded_util.rs, line 42 at r4 (raw file):
} unsafe impl Pod for DirectionalLightPod {}
I'm wondering, could Pod be replaced with Copy? Not related with this PR, so marking this as "Satisfied".
amethyst_renderer/src/pass/shaded_util.rs, line 54 at r4 (raw file):
.join() .filter_map(|light| { if let Light::Point(ref light) = *light {
It might be good to have point, directional, .. methods which just return an Option. I think I saw this pattern before.
amethyst_renderer/src/pass/util.rs, line 67 at r4 (raw file):
} pub(crate) fn add_textures(
Ah, this is great :)
amethyst_renderer/src/pass/flat/interleaved.rs, line 110 at r3 (raw file):
Previously, Xaeroxe (Jacob Kiesel) wrote…
Woops, looks like this was left in accidentally.
I think this is resolved, please mark it as "Satisfied" in that case @Xaeroxe
amethyst_renderer/src/pass/flat/separate.rs, line 25 at r3 (raw file):
Previously, Xaeroxe (Jacob Kiesel) wrote…
This is a good first step towards composable passes. Thank you!
Comments from Reviewable
|
This is a great PR, I just marked some nits. I reviewed all the files, but I didn't check out the repo and run the examples. Reviewed 22 of 40 files at r1, 3 of 9 files at r2, 3 of 4 files at r3, 18 of 18 files at r4. amethyst_animation/src/skinning/systems.rs, line 34 at r4 (raw file):
I don't think this amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
Could include amethyst_renderer/src/lib.rs, line 95 at r4 (raw file):
Local macros should go before the other modules, because that's necessary for using them. Once you want to use a macro from e.g. amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
nit: Can use an import here. amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
Meh, I think using amethyst_renderer/src/system.rs, line 57 at r4 (raw file):
Is the error message better now? Maybe we can include both the amethyst_renderer/src/pass/shaded_util.rs, line 42 at r4 (raw file):
I'm wondering, could amethyst_renderer/src/pass/shaded_util.rs, line 54 at r4 (raw file):
It might be good to have amethyst_renderer/src/pass/util.rs, line 67 at r4 (raw file):
Ah, this is great :) amethyst_renderer/src/pass/flat/interleaved.rs, line 110 at r3 (raw file): Previously, Xaeroxe (Jacob Kiesel) wrote…
I think this is resolved, please mark it as "Satisfied" in that case @Xaeroxe amethyst_renderer/src/pass/flat/separate.rs, line 25 at r3 (raw file): Previously, Xaeroxe (Jacob Kiesel) wrote…
Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 21, 2018
Member
Review status: all files reviewed at latest revision, 9 unresolved discussions.
amethyst_animation/src/skinning/systems.rs, line 34 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
I don't think this
collectis necessary.
How would I make it only return unique entities in the for loop then ?
amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
name
How do you mean ? The name of the asset is included in the first debug line above.
amethyst_renderer/src/lib.rs, line 95 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Local macros should go before the other modules, because that's necessary for using them. Once you want to use a macro from e.g.
camorcolor, you'll just get a confusing error. Thus, I think putting it above all the other modules is a good practice to avoid this.x
Done.
amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
nit: Can use an import here.
Done.
amethyst_renderer/src/system.rs, line 57 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Is the error message better now? Maybe we can include both the
Displayand theDebugoutput.
Yeah, the issue is that the other error won't give me anything from the inner errors, so I needed to print it closer to the source to get the actual gfx error message :/
amethyst_renderer/src/pass/shaded_util.rs, line 54 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
It might be good to have
point,directional, .. methods which just return anOption. I think I saw this pattern before.
I'll defer that for later
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 9 unresolved discussions. amethyst_animation/src/skinning/systems.rs, line 34 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
How would I make it only return unique entities in the for loop then ? amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
amethyst_renderer/src/lib.rs, line 95 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_renderer/src/system.rs, line 57 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Yeah, the issue is that the other error won't give me anything from the inner errors, so I needed to print it closer to the source to get the actual gfx error message :/ amethyst_renderer/src/pass/shaded_util.rs, line 54 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
I'll defer that for later Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 21, 2018
Member
Review status: all files reviewed at latest revision, 9 unresolved discussions.
amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Meh, I think using
Selffor the construction of a struct looks confusing. But I think that's just me :)
Well, possibly for the construction, for returning Self i much prefer this way, because it means I don't have to write a gazillion type parameters all the time.
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 9 unresolved discussions. amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Well, possibly for the construction, for returning Self i much prefer this way, because it means I don't have to write a gazillion type parameters all the time. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 21, 2018
Member
Reviewed 2 of 2 files at r5.
Review status: all files reviewed at latest revision, 5 unresolved discussions.
amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
name
How do you mean ? The name of the asset is included in the first debug line above.
Ah right. I prefer to include the name or some id because with parallel code the output can easily mix. But I guess it's fine as is.
amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Done.
Err..you didn't use the imported item though :)
amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Well, possibly for the construction, for returning Self i much prefer this way, because it means I don't have to write a gazillion type parameters all the time.
Yeah, I prefer Self for specifying the return type and the real name for constructing the value.
amethyst_renderer/src/system.rs, line 57 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Yeah, the issue is that the other error won't give me anything from the inner errors, so I needed to print it closer to the source to get the actual gfx error message :/
OK. Maybe the ll errors are better, let's just leave it as is for now.
Comments from Reviewable
|
Reviewed 2 of 2 files at r5. amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Ah right. I prefer to include the name or some id because with parallel code the output can easily mix. But I guess it's fine as is. amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Err..you didn't use the imported item though :) amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Yeah, I prefer amethyst_renderer/src/system.rs, line 57 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
OK. Maybe the ll errors are better, let's just leave it as is for now. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 21, 2018
Member
Review status: all files reviewed at latest revision, 4 unresolved discussions.
amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Ah right. I prefer to include the name or some id because with parallel code the output can easily mix. But I guess it's fine as is.
I can do that. Is there a good way to add a prefix for the scope with log?
amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Err..you didn't use the imported item though :)
Ah, i used it only one place...
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 4 unresolved discussions. amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
I can do that. Is there a good way to add a prefix for the scope with log? amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Ah, i used it only one place... Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 23, 2018
Member
Review status: 39 of 46 files reviewed at latest revision, 3 unresolved discussions.
amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
I can do that. Is there a good way to add a prefix for the scope with log?
Havent found a good way to add an id without having to send it down through the function hierarchy.
amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Ah, i used it only one place...
Done.
amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Yeah, I prefer
Selffor specifying the return type and the real name for constructing the value.
Done.
Comments from Reviewable
|
Review status: 39 of 46 files reviewed at latest revision, 3 unresolved discussions. amethyst_gltf/src/format/mod.rs, line 147 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Havent found a good way to add an id without having to send it down through the function hierarchy. amethyst_renderer/src/skinning.rs, line 57 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Done. amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. Comments from Reviewable |
Rhuagh
and others
added some commits
Jan 20, 2018
Rhuagh
added
status: ready
and removed
status: working
labels
Jan 24, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This is ready, gfx-core has been released. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 25, 2018
Member
Reviewed 9 of 9 files at r6.
Review status: all files reviewed at latest revision, 1 unresolved discussion.
amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Done.
OK, thank you!
Comments from Reviewable
|
Reviewed 9 of 9 files at r6. amethyst_renderer/src/skinning.rs, line 79 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
OK, thank you! Comments from Reviewable |
bot
added a commit
that referenced
this pull request
Jan 25, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tryBuild succeeded |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Jan 25, 2018
Member
@Xaeroxe the specific section was gltf file which isn't a code. My statement was stupid enough to delete it. But you somehow managed to read it although it existed less than a minute
|
@Xaeroxe the specific section was |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Jan 25, 2018
Member
I got an email about it and happened to be looking at my phone haha
|
I got an email about it and happened to be looking at my phone haha |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
Rhuagh commentedJan 17, 2018
•
edited by torkleyy
Edited 2 times
-
torkleyy
edited Jan 17, 2018 (most recent)
-
Rhuagh
edited Jan 17, 2018
This change is