Author |
Message
|
AD_Dennis |
Posted: Wed Aug 19, 2009 1:22 am Post subject: Terrain Texturing Problem - Black Areas and Lines |
|
|
Joined: 02 Apr 2008 Posts: 32
|
I am having a problem with black areas in the terrain after importing into TGEA. There is also a black grid surrounding the tiles of the first column of tiles (left side of terrain when viewed in Grome). The texture problem isn't present in Grome.
I did find that the black grid can be corrected with the following code change. The cast used when calculating the zone_row_start and zone_row_end for the opacity tile is truncating the value In the current example the float value was ~511.9 so by adding 0.5 to it the truncated value is the desired 512.
Code: |
// Opacity masks ======================
if(R<(int)rows_no && param_mask_export_as_4cpng)
{
for(int L=mask_lines_per_row-1; L>=0; L--)
{
// Reset the values of the opacity rows.
for(uint O=0; O<_opacity_masks_no; O++)
memset(_opacity_masks_row[O], 0, sizeof(t_uchar4)*_mask_width);
// Go through all the zones touched by this row ...
for(uint Z=0; Z<row_zones.No(); Z++)
{
// Determine what part of row this zone is covering
const t_float3 *zone_bbox = row_zones[Z]->GetBBox();
const uint zone_row_start = (uint)((zone_bbox[0].x - row_left) / _param_mask_upp + 0.5f); <== Add
const uint zone_row_end = (uint)((zone_bbox[7].x - row_left) / _param_mask_upp + 0.5f); <== Add
const uint zone_down = (uint)((zone_bbox[0].z - _terrain_min.z) / _param_mask_upp);
const uint zone_mask_width = zone_row_end - zone_row_start;
|
I have found that the total number of opacity map pixels per channel that have a value of zero is 262,144 which is the total number of pixels in one tile. This may be coincidence or may suggest an indexing error? Not sure how or if this explains why the black areas occur in various areas of the terrain. Here is a picture of the black areas:
 |
|
Back to top |
|
 |
ALicu |
Posted: Wed Aug 19, 2009 6:33 am Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 1330
|
Hi, I will check this once I have your data from FTP. It must be some sort of floating point round-up error. Thank you for the report.
Regards,
Adrian L. |
|
Back to top |
|
 |
AD_Dennis |
Posted: Fri Sep 18, 2009 10:34 pm Post subject: |
|
|
Joined: 02 Apr 2008 Posts: 32
|
Alicu, I've come to the conclusion that the black rectangles are not due to anything associated with Grome. This conclusion is based on modifying the exporter, as a debug tool, to create a jpeg for each opacity tile. The terrain in question only has three textures and each was assigned a color - red, green and blue. The assumption is that if the black squares were being created in the Grome export process then it should be visible here too.
Here is an example of all three textures as exported by the exporter (modified to output tiles)
In this tile there should be a couple of black areas but as you can see there are none. In this case it is a single solid texture which in this case was assigned the color green.
What are your thoughts? |
|
Back to top |
|
 |
ALicu |
Posted: Sat Sep 19, 2009 8:56 am Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 1330
|
Hi,
Based on your output image (exported RGB) it seems that the only way to get that black lines is inside TGEA engine (the lines are not visible in Grome, they are not present in the exported images, so the engine processing of atlas files must be the cause). I actually never obtained any black lines myself in all the testing scenes. And looking over the exporter code it doesn't do any filtering (it just gets the pixels from Grome masks) except the case when there is different resolution on different terrain zones or if you entered a resolution different that tile size.
So my assumption is that this is an error on the TGEA side. Did you tried various texture sizes, LOD parameters? Did you contact TGEA and ask about this, maybe it is a known issue?
I've also checked the map you've uploaded on the FTP and due to the your tile size, I need to use 2.745 as the resolution size for both heightmap and opacity maps so I get power of two + 1 for heightmap and power of two sizes for opacity masks (this are requirements of the TGEA engine and you can check the output sizes in the bottom left panel in the exporter UI). After export I didn't get any abnormal black pixel in the exported files.
Regards,
Adrian L. |
|
Back to top |
|
 |
AD_Dennis |
Posted: Sat Sep 19, 2009 2:39 pm Post subject: |
|
|
Joined: 02 Apr 2008 Posts: 32
|
The black grid (far side of the terrain in the image above) and the heightmap problem were definitely caused by round-off errors in the exporter. However, as you said this terrain is a good candidate for that problem due to the square size. Fortunately that was easy to fix. The black rectangles are definitely something that TGEA is doing. I plan to post it on the GG forums but have not yet had a chance. |
|
Back to top |
|
 |
|