JCPalmer Posted June 28, 2017 Share Posted June 28, 2017 I am continuing my work on Particle Hair. I can transfer vertices without faces in Tower of Babel. See: Matrix weights / indices are not really capture-able, so I am just trying to generate them. If they need to be generated, might as well do it in Javascript vs Python and save the transfer bandwidth. I was not going to get real fancy with the number of influencers, just 1. As soon as I add the skeleton, the Hair (LinesMesh) dis-appears. I added both vertex colors & skeletons to LinesMesh for 3.0. I really wanted to get this working prior to 3.0 production. I could just be having a mental block, so I tried to do the simplest playground scene. If you change the if (1 === 0) to if(1 === 1), it also disappears. Any clues? Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Share Posted June 29, 2017 This looks amazing! Though, you need a good PC to handle this. But, what is the question? I see the playground has the skeleton. Try to move it around? And make it ragdoll-type? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2017 Share Posted June 29, 2017 This should work.Let me have a look JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 29, 2017 Author Share Posted June 29, 2017 @Borislav, it is not even combed yet! My objective is for the LineMesh to simply stay with the rest of the body. Parenting to body will keep it at the same origin as body if body position or rotation changes. If the head turns, or knees bend, the hair will not move along with it without also using the skeleton. For head turning purposes, I am specifying a stiffness factor. If you said, 0.5 & a strand had 5 segments (6 vertices): Then the weights from scalp out would be: 1.0, 0.9, 0.8, 0.7, 0.6, & 0.5. Having a lower value at the end means it would not rotate as much. This is really needed for longer hair, or the hair would cut through the body when turning. With my hero, checking on what might be wrong, I moved ahead, & have finally figured out how to add a custom panel onto particle properties tab. Took me all day & part of yesterday to figure out. Nobody must be doing this, Googling will not get you even a close answer. May try to add more control (color, patterns), if I get what I got now to run: Kind of disagree about the high end pc comment. This is a single mesh, so single draw. No texture, so very simple fragment shader. Vertices / segments are removed during export using Limited Dissolve operation. Oh yeah, might add degree control for the dissolve in UI. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Share Posted June 29, 2017 14 minutes ago, JCPalmer said: @Borislav, it is not even combed yet! My objective is for the LineMesh to simply stay with the rest of the body. Parenting to body will keep it at the same origin as body if body position or rotation changes. If the head turns, or knees bend, the hair will not move along with it without also using the skeleton. For head turning purposes, I am specifying a stiffness factor. If you said, 0.5 & a strand had 5 segments (6 vertices): Then the weights from scalp out would be: 1.0, 0.9, 0.8, 0.7, 0.6, & 0.5. Having a lower value at the end means it would not rotate as much. This is really needed for longer hair, or the hair would cut through the body when turning. With my hero, checking on what might be wrong, I moved ahead, & have finally figured out how to add a custom panel onto particle properties tab. Took me all day & part of yesterday to figure out. Nobody must be doing this, Googling will not get you even a close answer. May try to add more control (color, patterns), if I get what I got now to run: Kind of disagree about the high end pc comment. This is a single mesh, so single draw. No texture, so very simple fragment shader. Vertices / segments are removed during export using Limited Dissolve operation. Oh yeah, might add degree control for the dissolve in UI. That is very complicated :/. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2017 Share Posted June 29, 2017 I cannot test as my version of LinesMesh does not support bones can you PR your change? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 30, 2017 Author Share Posted June 30, 2017 It is not directly in the LinesMesh class itself. The Geo is in Mesh. The material, ShaderMaterial, assigns matrix weights indices & number of influencers attributes (I stole what Sebavan did for HighlightLayer.isReady). The Color.vertex.fx got stuff added for bones at the same time as vertex colors. This is the PR. I probably have messed something up. At least with this Playground that looks like it should be a valid test, it might be debugged without dragging my massive generated data. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 30, 2017 Author Share Posted June 30, 2017 Actually, now I am remembering from the very end of how far I got in my initial push in April. After I went thru all the changes to all those files, I realized that LinesMesh was mostly a "glue job" of other pieces. It could actually be made with BABYLON.Mesh & a standard material. You commented that the fragment shader of StandardMaterial might not be as efficient, I think. There are also other reasons for ShaderMaterial to be able to use skeletons, not just Lines. If you could figure out what I got wrong, I think I am going to refactor my QI.Hair class to inherit from QI.Mesh not BABYLON.LinesMesh. Still use ShaderMaterial. Then I might be able to computer generate shapekeys for bounce up, it the character is running or something. LinesMesh could use the 3.0 morph facility, but I would not to mix the 2 different methods. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 30, 2017 Share Posted June 30, 2017 Fixed now https://github.com/BabylonJS/Babylon.js/commit/c7ee18dd1553de244515d37ee25467eae394e283 JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 30, 2017 Author Share Posted June 30, 2017 I need do something, but if I do not try later today, with work tomorrow (slacking off in the near future is highly probable). Yeah, it might be nice to actually send the values of the bone matrices to the vertex shader. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 1, 2017 Author Share Posted July 1, 2017 Complete success when stiffness is set to 1.0. The example shown in first post looks like a brush head firmly stuck on the head as the character moves. I need to work to verify that this strategy of limpness works for long hair works as head turns. That is at my level though, not framework. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.