Search Unity

Procedural Springs

Discussion in 'Works In Progress - Archive' started by SpookyCat, Nov 24, 2014.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    Finally got around to converting our procedural spring system from our 3ds Max plugin and also our own game engine to Unity so we can use it on our game project and as a test for playing with and altering the new PBS Shaders in Unity 5. The PBS shader has been converted to be able to handle the deformation of a spring compressing and stretching, the spring mesh is procedural with numerous options to define the length, coil rate, coil spacing, spring diameter etc. The deformation of the spring is handled totally in a shader and the system also has a built in LOD system which automatically generates LOD versions of the spring and then manages those. And there is also a spring reference system so the spring data can be shared amongst multiple instances to keep memory use as low as possible. Anyway video below showing the system in action with the fab new PBS Shaders.
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Hey Spooky awesome looking stuff.

    The deformation of the spring being handled by the shader completely baffles me! Really that's awesome though!
    But please forgive my ignorance, wouldn't it be more logical to have the deformation of the spring control the shader? i.e. The more compressed the spring gets the "redder" it gets.
    Could you explain the benefit of having a shader control the deformation instead of the other way around?

    I worked with the dynamic spring object in Max for several military project pieces and I ended up using the binding influence to animate the spring then linking the bind control object to one of the two actuator parts. Then I wired the actuator motion to a slider so anybody could use it without messing it up. When the actuator would open or close the spring would dynamically compress/stretch.
    Of course as is with most cases setting up even small hierarchical systems like that are considerably easier in Max than they are in Unity. For me anyway.
     
  3. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    @theANIMATOR2b - Sorry didn't get a notification about your post. The spring tells the shader the length of the spring and the shader will transform the vertices so the resulting output is correct. The spring system is based on the Max one so you just link the ends to objects and as they move a length value is computed depending on whether the ends are locked or not (the yellow spring is not locked in the video above the other two are) and passed to the shader so it just works.
     
    theANMATOR2b likes this.
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Will this be available in the Asset Store?
     
  5. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    Any news?
     
  6. tfaith08

    tfaith08

    Joined:
    Jul 8, 2015
    Posts:
    1
    Also curious about this. Will it be in the asset store? Is the ability to use multiple springs (multiple springs rates) on the same shock?
     
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    We got such little feedback on the system we decided that perhaps it wasn't really needed so we never got it ready for the Asset Store. If there is interest then I could get it split out from our car system and made into an asset again. @tfaith08 You are free to make as many springs as you like between objects, but just to say these are just mesh objects they are not physics objects, they are purely used to have a better looking spring with LODs etc in our car objects.
     
  8. ZBS8BIT

    ZBS8BIT

    Joined:
    Nov 2, 2016
    Posts:
    1
    Let us know if you ever get this up in the asset store. My current project requires me to import an animated .fbx which utilizes the dynamic 3DS Max springs. Of course, that animation doesn't come through since Unity can't import those kinds of skin deformation animations. I'm sure there's a demand for something that makes it easier to import springs.

    Side note, this is my first post to Unity Forum...shout out to theAnmator2b !
     
    theANMATOR2b and alexanderameye like this.
  9. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    @SpookyCat it's a shame you didn't release this.
     
    joacoremis likes this.