From: mike pitman <pitman@us.ibm.com>
fixes the terrain spikes, and is the result of mostly a tuning operation on the smooth and flatten tools. I dug in and found that the spikes apparently result from smooth's overly aggressive iteration steps toward the average curvature, which leads to an instability that blows up the heights. I introduced a scaling factor to dampen the 'duration' parameter which tames progress and seems to keep things stable.0.6.0-stable
parent
e4ca8e613a
commit
0e2edbb5d4
|
@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
double step2 = 0.0;
|
double step2 = 0.0;
|
||||||
|
double durationFactor = 0.15; //MCP: tuned, but would be nice to come from ini file
|
||||||
|
|
||||||
// compute delta map
|
// compute delta map
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
|
@ -65,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
|
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration * durationFactor;
|
||||||
|
|
||||||
if (z > 0) // add in non-zero amount
|
if (z > 0) // add in non-zero amount
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
double area = strength;
|
double area = strength;
|
||||||
double step = strength / 4.0;
|
double step = strength / 4.0;
|
||||||
|
double durationFactor = 0.15; //MCP: tuned, but would be nice to come from ini file
|
||||||
|
|
||||||
// compute delta map
|
// compute delta map
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
|
@ -80,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
double da = z;
|
double da = z;
|
||||||
double a = (map[x, y] - tweak[x, y]) * da;
|
double a = (map[x, y] - tweak[x, y]) * da;
|
||||||
double newz = map[x, y] - (a * duration);
|
double newz = map[x, y] - (a * duration * durationFactor);
|
||||||
|
|
||||||
if (newz > 0.0)
|
if (newz > 0.0)
|
||||||
map[x, y] = newz;
|
map[x, y] = newz;
|
||||||
|
|
|
@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
public static double MetersToSphericalStrength(double size)
|
public static double MetersToSphericalStrength(double size)
|
||||||
{
|
{
|
||||||
return Math.Pow(2, size);
|
//return Math.Pow(2, size);
|
||||||
|
return (size + 1) * 2.0; // MCP: a more useful brush size range
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double SphericalFactor(double x, double y, double rx, double ry, double size)
|
public static double SphericalFactor(double x, double y, double rx, double ry, double size)
|
||||||
|
|
Loading…
Reference in New Issue