   Terrain Editing Brush question
  Hi,I have a simple question: How do I create brush like this Click for terrain editing. I have already implemented terrain editing, but just quick and dirty crap.I also want to make the Hardness/Strength of the brush "adjustable".Thanks   
  You could probably define that brush with two radius values. Measure the distance from the center of the brush, and compare with the two radii to compute a weight value indicating how much the vertex is affected.for each vertex within the bounding box of the brush:  dist = distance( brush center, vertex position )  if dist < min_radius    weight = 1  else if dist > max_radius    weight = 0  else    weight = (dist-min_radius) / (max_radius-min_radius)  vertex.height += strength * weight;  I'm doing something similar as suggested for raise/lower brush.(But somehow trasitions are not that smooth)However, the brush I wanted to create is used to flatten the terrain by given heightvalue.(as you can see in the above link)how do I achieve this?Thanks   ;  Ive coded this before, you can treat it like a sculpting program, its similar to coding something like zbrush, www.zbrushcentral.com.First you need a way of picking the landscape in 3d (maybe youve done this already?)But one way to do this is with a worldspace coordinate render, render x y and z worldspace positions of the mesh to record with a floating point texture, stick the x in red y in green z in blue and you can gather the brush centre by measuring the x and z at the pixel the mouse is at.then brushes I use are a build brush and a flatten brush, but theres no end to the amount of brushes you can make.the flatten brush I coded actually could flatten the terrain to any angle, what you do is make a plane in the vicinity of the brush using the normal of the landscape at the centre of the brush and then ray intersect all the vertices to hit the plane equation and theyll sit on a plane at any angle - you then roll it off in effect as it gets to the ends of the brush.But as I said, anything you could think of could be useful in map production.;  Is texture (mask)painting done in a similar manner. Transitions of the paintings look awful. How do I create smooth gradients like in painting softwares. How is this generally implemented?Thanks   ;  Maybe I just dont get the question but it seems you want to smooth the brush result into the existing terrain. So its rather simple: The more distant your terrain point is from the brush's center the less effect the brush has. Just treat it as a spot light with two cones (use two radii as already suggest by other poster above).The inner cone (radius) applies the requested height for all terrain points inside this inner radius. But in the outer radius you start to smooth the result. That means for all terrain points inside the outer radius (but not inside the inner radius) you apply the flattening like so:original_terrain_height += d * (original_terrain_height - flattening_height)With d being 1.0 for points right at the edge between the inner and outer code (value of the inner radius) and d being 0.0 for terrain points right on the edge of the outer radius. As you can see d falls off the more distant your terrain points are from the inner radius where the outer cone starts until it reaches 0 at the outer radius.This is a linear fall off. But you can easily come up with other types of fall off such as squared distance to have a progressive effect. But that's how it basically works.   ;  I think, I have flatting brush already. Above question was about texture mask painting, to composite terrain textures I need to paint them.So, if I do this in a similar manner as terrain editing, do I need a CPU copy of the mask texture? Because I want to smooth mask values perhaps...   ;  Masking isn't that difficult of a problem. At 4bpp you can store a significantly sized terrain mask in memory to use for your modifications.We used masks for our terrain system in two modes:1. Batch selection / operation: Applying a specific brush to a selected area2. Don't-Edit areas : Areas that were masked out were not able to be modified by standard brushes (ie you could only edit them through the batching process)~Main