Hi ! I've been playing around with the procedural examples, eagerly searching for something to read along with the examples. So, after reading the CrumpleMesh.js which appears to be quite straightforward, I tried to apply it to a more detailed subdiv mesh i modeled, and the strange thing, is that it wobbles around the screen randomly. would look like some kind of pivot misplacement, but I also tried resetting it, and transformations, both in my modelling program, and in unity, without luck. Here's visually what happens, sphere on the left, is the example one, the one on the right is the one i modeled, and to which I applied the same script. Uploaded with ImageShack.us And here's what happens when i hit play: the second sphere is squashed, and floating around, while the first correctly deforms. Uploaded with ImageShack.us Here's the code i'm using Code (csharp): // This script is placed in public domain. The author takes no responsibility for any possible harm. var scale = 1.0; var speed = 1.0; var recalculateNormals = false; private var baseVertices : Vector3[]; private var noise : Perlin; function Start () { noise = new Perlin (); } function Update () { var mesh : Mesh = GetComponent(MeshFilter).mesh; if (baseVertices == null) baseVertices = mesh.vertices; var vertices = new Vector3[baseVertices.Length]; var timex = Time.time * speed + 0.1365143; var timey = Time.time * speed + 1.21688; var timez = Time.time * speed + 2.5564; for (var i=0;i<vertices.Length;i++) { var vertex = baseVertices[i]; vertex.x += noise.Noise(timex + vertex.x, timex + vertex.y, timex + vertex.z) * scale; vertex.y += noise.Noise(timey + vertex.x, timey + vertex.y, timey + vertex.z) * scale; vertex.z += noise.Noise(timez + vertex.x, timez + vertex.y, timez + vertex.z) * scale; vertices[i] = vertex; } mesh.vertices = vertices; if (recalculateNormals) mesh.RecalculateNormals(); mesh.RecalculateBounds(); } Thank you for your time, if anybody can point me to a simpler approach to perlin noise deformation on an arbitrary mesh, i would really appreciate that. have a good day !
silly me appearently, the problem solved itself, when I set the scale factor, in the import options of my model, to 1 instead of 0.1 hope this helps people with my same issue, but post is still open for suggestions on where to read something more about procedural approach to unity. have a good day !
Sorry to wake up an old thread, But I am looking to do something similar, only I wish to make one offset (for spherical terrain generation) then be done with it. how would I go about doing this sort of thing? I also wish to have this done with a texture, so I can feed said texture into a shader for some nice special fx work. Oh, and I am doing this so that the mesh collider can be then updated with the new mesh.