Comments (15)
ok thanks for replay, i understand. I didn't know to modify that script before,but now understand. thanks agian. I would like to ask another question. The character uses abc file to generate a file and attach it to the character, but when the character moves, the hair is not correct and will fly around. I try many parameters settting , but there is no effect, but static objects will ok. thanks
we should not use the Github issues to discuss general use of the library, especially not in a thread with completely different topic, as this will be no help for the developers of the library. Your best bet would be to ask the question on Unity forum.
from com.unity.demoteam.hair.
After more investigation, changing the code to execute in "FixedUpdate" does resolve the issue.
Please, add an option to execute either in (Late)Update or in FixedUpdate, later is absolutely necessary to use the Hair in a Physics based environment.
from com.unity.demoteam.hair.
@qlee01 thanks job,want to know more detials for fixed this,thanks
from com.unity.demoteam.hair.
@qlee01 thanks job,want to know more detials for fixed this,thanks
can you explain better what you mean? What I describe in this issue is that the Hair does not play nicely if you update the position within FixedUpdate, as the class "HairInstance" does update on LateUpdate. In order to fix this, HairInstance.cs needs to be changed to make it switchable whether the hair gets updated during LateUpdate or FixedUpdate. This is a usual thing in many components / libraries for like animation, cloth, and hair simulation, as in some projects everything is driven by Physics, and in this case updated in FixedUpdate.
from com.unity.demoteam.hair.
ok thanks for replay, i understand. I didn't know to modify that script before,but now understand. thanks agian.
I would like to ask another question. The character uses abc file to generate a file and attach it to the character, but when the character moves, the hair is not correct and will fly around. I try many parameters settting , but there is no effect, but static objects will ok. thanks
from com.unity.demoteam.hair.
@qlee01 thanks,I think the unity demoteam ditched the actual users, thanks for the advice
from com.unity.demoteam.hair.
Hi. The hair simulation is stepped [minSteps, maxSteps] for every rendered frame, with the simulation "time step" being defined by the frequency. Currently, if you want to ensure that it steps every visual frame when the simulation frequency is lower than the render frequency, currently you have to set minSteps to 1. This will change in the future.
from com.unity.demoteam.hair.
@fuglsang I actually did set it to 1 already at simulation frequency of 60 Hz; still I get jittery movement. This seems to be more prominent whenever the GPU load gets higher.
from com.unity.demoteam.hair.
@qlee01 Hmm, I see -- that does not sound right. Please post the steps to reproduce this behavior, so I can take a closer look at what is happening there.
from com.unity.demoteam.hair.
@qlee01 Hmm, I see -- that does not sound right. Please post the steps to reproduce this behavior, so I can take a closer look at what is happening there.
This is not easy. In my scenario, this happens all the time, no matter what parameters I choose.
The prerequisites:
- Moving the hair (by actually moving the transform of the hair). I tried this both synched with my FixedUpdate, and with interpolation in Update, based on rotation and position I got from another transform which is moved with FixedUpdate rate.
- Have high load on GPU (like 12ms+); on lower loads the jittery is much less, sometimes even completely gone.
I basically tried all thinkable approaches to minimize jitter, but it seems something with position or rotation interpolation seems to be weird inside the Hair package.
I also don't think it is based on collision, but with collision on it can become worse than without.
from com.unity.demoteam.hair.
@fuglsang I had a bit deeper look. Seems the collider are making things much worse. I think it would be good to normalize the collision response by delta time, I added something like this to test it out, and in my case gives better results:
void ApplyCollisionConstraint(inout float3 p)
{
float3 d = 0.0;
SolveCollisionConstraint(1.0, p, d);
p += d * _DT * _CONSTANT_COLLISION_RESPONSE;
}
void ApplyCollisionFrictionConstraint(const float friction, const float3 x0, inout float3 p)
{
float3 d = 0.0;
SolveCollisionFrictionConstraint(friction, x0, 1.0, p, d);
p += d * _DT * _CONSTANT_COLLISION_RESPONSE;
}
EDIT: The constant factor might not be needed, as we can compensate via "collision margin".
from com.unity.demoteam.hair.
@fuglsang I was finally able to resolve all jittery issues, but only by changing the code of HairInstance, and putting an execution order to the meta file.
I would suggest the following easy solution: Offer an "explicit" update mode, where we are able to call the update manually, instead of relying on update happening on "LateUpdate" with no possibility to change the execution order.
This would give highest flexibility, and with this all synchronization issues would be easily solvable without changing the code.
from com.unity.demoteam.hair.
@qlee01 Thanks for the update! I've added an option to let application code explicitly trigger updates/dispatch -- I hope this fits your needs, otherwise please reopen the issue. :)
from com.unity.demoteam.hair.
@fuglsang great, thanks, will test it out asap.
from com.unity.demoteam.hair.
did a test, works as expected. FYI, I still need to add the little change with _DT (delta time) in the constraints compute shader to get rid of artifacts. I guess it's due to the issues with Mesh2SDF producing artifacts on more complex meshes.
I use the new update method like this, hope this is correct (sorry for the formatting, did not find an option for line breaks):
void UpdateHair(float deltaTime) { var cmd = CommandBufferPool.Get(); { if (hairInstance.DispatchUpdate(cmd, CommandBufferExecutionFlags.None, deltaTime)) { Graphics.ExecuteCommandBuffer(cmd); } } CommandBufferPool.Release(cmd); }
from com.unity.demoteam.hair.
Related Issues (20)
- Changes in UV data HOT 2
- Generate UVs for strands in order to work with HDRP Physical Hair Shader (HDRPSamples/PhysicalHair_Ribbon) HOT 1
- Alembic scene scale ruins the UV mesh resolving HOT 1
- Line Rendering Compositing Depth pass order HOT 2
- Feature request: Dynamic strand diameter HOT 2
- NaNs in latest update of hair package HOT 2
- Inquiry about VisionPro Device Compatibility with Unity's Hair System HOT 2
- can not install from package manager
- automatic migration of newer version of the package messes up LODs
- After importing this package, it prompts "Invalid worldAABB. Object is too large or too far away from the origin." and a suggestion. HOT 3
- HQ line renderer Upscale low resolution effect
- Using Alembic curves as guide lines to generate more curves for hair strands at runtime
- Surface type Hair Strand mode tanget normal not working
- Unity is crashing HOT 9
- SDF collisions are broken HOT 6
- Changing values in Play mode sometimes breaks Hair instance
- Unreal like non physics Static mesh LOD and Auto Hair Card LOD HOT 2
- Feature request / clarification: Translation of density probe texture HOT 1
- SDF collision does not respect scale of SDF HOT 1
- Preview for some hair assets seems broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from com.unity.demoteam.hair.