Making objects usable

Saturday, May 17th, 2008 | Author:

As if it’s not frustrating enough that there aren’t a lot of free objects on the internet, a lot of them aren’t compatible with TG2 either. Often textures don’t load for example. However, this problem can be easily fixed! How it’s done is shown here with the use of the French Maple tree (Montpelier Maple, Acer monspessulanum) from the website of the TU Dresden.

Missing textures are easy to spot – the complete object or parts of it are simply black. In this case it is enough to reassign the textures. This is done in the Internal Network of the object (Right click on the node – Internal Network).

In the worst case it will look like this:

We just have a Multi-Shader, nothing more. Here is a “healthy” network for comparison:

Default shaders are assigned to the 5 left-most shader inputs. The first 4 apply textures to the trunk and branches, the remaining one to the leaves. It is important to know which input in the Multi shader affects which part of the object.

To find that out, we create some Default shaders, give them bright, easily distinguishable colours, and connect them to the first few inputs of the Multi shader

A test render shows us the information about the various inputs. In our example (see right) it’s pretty clear that the blue shader seems to be responsible for the trunk, the green for the leaves, and upon close examination we can see also see bit of a branch that is coloured by the red shader.

Now we can assign textures to the shaders. First we edit the blue shader by assigning a colour image and setting the colour to a neutral gray (i.e. a saturation of zero) with a brightness of 0.5. The brightness can still be changed later if you like. this is important because the diffuse colour affects the apearance of the texture a lot.

Usually textures can be found in the same directory as the object. To select the right texture images you need a basic understanding of the English language and a bit of common sense or a thumbnail preview. The first part of the filename is just the latin name of the tree, the latter part indicates the part of the tree the texture is for (like ‘bark’ or ‘leaf’). So we found the right texture! In this case the texture is a .png image, but other formats like .tiff and .jpg are used a lot as well.

In this case we found only two textures for this object. One is the bark, the other the foliage. Since there is no specific texture for the branches, we’ll just use the same texture as for the trunk. Which means we can plug the shader with the bark texture into both inputs (so into the input of the red shader as well). Since we don’t need the red shader anymore, it can be deleted. The names of the shaders should be changed, so it’ll be easy to see which one does what.

The network should now look like this: (“Rinde” is the german word for bark)

Now we give our green shader its texture the same way as we did with the bark (acer_monspessulanum_leaf.png). We’ll also use this same texture in the Opacity tab as the Opacity Image, and activate Use Alpha Cannel. This way TG2 will use the alpha channel of our texture. The alpha channel holds the transparency data of an image. A maximum alpha value means complete transparency / no opacity. An alpha value of zero on the other hand, means no transparency / full opacity.

However, a test render shows us that our bark has become very dark, but that our leaves are partly white for some reason.

A dark bark is no reason for concern. A quick view of the texture image show us that it simply is dark.

With the leaf it’s a completely different story. TG2 doesn’t really handle the alpha values correctly. Currently it only works in black and white, ignoring the grayscale values. So if the alpha value is under 50% the result will be opaque, if above 50% it will be transparent. So this means the non-transparent range is expanded over the grey alpha values, to the part of the image where there is no colour. TG2 automatically fills these areas without colour information with white.

One solution is right there. We fill the transparent background of the image with a matching colour, and prevent that TG2 encounters “empty” pixels. An example: The left image has the original transparency, the right image a version filled with green.

We save the newly made image under another name, like ‘acer_monspessulanum_leaf-colour_only.png’, and use this image as the Colour Image.

Another test render shows us that the white dots really did disappear! But we’re not quite done yet. First of all, we must be sure that every part of the object really is textured, but that is the case here, and secondly, we want to save our object. For this TG2 has its own format. To save an object in this TGO-format, we simply have to right-click on the object node and choose Save Object File… Note: the file should be in the same folder as the textures, so that these are found automatically.

And finally, you can pack the finished object with its textures and a test render (without all the remaining, now unnecessary, files) in a new folder and move it to an object archive, if you want.

You can convert the remaining objects of the TU Dresden as well and build yourself a nice little collection. :)

Have fun!

Tags » «

Trackback: Trackback-URL | Comments Feed: RSS 2.0
Category: Advanced, How to..

You can leave a response.

Leave a Reply