On Wed, Nov 18, 2009 at 6:41 AM, cullam Bruce-Lockhart
<[email protected]>wrote:
> I guess the big question is when do the textures get assigned in the first
> place?
>
This is going to sound a little strange, but what gets assigned within
terragear is a material name (which FlightGear resolves into a texture) and
generic texture coordinates (which FlightGear resolves into specific texture
coordinates.)
The benefit of this approach is that the texture and the texture scale can
be quickly swapped in the materials file without needing to regenerate the
scenery within terragear.
Another way to look at this is that a texture to be scaled properly will
cover some n x n meter area. Terrain textures should be square textures are
are designed to be repeating/tiling.
However, if an artist designs a new texture, the imagery might be scaled to
cover some different amount of area. If we don't change the texture
coordinate assignments, then trees and buildings and other things cooked
into the texture imagery could be too big or too small.
So the materials.xml file defines the actual texture and the texture scale,
and the final texture coordinates are computed when the scenery is loaded
and the scene graph is built (using a combination of the generic texture
coordinates assigned by terragear with a bit of code/logic on the FlightGear
side.)
> As for the stretching issue, I'll have to think about that. But I'm
> thinking about cliffs as shallow as 45 degrees, so it shouldn't be such an
> issue there. I'm also HOPING to make it an input parameter into
> fgfs-construct, so that it could be added into the main terragear
> functionality, for anyone working on high enough resolution scenery for it
> to be of use. In a low detail model, You might want 75 degrees or more to be
> defined as cliff face. But if it was an input parameter, then the option
> would be there.
>
The basic approach used by terragear makes it very difficult to change
texture coordinate mapping according to any other rules. I don't know the
best way forward, but a couple things come to mind.
1. you could cut out holes where the cliff polygons are situated, leaving
these areas open in the final terragear result, and then place custom object
models in those holes. You might be able to leverage terragear and make
programming modifications to assist in this process, but it will be hard to
do any kind of natural blending with the surrounding areas ... and that's
hard anyway and is something terragear doesn't address very well.
2. you could do the entire terrain block as a custom model generated with
some other tool set (blender, creator, etc.) There's no reason a terrain
block has to be in .btg format. The .stg file could reference and place any
model format that is supported by OSG.
3. It might be worth looking at the terrain shader. This kills performance
for me in mountainous, high polygon count areas, but it might be adaptable
to do exactly what you need at run time?
> Also, is there an issue I should be concerned with in terms of texture
> priority? I know that there's a list of what gets drawn on top of what. But
> there seemed to be a few places where this list came up. At the very least,
> my attempts at adding to this list failed completely. Anyone know off the
> top of their head how to change the texture list, or add my own categories
> to it? This is more so for my own local use, rather than for the Terragear
> project, as I doubt anyone else needs a texture specific to the brown rocks
> in Newfoundland.
>
Off the top of my head there is a "names.cxx/hxx" pair that contains the
definitions and priority of the areas.
Note that when the tile is built, all the polygon areas for that tile are
added in priority order and clipped against any areas that were placed
earlier in the sequence. The end result is something like a jigsaw puzzle
where the entire tile is covered in a single layer of polygons with no gaps
and no overlaps.
So think of this "priorty" scheme not as a texture priority, but as a
clipping priority when assembling the jigsaw puzzle of shapes. For instance
a road might have priority over a river so that the road will be shown to
cross the river. A river would have priority over an urban area so that the
river is shown to cut through the city. An airport area has the highest
priority because that is our best and most accurate data.
Regards,
Curt.
--
Curtis Olson: http://baron.flightgear.org/~curt/
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel