syedhs
29-11-2007 14:57:14
JohnJ,
I faced this problem quite sometime but only now managed to investigate and able to solve it.
Basically I feed the grass loader the density map, and the bug will be this.. *drum roll*.. a number of grass (which is very very few) will appear on the area where density map = rgb(0,0,0). This is irritating especially if the grass grows on the road . I checked thoroughly the density map, it is exactly rgb(0,0,0) ie pure black not rgb(0,1,0) or something like that.
So I think the problem lies with this line ( I am using MAPFILTER_NONE):-
So basically I add extra checking which is if density is too small, then no tree is added at all. I suspect the bug lies with random value generated which can be very small and satisfies with density at that particular point.
Or maybe the bug is somewhere else: density values generated from the density image file which can be very small (but non zero) so there is still a possibility tree to be generated there.
Btw, originally I used the default map filtering which is bilinear, and then changed it no-filter but the grass still appear on the road.
I faced this problem quite sometime but only now managed to investigate and able to solve it.
Basically I feed the grass loader the density map, and the bug will be this.. *drum roll*.. a number of grass (which is very very few) will appear on the area where density map = rgb(0,0,0). This is irritating especially if the grass grows on the road . I checked thoroughly the density map, it is exactly rgb(0,0,0) ie pure black not rgb(0,1,0) or something like that.
So I think the problem lies with this line ( I am using MAPFILTER_NONE):-
GrassLayer::_populateGrassList_UnfilteredDM(...)
..
..
//Determine whether this grass will be added based on the local density.
//For example, if localDensity is .32, grasses will be added 32% of the time.
float density = densityMap->_getDensityAt_Unfiltered(x, z);
if (density > 1e-3) {
So basically I add extra checking which is if density is too small, then no tree is added at all. I suspect the bug lies with random value generated which can be very small and satisfies with density at that particular point.
Or maybe the bug is somewhere else: density values generated from the density image file which can be very small (but non zero) so there is still a possibility tree to be generated there.
Btw, originally I used the default map filtering which is bilinear, and then changed it no-filter but the grass still appear on the road.