Re: [TuxKart-devel] Things have gone very quiet....
Status: Alpha
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2004-07-10 16:19:01
|
Ingo Ruhnke wrote:
> I have tried my luck a little bit on track modeling in blender...
> Biggest problem is that the curbs end up being unevenly space and I
> don't think there is any easy workaround which doesn't involve
> touching a whole lot of polygons manually. Maybe some kind of python
> script can help to automate that process a bit.
Yeah - that's a problem with the way I model my tracks in AC3D also.
Writing a program to generate tracks from some kind of spline is a good
idea but the problem is that you really need to hand-model one 'segment'
of track and have the thing 'know' how to generalise that in tight curves.
Whilst you'd want to keep the crash barrier posts (for example) evenly
spaced as they go around a corner, the same cannot be true of the track-bed
itself. Given that you also need to avoid 'T-edges' like the plague - resolving
those problems automatically is quite challenging.
The trickiest part is making the road textures line up without obvious
seams. In a tight turn, you really only have two choices:
1) Keep the texture running along the line of the track. This is convenient
to allow a center-line stripe and to allow the track to blend nicely into
grass or whatever at the edges. (This is what Tux's Tollway, Gowns Bow and
BSOD's Battlements do).
Unfortunately, one of two things has to happen when you do this. Either:
a) Allow the textures to 'bunch up' in the corner - which looks odd with
very tight turns and 'noise' textures that represent dirt or gravel.
b) Keep the size of the texels constant and end up with an obvious texture
'seam' at the edge of each polygon.
2) Project the texture onto the track after it's been bent into shape so that
the texture (s,t) coordinates are a simple scale factor of the vertex (x,y).
This doesn't allow you to paint things like a centerline stripe or grass
borders - which can look pretty terrible in some cases. However, that's
what I did with Geeko Peak, Oliver's Math Class and Shifting sands because
those tracks don't have formal roadways as such.
The only way to make this approach work and have centerline stripes and
such is to either model those with polygons (can be VERY expensive because
they don't tmesh well) or to use one texture stretched over the entire
track (which doesn't allow you to have very detailed textures as well as
a suitably long lap time).
I suppose a possible compromise would be to use multiple textures on the
track polygons - one with the centerlines and the grass edging, etc and
the other with an overall noise pattern. The problem with that is that
standard OpenGL doesn't give you the options you need to have the two
textures blended as you'd ideally like - so you get 'noise pattern'
appearing in the centerline stripes and edges as well as the general
roadway.
In the future, we'll be able to write shader code to solve these issues
in a beautiful way - but for TuxKart there aren't yet enough users
with hardware that can support fragment shaders to make this a viable
approach.
Another possibility is to layer polygons with transparency to achieve
these effects - but some of the lower-end hardware doesn't really have
the fill rate to make this a cheap solution.
Overall, I tend to use a mixture of the above techniques, adapting
each to the situation and accepting some compromises. That's hard
to automate though.
You'll notice that the tracks with mostly long, sweeping turns (Tux's Tollway
and Gowns Bow) use the 'squashing the texture in the turns' technique and
the ones with tight corners (Olivers Math Class, Geeko Peak and Shifting Sands)
use the 'overall projected texture' approach.
The one track that has a mixture of tight turns and sweeping curves (BSOD's
battlements) uses 'squashing the texture in the turns' for the wooden boardwalks
(which are gentle curves so the texture bunching isn't too obvious) - it allows
textures to not align properly in the lava cave (where the metal gridwork doesn't
look bad with seams in it) - and 'overall projected' textures inside the castle
where there aren't obvious track 'edges' or centerline stripes or anything.
So - adapting the technique to the track (or section of track) is the best
solution - although it's quite a bit more effort.
---------------------------- Steve Baker -------------------------
HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net http://tuxaqfh.sf.net
http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----
|