I had this message still in my TODO box and looking a bit closer it
looks to me like MIPMAPPING should take care of this, doesn't it?
Does anybody think this might be useful to include?
Erik
Phil Cazzola wrote:
I've been playing around with having different terrain textures at
different distances.
I know some people have been looking at exploring this so I thought I
should post what I have. It probably isn't ready to check in, but
some brave
people might like to experiment with it.
I have some shapshots to illustrate. BTW, this terrain is generated from
Mars MOLA data using a single land use (material) type. They are
high visibity w/ the fog and fog diming turned off.
Click on the pics for larger versions:
http://members.interfold.com/pcazzola/terrain/
The top left shows the problem with having a single texture. At a distance,
the texture looks very tiled. The top right picture uses a much
simpler texture.
Now the problem isn't tiling, but that it is so boring up close.
The middle left picture, is the current behavior if you set more than 1
texture
in the same material. You get some of the area w/ one and the rest w/
the other.
The one on the middle right has 2 textures based on distance.
The final picture shows that there are still some issues. The range
selector
didn't change the texture directly ahead. There is also some definite
"poping" that occurs.
What I've implemented is reverse compatible. The scene graph will
come out exactly like before if you leave the materials.xml file as is.
I've added the ability to set ranges in the material file. If you
do that, the
new code will add a range selector branch between the local terrain
and the
vtxTable leaf. It will make N copies of the leaf, but it is using
references.
This should make it so the vertex (etc.) data will not have to be
copied and
the memory growth should just be due to the extra range selectors
and extra leafs,
but not the leaf's data. Each of the leaves is tied to the correct
ssgSimpleState
for the texture.
To specify the new ranges add 1 to N "range" properties to the
material. You will need to specify 1 more texture than
range values.
<material>
<name>Default</name>
<range>5000</range>
<range>10000</range>
<texture>Terrain/texture1_close.rgb</texture>
<texture>Terrain/texture1_med.rgb</texture>
<texture>Terrain/texture1_far.rgb</texture>
<xsize>1000</xsize>
<ysize>1000</ysize>
</material>
In the code I assumed that the user would always want the first texture
to start at
zero and the last texture should go to the horizon. If you don't
like this,
you can easily alter the code to have no texture up close or out far.
I chose not to add a call sgApplyTextureRanges() in apt_signs.cxx, but
it is only
couple of new lines if you want the same functionality for the signs.
Diff file and source code attached.
Let me know if there are any blatant errors.
Phil Cazzola
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d