This tutorial chapter introduces the 3D painting tools of Realsoft 3D.
The 3D painting system of Realsoft 3D allows you to paint the surface of any geometric object using various painting tools, such as freeform curves, rectangles and circles. The program includes apowerful material system for defining optical and other properties of objects.Furthermore, objects can be textured using various texture projection methods, such as volumetric mapping and UV mapping. In addition to standard mapping methods such as parallel and spherical mapping, the VSL language can be used to define customized and unusual mapping transformations. Realsoft 3D also allows any material property to be defined using any number of textures per surface. The system is very open and the possibilities are endless.
The 3D painting system of Realsoft 3D is designed to support all these features.
It allows you to paint any surface property (including user defined channels), such as color, transparency, refraction or UV coordinates. The painting target may have multiple textures, and regardless of the mapping method, they all are taken into account.
A well-known problem in texturing spherical objects is that it is very difficult to draw textures for the poles of the sphere due to the fact that the UV space in the poles is collapsed to a single point. 3D painting solves this problem.
1. Create an analytic sphere using the Analytic/Sphere tool.
2. Activate the UVimage tool. You can find it from the Materials section of the toolbar.
3. Specify the desired texture resolution (for example 500*500) and set Type to Constant color. Set the Color field to white (1,1,1), which is a suitable base color for the football.
4. Define a suitable File name for the image, for example 'myfootball.bmp'. Click Accept.
This creates and attaches a new blank white image to the selected objects (=sphere) using direct UV map. You can verify this at the sphere's Property window Col tab.
5. Switch to the top view. If shaded OpenGL is not yet on, activate it from the view control bar. This way you will see in real time how the shaded surface gets painted.
6. Activate the Polygon painting tool. Select Filled polygon and set Count to five. The Color field should display black color, because we are going to paint the black areas of the football. Now, enter two points through the view window to specify center and radius for the polygon to be painted.
Activate the Polygon painting tool, turn Filled on and set Count to five. Draw the first polygon onto the north pole.
7. Select Camera/Front from the view's popup menu. Then select Again from the popup menu to draw the second polygon on a new side of the sphere. The Again menu activates the polygon paint tool with exactly the same options as before, so you can just draw the polygon.
Repeat step 7, each time selecting a different view direction from the Camera menu, until you have painted all sides of the sphere.
8. Go to the Select window's Image tab. Double click the name of the image you created with the UVimage tool to view the generated texture.
You can save the generated image using the File/Save As function. If you save the entire project, the generated image (myfoolball.bmp) will be saved also. If you only want to save the painted image, set Sections to Selected and set only the Images check box.
The 3D painting tool set, included in the Materials section of the toolbar, contains specialized tools for most of the common geometric shapes, like circles, rectangles, freeform curves, and polygon lines.
In addition to this, you can also use the four tools included in the Unified menu for 3D painting. Setting the Class option to Paint activates 3D painting mode. Instead of creating new objects, the tools paint the specified geometry to those underlying objects, which have bitmap textures.
The advantage of this painting method is that modeling oriented tools have more options for defining the shape. For example, if you want to paint a circle arc by defining three points through which the circle arc should pass:
1. Create a sphere and attach a texture to it using the UVimage tool the same way as in the football example above.
2. Activate the Circular objects tool from the Unified menu. Set Class option to Paint.
3. Set the Arc check box of the tool control bar. Set the Define method to Three Points in Arc and enter three points on the sphere through the view window.
Check the Arc option and set the Define method to Three Points in Arc. Painted arc shown on the right.
You can use any geometric object as a pen for 3D painting.
1. Create an analytic sphere and use the UVimage tool to create a blank white texture for the sphere.
2. Use the Curve tool (Note: Curve tool of the Unified menu, or the NURBS/Curve tool, but not the 3D painting tool) to create a curve over the sphere.
3. Make sure the curve is selected. Go to the Materials section of the toolbar. Activate the paint with Selected tool and specify desired color and line width. If the curve is open like in the image above,select the unfilled drawing option. Then click Accept.
One advantage of using selected objects for painting is that you can use all geometry manipulation tools to control 3D painting.
For example, you can use the Macro system to paint a certain pattern over the object:
4. Activate Macro/Record from the main menu.
5. Rotate the pen curve a bit.
6. Apply the Selected paint tool.
7. Reset Macro/Record from the main menu and hit the 'Ctrl+g' keys a couple of times to execute the current macro.
The UVimage tool is very powerful and allows you to do much more than just creating new blank textures for objects. This example demonstrates how you can do 3D painting by mapping multiple materials to objects using standard mapping methods, such as parallel, cylinder and spherical maps.
Let's assume that you want to create an object with a marble left side and a wooden right side.
1. Create an analytic sphere.
2. Go to the select window's material tab and map the two materials to the sphere by dropping the materials onto the view window. Move and scale the created parallel maps so that they split the sphere into two halves like in the image below.
3. Go to the object hierarchy tab of the select window. Select both parallel mapping objects, choose Properties from the popup menu. Go to the Spec tab of the property window and set all the Finite options. These options limit the mapped material inside the parallel map's cube like volume.
Select both mapping objects and set the Finite options through the Property Window/Spec tab
Rendering the view window shows the desired division between materials. However, the materials are procedural (defined by mathematical formulas). This means that if you want to export the scene, for example, to a polygon based game engine, the materials must be converted to bitmap images which then can be used as usual texture maps. Continue as follows:
4. Select the sphere and activate the UVimage tool. Set Type to Evaluate. Specify the desired resolution (e.g. 512*512) and file name, and click Accept.
This creates a new image with the specified name and attaches it to the sphere as a direct UV map. You may delete the two parallel mapping objects now.
The generated image can be loaded to any 2D painting program for further editing, etc.
A problem with subdivision objects is that they usually don't have a well defined default UV space which could be used to bind textures on them. For example, when modeling a head, the user starts from a basic shape like a cube or a sphere and uses extrude, subdivide and other SDS tools to add new faces and control points to the object. The tools do their best to guess sensible UV coordinates for the added points, but if the construction process is long and complicated, the UV space of the result object will not be well defined.
The following kind of problems may occur:
UV coordinates of points may not be evenly distributed. A part of model that is big in 3D space may occupy only a little part of UV space. Consequently, it is not possible to paint small details to such parts of the model. Even the smallest point (one pixel in texture image) covers a wide area.
Many parts of the model may have the same UV values. When painting to such an UV folded' part of the surface, other parts will get some paint as well.
Map2Obj tool allows you to redefine the UV space for objects. The general-purpose tool actually can define any surface property of SDS objects, but we will consider only UV coordinates in this tutorial.
The task is to paint a modeled SDS head. The first step is to make sure that the model has a decent UV space.
1. Model a head or load in 'models\sds\head'
2. Create a cylinder mapping object around the head from the top view (activate the Unified/Circular objects tool from the menu and set the Class option to Cylinder map). The material used is irrelevant.
3. Multi select the head and the cylinder mapping object (the order does not matter, because the tool recognizes mapping objects automatically) and activate the Map2Obj tool included in the Materials tab of the toolbar. Set the following options if not already set:
Then click Accept.
The above mentioned settings convert the material mapping space defined by the cylinder mapping object to pointwise UV coordinates of the SDS head. You can verify this through the UV Editor:
4. Select the head and open the Windows/UV Editor window from the main menu.
You can now fine-tune the UV coordinates. Set the head object to point edit mode from the tool control bar. Open the popup menu of the UV editor and make sure that Current UV is selected (it selects the pointwise UV editing instead of face specific coordinate editing). Also, make sure that the defined UV channel 'UV coords' is selected in the popup. SDS objects can namely have multiple UV channels per vertex. Then edit the control points in the UV editor.
The property window allows you to modify UV coordinates numerically:
5. Select the SDS control point(s) by clicking/dragging them through the View window of from the UV editor.
6. Go to the property window's Spec tab.
7. The UV field shows you the current uv value of the selected point(s). Enter a new value to this field.
A note for advanced users: Map2Obj can also be applied to selected points only. This option may be necessary in defining UV spaces for complex shapes. The target material of mapping object may also contain suitable Map coords transformations. For example, the simple transformation 'Map coords = Linear(Map coords)', 'multiply' = '0.5, 0.5, 0.5', 'add' = '0.5 0.5 0.5' in the Surface properties shader maps all the points to one quarter of the UV space. Similar transformations can also be defined using the transformation controls of mapping objects (included in the Property window's Spec tab).
This is another example demonstrating the UV-image tool.
The exercise this time is adding a texture to a face. Painting a human face is not a trivial job, so you might want to use your favorite 2D painting program to do the actual painting.
1. Load in a model of a face (for example the included sample object 'models\SDS\head'). If the object is a subdivision object, make sure that UV coordinates are properly set (see the previous example).
2. Go to the Materials section of the select window. Create a new VSL material called 'face' using the New/From Template tool; the appropriate template is Image Maps/Color Map. Leave the texture file name empty at this point.
3. Map the face material to the face model using parallel mapping as shown in the adjacent image.
4. Zoom in so that the parallel mapping and the face fill the view window. Set view's projection to Parallel and turn shaded OpenGL on.
5. Now, copy and paste the image in the view window to your favorite 2D painting program (such as PhotoShop) by holding down the Alt key and the Print Screen key on your keyboard. Create a new file in Photoshop (File size is automatically the size of the clipboard) and Paste in the image. You can also use Render/Save to File menu of the view's popup to save the contents of the view window and then load it into the paint program.
6. Paint over the shaded face image. When done, use the Crop tool to create a new image, which contains only the pixels inside the parallel mapping.
7. Save the image with a suitable name.
8. Go back to Realsoft 3D. Select the face material and open the property window. Set File name of the material to the image you painted and saved. Close the property window.
9. Ray trace the view window. The face image you painted in your favorite 2D painting program now matches exactly the face model. However, it is mapped using parallel mapping and cannot follow possible deformations of the face. Therefore we have to convert the parallel map to an UV map.
10. Activate the UVimage tool: Set Type to Evaluate. Specify a suitable resolution (can be the same as when you painted the image) and a file name and click Accept.
You have now converted the parallel map material to a direct UV texture. Delete the parallel map object and the face material. Another possible workflow for doing the actual painting in a 2D painting program is the following:
1. Use the UVimage tool to initialize a direct UV texture for the model the same way as in the first Football example.
2. Use the 3D painting tools (the Curve painting tool is quite suitable) to draw rough outlines of important areas like eyes, mouth, eyebrows, etc.
3. Save the project. Start the paint program you like most and load in the UV texture, which already has good drawing guides for the face. Finish the face drawing.
Consider the following problem: an image of a face should be painted on another, completely different face. The image cannot be simply projected onto the face with a parallel mapping, because the size of the nose may be different, etc.
The Paste Colors on Objects tool provides a solution to this problem. This tool allows you to use any 3D object as a projector for projecting the image on the target surface. The image is projected using the current view projection: the target object will get the color of that point of the projector object that appears in the same location in the view window.
1. Load/Create a model of a face. If the face is a subdivision object, set up a proper UV space as instructed in the example 'Painting SDS objects' above. You may use one of the provided face objects, for example 'models/head.r3d'. Turn the view window to show the face from the front.
2. Create an empty UV map for the face using the UVimage tool (see the Football example above). Name the texture file as 'matchedface'.
2. Create a rectangular Nurbs mesh of say, 10 times 10 points. The denser the mesh, the more accurately you can define the projection. Move the mesh behind the face, but in front of the back of the head.
3. Open the property window, go to the Col tab and enter the name of the face image to the Texture field.
4. Select the face object and using the property window's Wire tab, set the No Shading option for it. Alternatively, you may set the 'Forced visibility' wire setting of the projector mesh to, say 0.5. This forces the texture mapped projector surface to show through the shaded face. In both cases the purposes is to see the shape of the face object and the face image at the same time.
5. Go back to view the face from the front view and turn shaded OpenGL on. You will now see the face image through the wire frame of the face object.
6. Select the rectangular mesh. Then use deformation tools and point editing to move the points of the mesh to match the image to the face object.
7. When done, make sure the nurbs mesh is selected. Go to Materials toolbar section and click the Paste Colors tool. Specify a desired sampling quality (e.g. 50*50) and accept the tool. The texture map on the nurbs mesh is projected onto the surface of the face.
You can now delete the projector mesh. You can find the matched face image in the Images tab of the Select window and view it using the property window.
Because the target of painting (or its UV space) can be very curved, the tool cannot guess a good sampling quality. Therefore, the tool asks the user to specify the number of samples to be taken. High sampling values may take a long time to compute. If the suggested quality 50*50 wasn't good enough, you can activate the Paste Colors tool again using higher Resolution values.
Note that you can paint any number of images to the head this way. Just rotate the view and repeat the steps 2-7 to paint ears, wrinkles, hair etc. over the head. New paste operations will overwrite earlier painting on overlapping areas.
In the previous examples, we used the UVimage tool to create and attach a new texture to an object. You can also attach an existing image to an object and paint to it with the 3D painting tools.
There are two ways to connect the target image of 3D painting to the target object of painting:
Direct UV Map
The UVimage tool used in the football example above assigned the created image to the sphere by using the direct uv map method. If you want to use an existing image, you can do this manually as follows:
1. Select the target object and open the Property window.
2. Go to the color tab and specify the desired image in the Texture field.
The specified image is now used as a direct UV mapped texture for the object and all 3D painting tools can be used to paint the object.
Also bitmap textures included in materials and mapped to objects using the mapping tools (parallel, cylinder, spherical, etc.) can be painted with the 3D painting system. The advantage is that you can paint simultaneously to multiple images. Furthermore, the texture map objects can define not only color, but also any other information. You can paint transparency, bumps, and even visibility of materials to surfaces this way, as shown in the advanced tutorials.
For example, to paint bumps to a sphere (sample project: tutorprojects/material/3dpaint/paintbumps)
1. Select the sphere.
2. Activate the UVimage tool. Set Type to Constant color, Color to black and clear the Attach option. Resolution can be e.g. 256*256. Set an appropriate file name, for example 'textures\testbumps'. This creates an empty black texture map, but does not attach it to the sphere as a color map.
3. Go to the Materials section of the select window and select New/From Template from the popup menu. When the file browser appears, select Image Maps/Bump Map and click Open. Open the Property window and set File name to 'textures\testbumps' or whichever name you used in the previous step. Close the Property window.
4. Drag and drop the newbump material to the view window. This creates a spherical mapping that assigns the bumpmap to the sphere.
5. Activate, for example, the Curve painting tool from the Materials section of the toolbar. Select a medium size brush, set non-filled line type and set the color to white. The brighter the color, the higher bumps will be drawn. Then press the left mouse button down over the sphere and draw a curve by dragging the mouse (LMB down). Release the mouse button when the curve shape is ready. Render the view window to verify the result. Use 'Again' from the view popup to draw new curves.
You can also initialize an empty black UV texture map, 3D paint to it and afterwards change the color map to a bumpmap. The advantage of this approach is that you can see the result of painting in real time using shaded OpenGL.
|When painting an object that has multiple textures using 3D painting tools, it may be necessary to protect all but one texture at a time from being modified. For example, an object may already have a color map, which must not change during bump painting. This can be done simply by selecting all mapping objects that you do not wish to paint to, and set Hit Invisible from the property window's Gen tab. If the object has a direct UV map (i.e. Texture field set in the object property window's Col tab) and you wish not to paint on it, the name string must be temporarily cleared. Cut the name, then past it back when painting is done. The trick works because the render engine that handles 3D painting is the same as the ray tracing engine.|