public override void Modify(MegaModifiers mc) { for (int i = 0; i < verts.Length; i++) { Vector3 p = tm.MultiplyPoint3x4(verts[i]); float ipy = p.y; float spx = p.x * scale + 0.5f; //half; float spz = p.z * scale + 0.5f; //half; float dist = Mathf.Sqrt(p.x * p.x + p.z * p.z); float dcy = Mathf.Exp(-decay * Mathf.Abs(dist)); float dy = 0.0f; if (Fractal) { dy = iperlin.fBm1(spx, spz, time, rt, 2.0f, Iterations); } else { dy = iperlin.Noise(spx, spz, time); } p.y += dy * Strength; p.y = ipy + ((p.y - ipy) * dcy); sverts[i] = invtm.MultiplyPoint3x4(p); } }
public override Vector3 Map(int i, Vector3 p) { p = tm.MultiplyPoint3x4(p); Vector3 ip = p; float dist = p.magnitude; float dcy = Mathf.Exp(-totaldecay * Mathf.Abs(dist)); sp.x = p.x * scale + 0.5f; sp.y = p.y * scale + 0.5f; sp.z = p.z * scale + 0.5f; if (Fractal) { d.x = iperlin.fBm1(sp.y, sp.z, time, rt, 2.0f, Iterations); d.y = iperlin.fBm1(sp.x, sp.z, time, rt, 2.0f, Iterations); d.z = iperlin.fBm1(sp.x, sp.y, time, rt, 2.0f, Iterations); } else { d.x = iperlin.Noise(sp.y, sp.z, time); d.y = iperlin.Noise(sp.x, sp.z, time); d.z = iperlin.Noise(sp.x, sp.y, time); } p.x += d.x * Strength.x; p.y += d.y * Strength.y; p.z += d.z * Strength.z; p.x = ip.x + ((p.x - ip.x) * dcy); p.y = ip.y + ((p.y - ip.y) * dcy); p.z = ip.z + ((p.z - ip.z) * dcy); return(invtm.MultiplyPoint3x4(p)); // + Vector3.Scale(d, Strength)); }
public override Vector3 Map(int i, Vector3 p) { p = tm.MultiplyPoint3x4(p); p.x += iperlin.Noise(timex + p.x, timex + p.y, timex + p.z) * scale; p.y += iperlin.Noise(timey + p.x, timey + p.y, timey + p.z) * scale; p.z += iperlin.Noise(timez + p.x, timez + p.y, timez + p.z) * scale; return(invtm.MultiplyPoint3x4(p)); }
public Vector3 AddNoise(Vector3 p) { Vector3 sp = (p * noisescale * scale) + half; p.x += iperlin.Noise(sp.y, sp.z, 0.0f) * strength.x; p.y += iperlin.Noise(sp.x, sp.z, 0.0f) * strength.y; p.z += iperlin.Noise(sp.x, sp.y, 0.0f) * strength.z; return(p); }
public override void Modify(MegaModifiers mc) { for (int i = 0; i < verts.Length; i++) { Vector3 p = tm.MultiplyPoint3x4(verts[i]); sp.x = p.x * scale + 0.5f; sp.y = p.y * scale + 0.5f; sp.z = p.z * scale + 0.5f; if (Fractal) { d.x = iperlin.fBm1(sp.y, sp.z, time, rt, 2.0f, Iterations); d.y = iperlin.fBm1(sp.x, sp.z, time, rt, 2.0f, Iterations); d.z = iperlin.fBm1(sp.x, sp.y, time, rt, 2.0f, Iterations); } else { d.x = iperlin.Noise(sp.y, sp.z, time); d.y = iperlin.Noise(sp.x, sp.z, time); d.z = iperlin.Noise(sp.x, sp.y, time); } p.x += d.x * Strength.x; p.y += d.y * Strength.y; p.z += d.z * Strength.z; sverts[i] = invtm.MultiplyPoint3x4(p); } }