HowTo:SuperrealisticTexturing

From VsWiki
Revision as of 01:22, 21 July 2010 by Nikai (talk | contribs) (sp)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
arrow_left.png Texturing in Wings3D arrow_up.png HowTos Using animated textures on a model arrow_right.png

FIXME :Pasted from a post at WCU, for now; I'll try refining this tutorial later, after I get some feedback from DualJoe -- chuck_starchaser


Texturing is very hard. I've found that trusting physics and optics works for me. Using layers in Gimp is a must, but I've found myself always needing to save intermediate results as png's because the layers in Gimp are combined sequentially as a stack, rather than the graph one needs; not to mention that from multiple input layers one needs to generate multiple targets (diffuse, specular, glow...). And the only way for a texture to look believable is for it to have overwhelming amounts of information, combined in ways that make optical sense. And high-frequency data is not enough, gradients are important as well.

The key is subtlety at each step. When looking at a moving model, the eyes notice things much easier than when looking at a flat square screen in Gimp. Things you hardly see will become very noticeable in-game.

So, for instance, you might want to start with a brushed metal base, by filling the square texture with a gray shade, applying correlated perlin noise scatter, and horizontally motion blurring the whole thing. (Several passes of motion blur with different lengths work best).


Rust

For titanium-like rust (multi-colored, subtle): On new layer, fill with gray, apply UN-correlated perlin noise scatter, then blur. Call this the "rust mask" Use color tools->curves to bring the used spectrum up to near white, blur again; set layer blend mode to multiply. Might want to invert the colors of the rust mask and do the same but with reverse chroma for the specular map; --that way rust spots will change hue depending on the viewing angle/reflections.

Other surface materials (that might get painted over)

So, if for example, some flush areas of surface are like flat panels of stainless steel among the surrounding titanium, but such that they might be painted over, or partially painted over, together with the titanium, they'd go in at this stage on the layer stack.

Paint

In the case of the Hornet, I'd say the green parts are painted so, the rest aren't painted. So, on a new "paint" layer, green parts are green, the rest transparent. Blend mode is normal, factor could be 75% say, if you want the brushmetal pattern to show through.

Then copy the paint layer and reduce saturation, for the specular map.

Writings could go on the paint layer.

Other materials (non-painted)

Say you got bronze, copper, aluminium, rubber gadgets and greebles. These could go onto layers with transparent backgrounds and 100% normal blend.

Small scratches

A light scatter of dots (from perlin noise and use of curves) can be motion-blurred horizontally (front to back), and used as alpha mask on the paint and rust layers. (Paint gets scratched; rust gets cleaned.)

Wind-marks

Any edges or protrusions (bumpmap features) can have "wind trails". Very hard work to do by hand. It can be automated though. If all your islands in the unwrap align their front-to-back direction with the horizontal axis, that is. Just take your bump-map, copy, paste on top of itself, but moved horizontally by one pixel. Then blend with Difference mode. That will give you very thin, vertical edges around all bumpmap features. Vertical or oblique, actually, just not horizontal ones.

(You could use Edge Detect, but it would detect horizontal edges as well, which you don't want, so you'd have to erase manually.)

Invert colors if necessary, to have white lines on black.

Now create a new layer, fill it with perlin noise, blend with multiply.

Now it should look like thin outlines of like "white dirt". Play with color curves until you can barely see the lines, at like random spots.

Flatten or export an image.

Now, open that image copy, paste on itself, motion blur horizontally, blend with darken only, 70%, say. Flatten image, repeat, until all those faint "dirt" lines look like horizontally smudged, fading towards the right.

Flatten, save. Make an inverse of it (color tools, curves, bring bottom left end of the curve all the way up, top right end all the way down) for the spec map.

So, the windmarks version that is white smudges on black, goes as a layer on the diffuse xcf, with Add, at, say, 20%.

Yes, hardly visible, after all that work... :)

The windmarks version that is black smudges on white, goes as layer on the specular xcf, with Multiply, at the same %.

This is because windmarks are matte deposits, which lessen specularity.

More small scratches

Yes, some scratches would be more recent than some windmarks, and would therefore scratch the alpha channel of the windmarks layers (both diffuse and specular).

Bumpmap ambient lighting

Just Sharpen the bump map twice, reduce contrast, and use it to modulate the diffuse texture, so that raised feature look slightly brighter, and depressed features slightly darker. Very slightly. Subtlety is key. The reason to sharpen the bumpmap twice is that ambient illumination of small features is somewhat related to 'concavity', or the second order derivative. Maybe one could blur twice and do a difference; not sure what would work best; I haven't done this yet.

A tiny bit of radiosity baking

Play with it with color tools -> curves so that the darkest spots stay dark, but anything lighter quickly fades to white; something like

 _--
/

then apply to the diffuse texture with multiply, and blend factor at like 15%. Very subtle.


The spec map may need extra layers, to make specularity "spotty", and maybe very thin white lines centered on bumpmap grooves could give the sense of a more reflective material at the bottom of those grooves. If so, there should be corresponding thin, black lines in the diffuse, as a very specular material won't reflect much light diffusely.

Color precision

One thing that needs to be understood is color precision issues: Whenever you save a PNG, each of the RGB or RGBA channels is encoded as a number from 0 to 255 (8-bits). This is not completely terrible in terms of a final texture; in fact it might be more precision than's really necessary. The problem is when you're modifying your texture and saving intermediates, adding this, saving, multiplying by that, saving, applying blur, saving... At each step you lose the "decimals" after the 0-256 integer part, and these precision losses add up and result in horrible banding. Even if you don't save but simply merge layers down, you "lose decimals".

The way xcf's work, though, is that, in computing the resulting image, each color channel's computations for each pixel are done at 32-bit floating point precision, going through the entire stack. Only at the end, quantizing the precise result back down to 8 bits.

So you really, really, REALLY, want to keep as many layers un-merged as possible. Here's a possible layer stack:

===========================================================================
Layer / Name     /     Mode  /  Ratio / Comments

===========================================================================

18  HolesAndSlots      Darken   100%    Black on white slots and holes

///////////////////////////////////////////////////////////////////

17  AmbientLumGradient Multiply  10%    Brightened radiosity baking

16  BumpmapConcavity   Multiply  10%    Double-sharpend bumpmap brightened

///////////////////////////////////////////////////////////////////

15  GreeblesAndThings  Normal   100%    Non-flush greebles, on alpha

///////////////////////////////////////////////////////////////////

14  AFewMoreScratches  Normal   100%    Brushed metal modulated, on alpha

///////////////////////////////////////////////////////////////////

13  Windmarks          Add       20%    White on black smudges

12  FuelOilSmokeSmudgs Normal    20%    Miscellaneous crap on transparency

///////////////////////////////////////////////////////////////////

11  ScratchesOnAlpha   Normal   100%    Metal base modulated by scratch mask

10  PaintLayer         Normal    75%    Green/black on white, +writings

///////////////////////////////////////////////////////////////////

09  OtherSurfaceMat2   Add      100%    Rubber/chrome/cables/rivets on black

08  OtherSurfaceMat1   Add      100%    Stainless flush covers on black

///////////////////////////////////////////////////////////////////

07  TitaniumRust       Multiply  15%    Blurred, uncorrelated scatter

06  BrushedMetalMask   Multiply 100%    Brush metal islands, white on black

05  BrushedMetalBase   Normal   100%    Just Brushed Metal

///////////////////////////////////////////////////////////////////

04  WhiteBackground    Normal   100%    Black on White unwrap guide

03  GrayBackground     Normal   100%    50% gray

02  BlackBackground    Normal   100%    White on black unwrap guide

01  Background         Normal   100%    Original diffuse baking

===========================================================================

The reason for the four backgrounds is that, depending on what stuff you're working on, you may see it easier on black or on white. The first background, the baking, is the "standard" one. But once you produce a final texture and export it to a png, you might want to do a selective gaussian blur, selecting the background color. And repeat the blur many times, to leak color from the island edges onto the background. Then you replace the first layer with it. The idea is to have islands surrounded by background color similar to their edge colors, to avoid darkening of island edges that results from mipmapping and filtering.

Bumpmaps

Use of metal surface digital photos is a good idea, of course. The real thing always will look better than synthetics. When it comes to the bumpmap, avoid having just grooves, all the same thickness and depth. That's what plastic toy makers would probably do. For sharp, deep slots and holes, nothing beats just painting them black. No need to overuse the bump map.

Avoid also making arbitrarily recessed or raised panels. If you recess a panel, it will look like there's a missing armor plate or something. Subtlety is key. Use the bumpmap judiciously, only where necessary, and as necessary. Yes, with a lot of bumpmap stuff, people will go WOW, but the effect will wear off quickly. For the WOW factor to last, the surfaces should look realistic, not just complex.

A slightly raised little panel is presumably a cover. Make sure there's white dots near the corners on the specmap so it looks like there are screws that hold it in place. You might want to use a different material for that cover, too. If it's a cover that should open easily, hinges can be represented, with the back ends as bumpmap depressions, and the sides as thin black lines in the diffuse and specular textures. And opening covers might have a specular handle on a recess to open them.

Not all bumpmap grooves need be symmetrical. A hinge, or a wing stabilizer, are rounded, but meet with a sharp angled other part. For example, where the wing ends and the stabilizer begins, the wing ends abruptly (sharp edge on the bumpmap), but the stabilizer part rises smoothly back to surface level.

Where greebles or pieces of geometry are floated onto another, without continuity, the bumpmap can be use to bevel the intersecting surfaces to make them look welded together. A little frame of raised surface around a floated object can make it look like it has a base or lip for attachment.

In other words, avoid overusing one monotonous trick everywhere. Use every trick you know and then some you don't. Instead of thinking "where else can I do something like this?", think "what could I do that I haven't done?"; and just do it once in some place.

Nothing beats taking a look at real planes for inspiration...



arrow_left.png Texturing in Wings3D arrow_up.png HowTos Using animated textures on a model arrow_right.png