michael.zhang Posted October 31, 2011 Posted October 31, 2011 Hello, I am using an ObjectGrass as a child or ObjectMesh to render grass across the mesh which is used as a terrain. I have tried to create a grass_mask that would specify what regions of the terrain should have grass on it. However, I am unable to align the ObjectGrass with the ObjectMesh. Also, it seems like I may be creating the grass_mask incorrectly. Generally speaking, it seems to me that using an arbitrary static mesh presents problems with aligning a grass mask with a non-square mesh. (It happens to be in this test case, but will not be in other cases). Is there another approach that I can use to achieve this effect? data.zip
ulf.schroeter Posted October 31, 2011 Posted October 31, 2011 However, I am unable to align the ObjectGrass with the ObjectMesh. Michael, what do you exactly mean by 'align' OG with OM ? size/position ?
michael.zhang Posted November 1, 2011 Author Posted November 1, 2011 I mean that if you use a detail_mask for the objectMesh which is using the mesh_terrain_base's detail mask (which specifies which parts are for example grass colored), and a detail_mask for where the grass should be rendered, that is based upon the terrain's detail mask (the grass colored terrain should grow grass), how do you get these to align?
ulf.schroeter Posted November 1, 2011 Posted November 1, 2011 ok, understood. Best guess: assuming you use a rectangular terrain mesh with uv-range [0..1] for the corners you could extract (e.g. in photoshop) the color channel used for grass from your terrain's detail mask image, save this color channel as grayscale image (1=grass, 0=void) and then assign it as mask for ObjectGrass. Of course child ObjectGrass should have same size/orientation as parent ObjectMesh.
michael.zhang Posted November 2, 2011 Author Posted November 2, 2011 Okay, after ALOT of trial and error, I finally figured out what the mask needs to be like to properly control where the grass grows. BUT, it is impossible to align because the masks are mirror images, as opposed to rotations, of eachother. The workaround is to flip your mask in photoshop. Btw, documentation states mask texture should be RGBA8, and it seems like you designate areas for grass to grow by leaving it completely transparent, and you designate areas where grass should NOT grow... with opaque black. And, gotta tweak the mask threshold.
manguste Posted November 16, 2011 Posted November 16, 2011 Masking is done per channel, separately. If color/alpha data = 0, there's no grass. If non-zero, the grass is rendered. See here for details,
Recommended Posts