Skip to content
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

glTF skinning and morphing animations #184

Merged
merged 20 commits into from
Feb 24, 2018
Merged

glTF skinning and morphing animations #184

merged 20 commits into from
Feb 24, 2018

Conversation

kvark
Copy link
Collaborator

@kvark kvark commented Feb 22, 2018

This is a revival, rebase, and a substantial rewrite of #151

cc @alteous - if you want to check out how the bones are traversed without caching the world transforms

three-rs-skinning

@kvark kvark requested a review from vitvakatu February 22, 2018 16:25
@@ -1,59 +1,101 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure who removed this but beware of possible copyright violation.

}

let mut skeletons = Vec::new();
for w in hub.walk(&scene.first_child) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

@@ -729,7 +868,7 @@ impl Renderer {

for w in hub.walk(&scene.first_child) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

@@ -789,39 +928,37 @@ impl Renderer {
}

for w in hub.walk(&scene.first_child) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

Copy link
Member

@alteous alteous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you are traversing the scene graph (hub.walk) three times every frame. IIRC, you were pretty adamant about not traversing it more than once in the original PR.

@kvark
Copy link
Collaborator Author

kvark commented Feb 22, 2018

@alteous thanks for taking a look!

I'm not sure who removed this but beware of possible copyright violation.

does the shader code match anything licensed? I thought you wrote it, and then I changed it more. If there are still lines under license, I'd like to rewrite them anyway.

It seems you are traversing the scene graph (hub.walk) three times every frame. IIRC, you were pretty adamant about not traversing it more than once in the original PR.

You might have misunderstood me then. I said previously that ideally in some not far future we'd want to only traverse the graph once and collect all the render data into appropriate buckets for GPU. That doesn't in any way force this change to go crazy out of scope, especially since there were already multiple passes over the graph before it.

And that ideal scenario was brought up as an argument to not cache those world transforms (or anything, really, we are almost functional!). As you can see, bone transforms are fitting the scheme just fine.

@alteous
Copy link
Member

alteous commented Feb 22, 2018

The majority of the shader code was taken from https://github.com/KhronosGroup/glTF-WebGL-PBR/tree/master/shaders. I adapted the code for use with gfx changed its style to reflect ours.

@kvark
Copy link
Collaborator Author

kvark commented Feb 23, 2018

@alteous yeah, you did good. I double checked the shaders and see no concerns about them.
Also, added a commit that bumps the version.

Copy link
Member

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brief review

.travis.yml Outdated
@@ -23,7 +23,8 @@ notifications:
on_start: never

script:
- cargo build
- cargo check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need check? I think cargo test is enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@@ -19,7 +19,7 @@ const COLOR_BROWN_DARK: three::Color = 0x23190f;
const COLOR_BLUE: three::Color = 0x68c3c0;

fn main() {
env_logger::init().unwrap();
env_logger::init();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about enabling logging for every example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice, but requires some sort of example boilerplate, and creeps out of scope for this PR

src/animation.rs Outdated
@@ -484,12 +489,14 @@ impl ActionData {
))
};
let update = frame_start_value.slerp(frame_end_value, s);
use Object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's import it globally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh god

Copy link
Collaborator Author

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitvakatu comments addressed

@@ -19,7 +19,7 @@ const COLOR_BROWN_DARK: three::Color = 0x23190f;
const COLOR_BLUE: three::Color = 0x68c3c0;

fn main() {
env_logger::init().unwrap();
env_logger::init();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice, but requires some sort of example boilerplate, and creeps out of scope for this PR

src/animation.rs Outdated
@@ -484,12 +489,14 @@ impl ActionData {
))
};
let update = frame_start_value.slerp(frame_end_value, s);
use Object;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh god

.travis.yml Outdated
@@ -23,7 +23,8 @@ notifications:
on_start: never

script:
- cargo build
- cargo check
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Member

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kvark looks good to me

@@ -19,7 +19,7 @@ pub mod basic {
/// Renders triangle meshes with a solid color or texture.
#[derive(Clone, Hash, Debug, PartialEq, Eq)]
pub struct Basic {
/// Solid color applied in the absense of `map`.
/// Solid color applied in the absence of `map`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL.

@kvark
Copy link
Collaborator Author

kvark commented Feb 24, 2018 via email

bors bot added a commit that referenced this pull request Feb 24, 2018
184: glTF skinning and morphing animations r=vitvakatu a=kvark

This is a revival, rebase, and a substantial rewrite of #151

cc @alteous - if you want to check out how the bones are traversed without caching the world transforms

![three-rs-skinning](https://user-images.githubusercontent.com/107301/36550245-d878073e-17c2-11e8-87ca-68299dfff775.png)
@bors
Copy link
Contributor

bors bot commented Feb 24, 2018

Build succeeded

@bors bors bot merged commit e0e366e into master Feb 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants