Texturing in DarkRadiant

From The DarkMod Wiki
Revision as of 08:21, 30 March 2007 by Greebo (talk | contribs)
Jump to navigationJump to search

In DarkRadiant there are quite some texturing tools available. In order to yield the best results, it's of course useful to know how these tools work, which is what this document is trying to cover.

Brushes vs. Patches

There are some texturing commands that work differently for brushes and patches, because of the way these primitives store their texture information. So beware that using the same command on a brush doesn't always yield the same result when used on patches, although DarkRadiant tries to do its best. Read here to gain some insight about how patches and brushes are technically textured.

Natural

Natural for one works differently for patches as for brushes. Basically it tries to apply an undistorted texture with the default scale on the target. This is of course more easily accomplished for brushes (because their textures are always undistorted) than for patches.

Texture Copy & Paste

These are the most powerful texturing tools in DarkRadiant. There are several of them available, all can be accessed via the Middle Mouse Button (MMB):

Please follow the links for a short introduction of these copy & paste operations.

Copy Texture

This command is available via the MMB (click into the cam view) or the Menu > Edit > Copy Shader. When using the MMB to select a texture, the shader of the clicked object is loaded into the ShaderClipboard. Once you picked your texture the name of the texture appears in the status bar and it's highlighted in the Media and the Texture Browser.

Paste Texture (Natural)

Sometimes it's not enough to project a texture from a brush face onto other objects, if the targets are bent and their normals are not facing into a similar direction as the source face normal does. The screenshot should illustrate the problem:

complexpatchoy6.th.jpg complexpatchbeforeyx0.th.jpg

This is the starting situation: We have a brush at the right (the "source brush") and the target patch on the left, which is heavily bent and it's definitely not lying in the same plane as the brush face. Let's try and project (Ctrl-MMB) the shader from the brush face to the patch:

complexpatchprojectedjy5.th.jpg

As easily observable, the patch texture is distorted because of the projection. Some patch areas are nearly perpendicular to the brush face we're copying from and therefore the projection does not work. A small section of the source texture is projected onto a large section of the patch, hence the ugly stretching.

The Paste Natural command (Shift-MMB) was written to address this issue (just Shift-MMB onto the target, assuming that you still have the source shader from the face in the ShaderClipboard):

complexpatchnaturalik5.th.jpg

What happened is the following: the patch is virtually straightened out by the algorithm before the texture is projected. It's ensured that the patch is virtually sharing the same plane as the brush face with the vertex distances being preserved (so that no stretching occurs). This is also working with patches that are perpendicular to the brush face. Just experiment a bit and it will be easy to see how it works. (This is the most sophisticated texturing method, it was quite some headache to set it up, believe me) :)

The command is available via Shift-MMB and Menu > Edit > Paste Shader (Natural)

Paste Texture Coordinates

This command works only from Patches to Patches and is available via the Alt-MMB. The source and target patches must have the same matrix dimensions (e.g. you can only paste the coordinates from 5x3 patches to another 5x3 patch). The shape of the target patch stays untouched, it's just the shader coordinates (U/V) that get cloned. See this example:

texturecoordcopy1zb5.th.jpg texturecoordcopy2zp5.th.jpg

The left image shows two patches with equal dimensions (3x3). The left patch is considered the source patch - after clicking it with MMB the ShaderClipboard memorises this patch. After clicking the right patch (the target) using Alt-MMB, the U/V coordinates get cloned from the left to the right. I've used an 2x2 texture tiling layout to illustrate the workings. As stated above, the shader itself stays untouched, it's just the "internal" coordinates of the target patch that get altered.

Another example:

texturecoordcopy3an4.th.jpg texturecoordcopy4fz8.th.jpg