Hey there, can anyone point me in the way of a good tutorial on seamless/tile textures for game environments. I mostly create character textures with a UV layout, but im starting to get into environments and buildings.
Im looking for something that will go into detail, an example would be placing graffiti on a repeatable brick wall texture. Im using maya & would this be done with the use of a layered shader? are layered shaders used in game textures?
Thanks McG
Replies
Have fun!
I'n no expert but i would assume a lot of the time things like graffiti can be easily placed as a decal. A decal would just be a single quad overlayed onto the surface with an alpha mapped texture, you probablly wouldnt want any sort of layered shader because then your grafiti would repeat over and over. Unless you have some sort of control map on 2nd uvs or something of that nature, which really is getting a little excessive.
EQ: actually i've seen this method used on PS2 stuff, with 2 UV sets, one tiling a generic texture underneath, and the 2nd UV set holding the UV info for decal textures.
However you could also use the method Earthquake describes, just float a plane over your surface and use an opacity-mapped texture on that, this is the way a lot of games do that sort of thing.
Ignore Adam, he didn't read your question
Reality Engine has a neat tutorial in their wiki about decals, similar to Doom3's projectors. Unreal2 also has a tut in theirs. Sorry don't have the links handy.
You're right though, using a blend function or something (ie. white is transparent, darker colours multiply on top of the underlying texture) is what's done most of the time, from what I've seen.
- frame buffer blending:
which is typically done for decals (if they are separate polys) any blended surfaces such as transparent, or additive particles...
they all use the same formula:
out = newcolor * a + oldcolor * b.
a and b can be changed like "newcolor.alpha" or "newcolor.invalpha", "one", "zero, "oldcolor" ... that way you can do interpolation and additive or multiplication with the same formula.
hence the performance should always be the same when this type of blending is used.
- multitexture blending
when not using pixel shaders, there was a set of different operations that can be done between texture stages mostly it was just multiplication
typical lightmap setup
texture0 = texturecolor
texture1 = previous color * texturecolor
there was set of different functions like "interpolate", "add", "modulate", while I never really tested for it, but I guess the performance of those would be very similar with interpolate being slowest as it needs 2 muls and 1 add, while the others need less ops.
todays hardware would do this in pixel shaders and simply break it down to just some vector math like "a*b..."
----
that said the "blending" as in framebuffer blending is not very flexible and even in todays hardware is just that one formula. So what we do for more fancy framebuffer effects is that the framebuffer is rendered into a texture (or grabbed) so that pixel shaders can be used and more fancy math and fx can be used. however as we cant write and read to the same texture within one drawcall, it is still a bit problematic and can be mostly used only for full frame fx and not so much for per object effects.
this mostly affects per-pixel lit transparent surfaces, as those would normally be multipass-rendered (for # of affecting lights) and then you run into the problem of actually needing to have additive blending for light, but still that decal blend for transparency... a work around is rendering the object as opaque and store results into a texture and then blend that texture back to framebuffer...
or just ignore multiple lights on transparent surfaces, or make sure they just need 1 pass
I think part of dx10/gl3.0 will be programmable framebuffer blending as well.
drifting away here a bit, but anyway if you can do it with a second texturestage (layered) then go for it as that is cheap on todays hardware and saves the issues that come with those decal polys (sort, finding proper triangles for not overlapping..)
http://udn.epicgames.com/Two/TexturingTopics
http://reality.artificialstudios.com/twiki/bin/view/Main/CreatingDecals