Polynomial Texture Mapping
You might already be familiar with PTMs, but we'll go ahead and take a peek at how it works in Turtle anyway. The PTM works by baking down diffuse illumination to a simple polynomial function basis, which is written out as two RGB image maps. The PTM will contain an approximation of the diffuse shading from any given light direction, including shadows and self-shadowing. PTM is available as an output in both the Texture Bake and the Surface Transfer tools.
You can bake down simpler illumination and shadows using the Texture Bake tool. This works well if, for instance, you have a classic sphere on a plane situation, and want to bake down the shadows from the ball onto the plane. If we want to capture self-shadowing, the Surface Transfer tool is a better choice, since in most cases you want to sample the subtle self-shadowing of a detailed object, and bake it down for use on a low-res substitute.
We're going to bake out some PTMs for a medium-detail model of an arm. Go ahead and open the provided scene ArmorBaking.mb.
The scene is divided into two Display Layers, the highres and the lowres layer contain the Source Surfaces and the Target Surface respectively. Make sure both layers are visible, and switch the Render Type to Surface Transfer in the Render tab. Head over to the Surface Transfer tab and set the low-res geometry as Target Surface. Add all the high-res surfaces to the Source Surfaces list. As we have multiple overlapping objects in the high-res model, you should sample the surfaces towards the interior, so let's set Front Range: 0.0 and Front Bias: 0.0 to stop all outward rays. Back Range: 4.0 and Back Bias: -1.0 will make sampling begin at a slight distance from the surface of the armor, and keep sampling a little past the low-res surface, to make sure we don't miss any Source Surfaces in difficult areas.
In the Output File roll-out, increase the resolution to 1024x1024, and always remember to select a floating-point image format; OpenEXR MultiLayer will be fine. The PTM coefficients can have any possible value, so storing them as ordinary images will require a reparameterization of some form, and a resulting decrease in precision.
Check Model View Hardware Visualization too, which will save you some time when connecting the PTM components. In the Outputs roll-out, enable Normals and Polynomial Texture Maps.
100 PTM Samples will be ok for these tests, but for a final baking you could go as high as 300-500 if you want. You can sample down both direct and indirect lighting in a PTM, but only diffuse effects. View-dependent effects like specular shading will not be baked down. We'll look at baking indirect dynamic lighting later, so the default settings of the PTM roll-out should be ok. One word of caution however; if you're using Super Sampling, you should remember to always uncheck the Clamp Values attribute, since PTM coefficients can be any possible float value. If super-sampling isn't enabled, go ahead and select it. Did you uncheck Clamp Values? Fire up a render, and Turtle should bake out the normal map and the PTM.
Once the maps are baked, you can hide the highres layer. Make sure you have Hardware Texturing enabled in the viewport, and select Use All Lights in the Lighting menu of the viewport. You should have a directional light next to the arm, which you can rotate to change the lighting on the arm. To see the effect of the normal map, you should open up the low-res mesh material, make your way to the Hardware Shader, and switch on Specular Color in the Hardware Shader Features.
There is also an option to Extract Normals, this will recreate the surface normals from the PTM, but since we have already baked the normals into a normal map, lets uncheck this option.
Try rotating the directional light next to the arm. You should be able to spot subtle self-shadowing along the edges of the details.
Turtle 4 has been completely restructured to be able to bake all the new lighting passes. If the preset lighting passes doesn't cut it, the same interface that the preset passes are built through is exposed for you so that you can customize it through Lua scripting.
You can customize the baking in the Texture Bake and the Surface Transfer tools; the Lua options are located under the Outputs roll-out.
The Lua bake option is probably not for your everyday work, you'll need patience and some time spent with the Turtle Reference Manual if you want to demystify all the details of the baking interface. But if you consider yourself a Turtle techie, you will absolutely not be able to resist baking out your own custom lighting passes using Lua scripts!
The Lua baking operates in the sphere surrounding any given surface sample. The baking interface lets you tell Turtle exactly what kind of sampling you wish to perform from the sampling point, what relative coordinate system you wish to work in, what kind of basis you wish to project the sampling to, and stuff like that.