Render to Texture
Tutorial 1 in the Twilight Render V2 Specials Series
Twilight Render has been bringing high quality rendering to SketchUp for years. With the ability to render stills, animations, and batch renders, users have been producing fantastic content from their SketchUp models. Since SketchUp 7, all those years ago, we've been adding new features to make rendered presentations more realistic, more artistic, and easier to create.
With V2.7, we are pushing SketchUp rendering one step further, and embedding rendered images directly into the model itself, displaying your beutiful renders as textures applied to the model geometry itself! The Render-to-Texture tool uses the same renderer, the same materials, and the same lighting to produce great photo-realistic results and then turns around and puts that render directly onto the model.
Render to Texture is a powerful tool that, by capturing the natural light and shadows of your scene, can bring extraordinary realism to your scene. Indirect lighting, soft shadows, colored shadows through glass are all real-life cues that help us understand a three-dimensional scene. By bringing those effects into your SketchUp models, you will be able to present your designs with unprecedented realism, all while still being able to freely navigate your scene!
As with any tool, the quality of your results depend on your knowledge and understanding of how to use the tool, and then the skillful application of that knowledge. This tutorial will walk you through the basics of how to use the Render-to-Texture tool (RTT for short) and then present you with ways to get the most out of it. We will step through some basic SketchUp scenes (included in the links below) so you can try it for yourself.
Getting Started, or 'Setting the Scene'
Render to Texture is 'final-stage' tool. That means you use when your scene is complete and ready for the finishing touches. You don't want to finish your RTT work and then decide you need to move a wall! That would mess up all the shadows and lighting of the surrounding area. So making sure you are ready to render is critical.
The best way to do that, unsurprisingly, is to render your scene as a traditional still image. Pick a good vantage point and render your scene on a preliminary preset (such as Low or Interior, if you need an unbiased render). If necessary, render from several view points to make sure your scene is ready. In this image, we picked our primary vantage point and performed a standard render (using Interior+).
Notice that we are not looking for a final image here, so perfect quality isn't the goal. After letting the image run for about 20 passes, we can confirm that the lighting level, sun position, and background lighting are what we are looking for. It took a lot of trial and error, of course, to find the right settings, especially the sun position. But that is exactly why we take this step; better to figure out the lighting now rather than be disatisfied with the result later.
|Important: Save, Save, Save! Where we go next in the tutorial will result in significant changes to the materials applied to your scene. For your own sanity, save a backup copy of your model now, before you start the RTT process!
Identifying the 'Target'
Our reference image does more for us than just establish the correct lighting. It also helps us to identify where to perform the Render-to-Texture operation. If you thought you would just apply Rendered Textures to every surface in the entire model, then this is a section you should pay close attention to!
In theory, you could apply RTT to every face in the model. If you had enough time and patience to wait, you would eventually get your model... and it would probably look terrible! As mentioned above, getting results is about the skillful application of the tool, and here is where the skill part comes in. Deciding where to apply Rendered Textures is critical to a good result.
Here are some rules of thumb for where to apply RTT textures:
How many preliminary renders you need before moving on to your RTT render depends entirely on the complexity of your scene. In any case, we strongly recommend you take the time to render preliminary images of your scene before jumping in. It will save you time and hassle in the long run.
If we take our image above, right away we can identify some major areas for RTT. The wood deck, below and above, the tile walk ways, and the areas around the railings demonstrate strong shadows and are also large surfaces. These make great candidates for RTT. There are definitely some other areas, especially indoors, but we can start with the outside first.
It's not Always Location, Location, Location
Now that we have identified where to begin rendering, we need to look at how. Just as we said before, you could start selecting faces and rendering right away. But you will not get the best results, with wasted time and texture memory along the way. To get the most out of Render-to-Texture, it's important to know a little about how RTT works under the hood.
When creating rendered textures, if we made a separate material and texture for every face it would be very impractical and we would quickly have an unusable SketchUp scene. Instead, if we combined faces in a practical and efficient way, we can combine many surfaces into a single material and texture. This is a huge advantage in RTT and critical to its effective operation. But it also comes at a cost: size and shape are more important than location.
Consider the images below. Red, green, and blue represent faces of different materials spread throughout a scene.
Now, you could select just the red material (maybe it represents a wood floor). But your resulting texture would look like this.
And that's a lot of wasted space! Here is the critical point: it doesn't matter what the original material is, instead it is more important to combine faces that fit into the available space.
Obviously this may take a little practice to get good at. But keeping in mind how surfaces are packed together will help you avoid wasted space. And that brings us to our second point about size and shape: beware of holes.
If you notice in our reference image, we have a wooden deck around a swimming pool. For all practical purposes, that deck is a single face. So when we go to render it, we are going to get a big doughnut shape with nothing but wasted space in the middle. So now what? Maybe you've already guessed at the solution, break the face into separate pieces! And that will work, sort of. The problem is that, in order to be most efficient, RTT combines faces into a single set of faces wherever possible. So when you break up the deck into pieces, RTT will just put them back together! You could render each pieces separately, but that is terribly inefficient and adds overhead to SketchUp. The good news is that you can turn off RTT's default behavior of combinding faces. Normally, you would not want to do that, but sometimes it's most efficient to keep faces separate.
That's all it takes. Just don't forget to re-check the option afterward!
It's unlikely that we will all become experts at guessing how different faces can be put together. This is why we have added a Warning that will popup when your selected faces will result in a poor render. You may see a warning about a "High Aspect Ratio". This means you have some very long skinny faces that may reduce the quality of your other faces (see the section below). You may also see a warning about a poor "Packing Ratio". This means your faces don't fit together very well and there is a lot of wasted space. You don't have to stop when you see these warnings, but be aware that you may need to take action to get better, more efficient results.
Sizing the Texture
So now we are finally ready to do some actual rendering. I've identified the pieces I want to combine, taking care to break them up where necessary. I have checked my lighting. I have double checked that I saved a backup for my scene (hint, hint). Just one last thing, texture size. This isn't usually a tough decision, but probably will take a little guess work and maybe some trial and error. The standard RTT texture size is 1024 x 1024 pixels. Whether you leave it at that or change it depends entirely on what faces you have chosen. Again, how you choose a size requires a little knowledge of how RTT works.
Within a rendered group of faces, every face keeps the same relative size. So if Face A is 2x bigger than Face B, the texture space used up by Face A is also 2x bigger.
While this may seem pretty obvious, it has some big implications. Consider this image.
We have one very long and skinny piece combined with a bunch of square pieces, like a baseboard mixed with various pieces of floor. If I try to fit that long piece into a 1024x1024 texture, it's going to be scaled down, possible waaay down. And the side-effect is that all those squares are going to be scaled down too. The end result is a low quality texture. So the tip here is to render long, thin faces together and separate from more regular sizes. Taking that one step further, try to combine faces that are more or less the same size and shape. Render-to-Texture is pretty sophisticated at sizing and piecing together faces to create the best result, but the more sensible you can be in choosing combinations, the better the result.
General Tip: SketchUp can handle pretty large texture sizes. However, you should probably try to keep your textures around 1024x1024 or 2048x2048.
Note that if you choose a texture size that is too small, the quality of your texture in your model will be poor, blurry and aliased. If you choose a texture size that is too large you will waste render time and texture memory.
You will probably notice that the texture size only allows you to set one dimension, the Width. That's because all RTT textures start out square. Once the rendering is done, it trims off any unused space to keep your final texture image small.
Finally, have applied all the above tips, we have our first rendered texture. Here we've combined the deck around the pool, broken into separate faces, and tossed in the upper balcony as well.
So how do we get there? That's the easy part.
You will notice as your render progresses that, in the lower right corner, a progress indicator will tell you how many total faces are being rendered and which one it is currently on. When the render is complete you will here the familiar bell sound and your model will automatically be updated with the new texture, material, and UV mappings. (This is why you should always save a backup. The RTT process makes significant changes to your model!)
Choosing the Render Preset
While Render-to-Texture is very similar to traditional rendering, in that we are capturing direct and indirect lighting, it is not nearly as dependent on high quality presets. Because we are rendering a flat face (or a small handful of neighboring faces in the case of curvature), we rarely have complex indirect lighting paths. All that means we can typically choose a pretty low end preset such as Low / Low+.
Now, of course, the same rules apply as always. Don't use light-emitting materials with the biased presets (Low/+ through High/+); if you need light-emitting materials (such as in the Glow scene at the end of this tutorial), use an unbiased material with a low limit on the number of render passes (like 10 or 20). If you get light leaks or blotchy appearance, increase the quality of your preset.
In general, start at the low end of the spectrum. If you don't like the result you can always Undo and retry.
Components and Groups
Using components and groups in an RTT scene requires some special handling, so it's worth going over some points. As you undoubtedly know, components can have multiple instances, all of which are identical. They can be different in size and they can have different default group materials, but the geometry, texture coordinates (UV), and face materials are otherwise identical. This poses a very big problem when trying to use RTT in components. Consider the image below.
Two cushions, two instances of the same component. Notice that one is in the shadows and the other isn't. What would happen if we performed an RTT on one of the cushions?
The cushion on the left has the shadows falling over it correctly. The cushion on the right has the exact same shadows, but it's clearly not in the shadow. So the duplicating nature of Components makes them generally unsuitable for Render-to-Texture. It doesn't mean you can't do it, but generally you shouldn't.
Groups, on the other hand, are non-duplicating and don't suffer the same issue. Replace the cushion components above with groups and you will not have the same problem. But there is some usage notes to be aware of when using groups. Render-to-Texture requires you to select the faces that you want to texture. It requires you to explicitly select the faces. You can not select a group and expect all the faces in that group to be automatically used. You must open the group, select the faces you want, and then perform the RTT operation. Only selected faces will be rendered in the RTT operation.
The natural question from that, then, is "How do I combine faces from separate groups into a single RTT texture". You can not. That is a limitation we have imposed on RTT to prevent certain complications. In general, this will not make using the tool even one bit more difficult as long as you are aware of the behavior. Along these lines, you will also notice that if you open a group (or component, where it makes sense) and select the faces, once you begin the RTT operation the group will fully close all the way to the scene's "root coordinate system" (all groups and components closed). This is a mandatory step required by the way SketchUp reports geometry. If a group is open and Twilight Render retrieves geometry from SketchUp for rendering, there is a very good chance that geometry will be incorrectly positioned. It is necessary that all groups are closed all the way to the root of the scene in order to get correct geometry positioning. Again, this should not be a complication when using the tool but it is something to be aware of.
Warning, Curves Ahead
So Render-to-Texture does a great job on flat surfaces. But what about curved surfaces? A curved surface in SketchUp is just a lot of small flat surfaces, right? So it's no problem at all to just render each one of those faces. While that is true in theory, in practice it doesn't really work out that way. Lots of tiny faces rendered independently just doesn't look that good.
That's where Render-to-Texture's face combining feature really comes in handy. If you remember above, we mentioned that RTT will combine neighboring faces where appropriate. This works great on flat and curved surfaces. By combining faces into a larger group of faces over the surface of a curve, we get much better results. What if we want to render the shadows on this white ball we added to the scene?
You can see that there are many faces, 288 to be exact. We could render them all separately (288 renders, which takes forever), like the ball on the left side below. Or we could combine them into groups or patches like the one on the right (which only took 21 renders, instead of 288, and 1/100th the amount of time).
As you can very clearly see, grouping the faces reduces artifacts dramatically and hugely reduces the render time (yes, it really was 1/100th the amount of render time). In addition to being able to turn this feature on and off (and we have shown when it's useful to have it off as well as on), you can control how aggressively RTT combines faces by setting the 'Curvature Threshold' in the Texture dropdown of the RTT window. The default is 0.2 and works well for pretty much any situation. But in case you want to finely tune it, values closer to zero require neighboring faces to be closer to parallel, while values close to 1 allow faces to be further and further from parallel, all the way up to 90 degrees (perpendicular). It would be a rare occasion where a value of 1 would be useful, however. Most of the time you will want to leave this at 0.2.
|Curved surfaces will always be somewhat susceptible to artifacts when rendering with Render-to-Texture. Projecting a curved surface onto a flat plane, as is necessary to construct the textue map, presents several challenges do to the varying surface normal, viewing angle, etc. To get the best results, we recommend (a) using the default Curvature Threshold, (b) exclude small objects or excessively tight curves, and (c) using more polygons rather than fewer (this may seem counter-intuitive, but more faces produces a smoother transition).|
Once you are done with all your renders, there are still a few steps left to make sure you have a great presentation. These are actually steps you can take at any point along the way (but probably get left until the end anyway). These pointers are modifications to SketchUp's visual presentation to give the best advantage to your scene.
As with all tools, it takes time and practice to use it to it's best effect. Don't be afraid to start small with just a couple of walls and a cube. Once you get the hang of it you will be able to apply RTT effectively to bring your SketchUp scene's to life like never before.
Here are some links to some demonstration scenes you can look at to learn from and get ideas.
Copyright 2012 Twilight Render LLC, All Rights Reserved