I have a large paved area that consists of a single polygon with a tiling texture. I need to apply some pretty dynamic lines like the kind you would find on an airport runway. These lines will overlap, form various patterns, and be different colors. Some of these lines will be continuous through out the entire 300x300 meter area.
The player will be able to get pretty close (about 2 meters) to the surface so the lines need to hold up reasonably well.
The engine I am working with supports up to 2 UV sets and also has a decal system. I thought about doing these lines as a series of decals but then I have to worry about lining them correctly in the engine, I could make it one large texture and just do a second UV set but I'm not sure ho well that will hold up since it's a huge area. The final idea I had would be to just polygons for all the lines but that seams pretty wasteful.
I know many other games have done this, but many times it's simply either 1 or two textures and with somthing like a flight simmulator the player doesn't ever really get that close to the surface.
If anyone has any ideas, suggestions, or examples I would really appreciate it
.
Replies
If you're going to be close, and it's not something simple, like a tiling line, use decals (polygons for the lines). Give them a chipped paint alpha, and lay them out however you like.
Alternate methods I can think of:
1) 1 giant texture with all your linework laid out in it.
2) 1 giant overlay geo, using tiling "chipped paint" alpha'ed textures
3) a series of smaller geos using the same tiling textures as above, (basically a modular system to the above)
4) subdividing your base ground and using separate tiling textures which contain your underlying concrete, AND the appropriate line for that area.
I like 3 the most personally.
Seems like the cheapest and quickest way to me.
I would worry about a single polygon that is 300x300 meters, in general polygons that are so large that they can extend far beyond the view frustrum are not recommended.
Doing it as one giant decal sounds like a horrible idea, would need to be a gigantic texture.
I would definately opt for the brute force polygon / decal solution it really shouldn't add up to that many.
The resolution won't hold up in a large mask for a huge area like that, and I take it that different areas need different types of lines meaning tiling would be difficult.
Solid geometry planes or cuts just looks too sharp and unnatural. Wear and irregularity around the edge of the paint lines is very important for making it look convincing. Bits of wear in the middle, where the paint has been scuffed off can also be handles by opacity, revealing the tarmac/road underneath too.
With regards to lining them up, why not do it in your 3d package? Just set their pivots at zero, then export them either in sections, or individually?
The decals I have dealt with are usually just textures that are projected onto 3D surfaces in the scene. The problem with our engine is that the decal is represented by a single node in space so I have to move that node around and then this very large texture gets projected below it. The entire decal doesn't have a bounds or anything so it's would be hard to line one decal up to another.
If I were to set up the decals in my 3D program by just by placing polygons above the ground I don't know how good that would look because they would either be floating or there would be pretty bad Z-fighting (flickering).
Do you guys often times set up decals in your 3D app? I have had very little experience using the decal systems in other engines or setting up decals for other engines so any perspective of use of decals would be appreciated. Also depending on the methods complexity I may be able to get this feature put into our engine.
You need to have a no-z-write kind of flag, to keep it from z-fighting. And unless your game is toy based and you're REALLY close to the ground, as long as you float it about .25-.5" above the underlying surface, it's pretty hard to tell that it's floating. Also, if you can disable shadow casting per object, make the decals not cast shadows and it'll be even harder to tell.
Well, actually, the project I am working is kind of toy based. We have very small vehicles and there is the potential to get extremely close to the ground. I was hoping for this particular situation to avoid getting that close, but if we want to re-use these assets in other areas it would become a problem. I do see your point though, and I have used floating polygons in my models before but usually only on vertical surfaces. I have never tried putting them on the ground.
You mentioned that some engines have a no z-write flag. How is this usually assigned to the model? Is it done per object or per material?
That sounds like a great idea, but unfortunately I don't follow. Are you talking about using a texture and creating a shader that does a second pass to overlay the texture? I don't understand what you mean by "world position scaling in the shader". What are you scaling, geometry, textures, something else?
Sorry for my ignorance. I just really want to understand your suggestion because do have a lot of control over our shader setup and might be able to do something like this if I could wrap my head around it.
a second uv set doesn't sound like it makes sense
you could make a set of lines in photoshop
make them tilable on a seperate tex page
and in your normal, stones shader (that you have to set up anyway) add in a world position node, component mask X,Y (so those are the co-ords you use) and divide it by 512 (or anything, but 512 brings it down to default scale.) and use that as the UV input for the lines texture. Then multiply/add that on top of your stones diff/spec/normals
and it will tile and match up no matter what rotation the mesh is on. You will need to clamp the lines texture on one axis (found in the texture viewer box) And possibly create mat instances for when you want to add a curve to the line, or corners etc.
a second UV set could also do the job (in unreal, if you were going to lightmap this asset anyway...) and use a tex co-ord set to UV channel 1, and again multiply or add etc your line texture as a second pass.
thats a pretty broad overview, in reality there will probably be a few more instructions you have to add, but the position is right.