JackFalcon Posted December 14, 2017 Share Posted December 14, 2017 QUESTION: How to make a fish tail move? So this is a (brief) STUDY in FISH PHYSICS Hoping this helps others with fish. Here goes... Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 ((what)=>{return 'thehell';})(); ? JackFalcon and Arte 1 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 DESIGN #1: 3 parts: middle: side-to-side, front and back: rotate y, at different rates. Head less, tail more... Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 Ohh your gonna post more stuff about it ok, now Im a little less confused! was not sure if this was a question or a statement... Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 Study is a question looking for a statement .. idk. -> Good to see you again master ninja. +1 to the efficiency of fat-arrow for single-line expressions! QUESTION: How to make a fish wiggle? In progress... Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 Blend meshs and or a rig with animations. I would do blend meshes, and have like a sin or cos algorithm that is based off of fish speed and make it bounce between 3 mesh variants: idle, maxleft, maxright. Sorry I'm at work and this is rushed hope that makes since Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 That is awesome Mr. @Pryme8. Likes the approach... tomorrow (out of likes today [once again]). So, looks forward to it! The search is for the simplest & fastest implementation of --> Low-Perfection-Fish-Physics. Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 UPDATE: Ready to wiggle.... var createAFish = function () { var aBox = BABYLON.Mesh.CreateBox("box", 1, scene); aBox.position = new BABYLON.Vector3(0,1,1); var aSphere = BABYLON.MeshBuilder.CreateSphere('', {diameter: 1}, scene); aSphere.position = new BABYLON.Vector3(0,1,0); var aRect = BABYLON.Mesh.CreateBox("box", 1, scene); aRect.scaling = new BABYLON.Vector3(0.2,0.6, 1); aRect.position = new BABYLON.Vector3(0,1,-1); } Will it work? We'll see! Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 http://www.babylonjs-playground.com/#5LGGZJ Just need to make it smooth blending now. BitOfGold 1 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted December 14, 2017 Share Posted December 14, 2017 Wiggle in vertex shader, with no physics? Just an idea JackFalcon and Pryme8 2 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 That actually sounds like the best solution, but I figured he was doing this to include collision detection. Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 Yes - collision detection. @BitOfGold oh really? Hmmm... vertex shader, didn't think of that. Interesting... @Pryme8 -> really gr8! Double-likes ... and how did you do that? <looking> Thank you for intro to mrFish._blend(); Wow! Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 13 minutes ago, aFalcon said: Yes - collision detection. @BitOfGold oh really? Hmmm... vertex shader, didn't think of that. Interesting... @Pryme8 -> really gr8! Double-likes (tomorrow)... and how did you do that? <looking> Thank you for intro to _blend Wow! Keep in mind that is really rudimentary and can be done in a way better manor, but that can serve as an example to make something cool. If you really want to make it sing, a animation blending algorithm needs to be implemented which will smooth all this up. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 http://www.babylonjs-playground.com/#5LGGZJ#2 Super crappy structure, but yeah... The blending is based off of this algo: x*(1-a)+y*a Arte and BitOfGold 2 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 Oh yeah, whoooooah! making sense.... Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted December 14, 2017 Share Posted December 14, 2017 First I read the topic title as "Phil Fish" Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 @BitOfGold I'll let you "phil" my fish BitOfGold 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 This thread is about fish-physics!!! c'mon ppl, Lol... Here was the result of Design #1 - using lookAt(): https://www.babylonjs-playground.com/#PHMP7X @Pryme8 wins bigtime! afalcon... learning. Arte 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 14, 2017 Author Share Posted December 14, 2017 @Pryme8 really cool tracking through the use of animationMeshs, of 3 different poses to newDat.applyToMesh(this.mesh);. Cool. QUESTION: is _blend also morph target? Havn't dug into that 1 yet either... Thx! Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 14, 2017 Share Posted December 14, 2017 That function is technically a method for morphing yes. When I get home and have a second (hopefully this evening). I’ll make a better demo for you with a real fish model, and maybe some controls. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 20, 2017 Author Share Posted December 20, 2017 Hey @Pryme8 thank you. All good on this. Although, happy to see solution, like your style. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 20, 2017 Share Posted December 20, 2017 ^_^, I was thinking about this the other day... and I think @BitOfGold was on the right path wanting to do it with a shader. I was thinking you could do a sin algo to displace the vertices from a point on the fish (behind the head) and use a texture weightmap to control the intensity in locations. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted December 20, 2017 Author Share Posted December 20, 2017 Hey yeah, you nailed it @Pryme8, here's low-fidelity solution (for now, until morphin-power-ranger skills gained...): scene.registerBeforeRender(function() { wiggleSpeed1+=0.18; body.position.x += (Math.sin(wiggleSpeed1)*0.025); head.lookAt(merphbugbody.position) tail.lookAt(merphbugbody.position) } }); https://www.babylonjs-playground.com/#PHMP7X Oh, but sine displacement, cool... yeah? Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 20, 2017 Share Posted December 20, 2017 @aFalconhttp://pryme8.github.io/fish/ All this needs is the weight map, and then to shift the sin oscillation down the fish instead of keeping it in place. @BitOfGold <- ALL GPU just for you buddy <3 And there are definitively some fixes that need to happen because as this is it "stretches" the fish, so the displacement side to side needs to have a displacement forward as well to make it look like the fish is swishing and not just magically making new skin. A fade of the intensity of the sin wave from the head is needed as well. *edit* Added the fade from the head, and made some adjustments. Now I need to make the sin wave "move" down the fish instead of just oscillate.@jerome or @NasimiAsl how would I make the sin do that? Im kinda drawing a blank, I was thinking maybe just adding a offset to the position (using the same time algo) that is then moded into range? BitOfGold, jerome and JackFalcon 3 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted December 21, 2017 Share Posted December 21, 2017 @Pryme8 Cooooooooooooooooool!distance(p.z, fishHead); :D:D:D 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.