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

Linking polygon2D points to bone2D goes wrong #42576

Closed
edaojs opened this issue Oct 5, 2020 · 14 comments
Closed

Linking polygon2D points to bone2D goes wrong #42576

edaojs opened this issue Oct 5, 2020 · 14 comments

Comments

@edaojs
Copy link

edaojs commented Oct 5, 2020

Godot version:
Godot Engine v3.2.3.stable.official
OpenGL ES 2.0 Renderer: Intel(R) HD Graphics
OpenGL ES 2.0 Batching: ON

OS/device including version:
Processor: Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz (4 CPUs), ~2.1GHz
Memory: 4096MB RAM
Card name: Intel(R) HD Graphics
Chip type: Intel(R) HD Graphics (Core i3)
DAC type: Internal
System: Windows 7 Professional x64

Issue description:
When I try to link a few polygon2D points to a bone2D the sprite gets distorted. If I link all the points, the image disappears
Video: https://youtu.be/oqmed2EWGog

Steps to reproduce:
Open "Player.tscn, Select LegR object and click over UV. On UV editor, select Bones and select the bLegR bone. Select a few points and click "OK".

Minimal reproduction project:
GodotTest.zip

@Calinou
Copy link
Member

Calinou commented Oct 5, 2020

Processor: Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz (4 CPUs), ~2.1GHz
Card name: Intel(R) HD Graphics
Chip type: Intel(R) HD Graphics (Core i3)

This is a very old graphics adapter. I wouldn't expect any OpenGL 2.0+ renderer to run correctly on it.

@lawnjelly
Copy link
Member

I don't know if this is a rendering issue or an editor issue, but just in case it is a rendering issue, try the latest build in #42119. This should deal with problems where the GPU does not support the skinning shader. I've only seen reports of this on android, but it could occur on other hardware.

The unified batching has a new software transform path for 2d skinning (you can turn it on and off in projectsettings->rendering->quality->2d->use_software_skinning).

If this doesn't fix it, then it may be an editor issue.

@edaojs
Copy link
Author

edaojs commented Oct 5, 2020

I don't know if this is a rendering issue or an editor issue, but just in case it is a rendering issue, try the latest build in #42119. This should deal with problems where the GPU does not support the skinning shader. I've only seen reports of this on android, but it could occur on other hardware.

The unified batching has a new software transform path for 2d skinning (you can turn it on and off in projectsettings->rendering->quality->2d->use_software_skinning).

If this doesn't fix it, then it may be an editor issue.

I visited the build in #42119 and download the GLES3 Batching version 0.15.
It solved that problem, but created another problem. The bones rotation doesn't work properly.
Maybe the problem is my GPU, but everything works fine in DragonBones.
Could you try to run my attached project? If it works well for you, then I'll need a new notebook.
Comparison video: https://youtu.be/UulQuP0ToCI

@lawnjelly
Copy link
Member

lawnjelly commented Oct 6, 2020

It's more likely there is a small bug in the new 2d software skinning.

There was a small area where I resorted to guesswork, I only had one test project, so it should be quite simple to fix when I have more test cases. Basically the case was where the weights didn't add up to 1.0, or when no weights were applied. I'm really waiting on testing to identify the correct way of doing this, you are the very first tester!

When I tried your project yesterday it seemed the same between the software and old path, but I didn't try bone rotation I'll have a look. 👍

I'm pretty sure you don't need a new notebook. 😄

@edaojs would you be able to make a version of the the project where it exhibits this behaviour that is incorrect for you? Just something I can run and it shows the bug. I am unfamiliar with the user interface for 2d bones etc. and it will allow me to fix it quicker, as I don't know what I should be looking for. Assume I'm an alien who doesn't know how to use godot and that won't be far from the truth (I've never made 2d game in it lol).

@edaojs
Copy link
Author

edaojs commented Oct 6, 2020

@lawnjelly I appreciate your help. I really need Godot for this project, it will be impossible to make it in Love2D.
Maybe the video wasn't clear enough, but now I've put some subtitles, I think the bug is clear to see.
new video: https://youtu.be/J7u6Fkg5zwA
Just let me know if it is not enough , then I will try to make a new video or a new project.

@lawnjelly
Copy link
Member

lawnjelly commented Oct 6, 2020

Yeah I think I see what is going wrong, but I need a project with the vertices weighted to the bones so I can debug it.

Edit: Ok I gave up and figured out how to do the weights lol. Yup there is something wrong in the hierarchy I should be able to fix. 👍

@edaojs
Copy link
Author

edaojs commented Oct 6, 2020

@lawnjelly there it goes.
just open the project and click "play"
GodotTest.zip

you should see something like this:
attack

@lawnjelly
Copy link
Member

Thanks! 👍 I'm debugging it at the moment.

Getting skinning working is always a bit finicky and there are a few transforms available and with no comments in the code it's a case of trial and error to work out what each does and fit them together in the right order. I'm confident it should work fine though once I've cracked it .. it might be in a few days though, as I have to go away from home again.

Once it is working I'll do another build.

@lawnjelly
Copy link
Member

lawnjelly commented Oct 10, 2020

Back home and after spending some time this morning I've finally tracked this down. It was down to an offset on the polygons used to rig the model. God only knows why it actually works in the original shader version lol. 🤣

And actually I there is a AABB bound check somewhere else pre-existing in the CPU side code for culling that doesn't take this into account which may also be buggy I'll double check this, fix two bugs at once kind of thing.

I'll possibly do a bit of rearranging to make it more efficient, then will need to rebase the PR after Pouley's skinning, then see if I can make a new build for testing. 👍

Okay try build 0.16, see if that fixes it for you:
https://github.com/lawnjelly/Misc/releases

@edaojs
Copy link
Author

edaojs commented Oct 14, 2020

@lawnjelly thank you for replying.
It still weird... the skins are stretching when I move the bones.
Sadly, I tested the same code on my nephew's PC, and it was running perfectly!
I need a new notebook.
Anyway, thanks for your help. I appreciate

@edaojs edaojs closed this as completed Oct 14, 2020
@lawnjelly
Copy link
Member

lawnjelly commented Oct 15, 2020

Double check you have 2d skinning switched on in build 0.16 (project_settings->rendering->quality->2d->use_software_skinning), and batching (project_settings->rendering->batching->options->use_batching).

NOTE that 2d skinning is NOT the same as 3d skinning (project_settings->rendering->skinning), this may also be available in your build, I'm not sure. We may have to consider renaming the 3d skinning options to make it clear that these are totally separate.

I'll check I haven't made some mistake in the build. If you are running the test project you gave me, it should either run completely correctly or not at all.

There should be no situation with skin stretching possible using that path, unless you are using a different project (in which case there may be another bug to fix). This is very likely a mistake on my side.

It is very unlikely your computer is at fault. With software skinning the calculations are done on the CPU, and all CPUs can do this. The GPU is only showing on the screen the positions calculated on the CPU. This is very different from GPU skinning, where huge variations in hardware can lead to the process failing.

EDIT the 0.16 build does have the 2d skinning option. So unless it is not being activated I can't immediately see what is going wrong, providing you were running 0.16 build. We will soon be making some betas, be sure to try them too, maybe there was some mistake I made in the build process.

@lawnjelly lawnjelly reopened this Oct 15, 2020
@edaojs
Copy link
Author

edaojs commented Oct 16, 2020

@lawnjelly the option "use software skinning" was unchecked !
I checked and it works perfect now! Thank you very much!

@lawnjelly
Copy link
Member

lawnjelly commented Oct 17, 2020

Yay!! 😁

Actually I'll leave open till PR merged.

@lawnjelly lawnjelly reopened this Oct 17, 2020
@akien-mga akien-mga added this to the 3.2 milestone Oct 21, 2020
@akien-mga
Copy link
Member

Fixed by #42119.

pouleyKetchoupp added a commit to nekomatata/godot that referenced this issue Jan 21, 2021
These changes revert the part of godotengine#42576 that was skipping rest info
checking when no collision occurred in the motion check.

That allows to make floor detection consistent by checking for rest info
even if there was no collision during the motion (godotengine#45259).

On the other hand, one-way collision need another fix in order to avoid
inconsistencies between motion check and rest info check that causes
bugs like godotengine#25967. This is done by restoring valid_depth in rest info
check and set it the same way as in motion check.

Also making minor changes in _rest_cbk_result in order to early exit by
doing depth tests first, before extra calculations for normal checking.

Fixes godotengine#45259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants