User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mapping:cawe:editingtools:editfaceprops [2007-12-08 22:14]
Carsten Removed obsolete section "The Surface Properties dialog"
mapping:cawe:editingtools:editfaceprops [2013-01-07 12:07] (current)
Line 3: Line 3:
 {{:​mapping:​cawe:​editingtools:​cawe_toolbar_editfaceprops.png?​80 }} {{:​mapping:​cawe:​editingtools:​cawe_toolbar_editfaceprops.png?​80 }}
  
-The Edit Surface Properties tool gives you control over the properties of the //​surfaces//​ of //Bezier patches// and //brush faces//. You can use it to apply and change materials and modify their scale, shift and rotation on the surface. +The Edit Surface Properties tool gives you control over the //​surfaces//​ of //Bezier patches// and //brush faces//. 
-Additionally,​ sophisticated options ​are available to determine these and other attributes of a surface.+You can use it to apply and change materials and modify their scale, shift and rotation on the surface. 
 +Sophisticated controls ​are available to determine these and other attributes of a surface.
  
-The Edit Surface Properties tool can be activated by clicking on the related icon in the Tools toolbar or by pressing the ''​SHIFT+V''​ shortcut key.+The Edit Surface Properties tool can be activated by clicking on the related icon in the Tools toolbar or by pressing the ''​SHIFT+A''​ shortcut key.
  
  
Line 29: Line 30:
 The ''​SHIFT''​ key does not add anything special when the click is on a Bezier patch, The ''​SHIFT''​ key does not add anything special when the click is on a Bezier patch,
 but for brush faces, it causes //all// faces of the affected brush to become selected. but for brush faces, it causes //all// faces of the affected brush to become selected.
-(If ''​CTRL''​ is not held at the same time, one of the brush faces will also be picked for updating the dialog values.)+(If ''​CTRL''​ is not held at the same time, the clicked ​brush face will also be picked for updating the dialog values.)
 You can combine the ''​SHIFT''​ with the ''​CTRL''​ key in order to toggle the selection You can combine the ''​SHIFT''​ with the ''​CTRL''​ key in order to toggle the selection
 status of all faces of the brush. status of all faces of the brush.
Line 40: Line 41:
 ===== Orientation and Material ===== ===== Orientation and Material =====
  
-Once you have selected one or more desired ​surfaces, you can modify their orientation and material attributes.+Once you have selected one or more surfaces, you can modify their orientation and material attributes.
  
-This is easily achieved by the appropriate controls of the related dialog. While pressing one of the small ''​+''​ or ''​-''​ buttons and choosing another material takes immediate effect, please note that entering a new numerical value into the Scale, Shift or Rotation fields by hand requires an additional press on the ''​RETURN''​ key to become effective. +If you have multiple surfaces selected at the same time, the new value of the changed attribute is applied to all of them, while all other attributes are left alone. This allows you for example to replace the material ​or to set a common scale on a number of surfaces all at the same time, while the individual ​shift, rotation and other surface aspects are left alone.
- +
-If you have multiple surfaces selected at the same time, the new value of the changed attribute is applied to all of them, while all other attributes are left alone. This allows you for example to replace the material on a number of surfaces all at the same time, and for example adapt their scale, while the shift, rotation and other surface aspects are left unchanged. This is especially worthwhile when the selected surfaces possibly have different values for the same attribute.+
  
  
Line 56: Line 55:
     * **Apply Material only**: Applies the material, but not the orientation attributes.     * **Apply Material only**: Applies the material, but not the orientation attributes.
     * **Apply View Aligned**: This mode works like a slide-projector:​ The material is projected onto the clicked surface, where the base of the cameras view pyramid defines the plane of projection. (Contrary to a real slide-projector though, parallel rather than perspective projection is employed. Variants of parallel projection are also employed by the other apply modes and are more appropriate for the task at hand.) The orientation attributes are also taken into account. This is a great mode for texturing a rocky wall or any other irregular shape (that consists of multiple adjacent surfaces) seamlessly.     * **Apply View Aligned**: This mode works like a slide-projector:​ The material is projected onto the clicked surface, where the base of the cameras view pyramid defines the plane of projection. (Contrary to a real slide-projector though, parallel rather than perspective projection is employed. Variants of parallel projection are also employed by the other apply modes and are more appropriate for the task at hand.) The orientation attributes are also taken into account. This is a great mode for texturing a rocky wall or any other irregular shape (that consists of multiple adjacent surfaces) seamlessly.
-    * **Apply Edge Aligned**: This mode makes sure that when you click on a surface //next// to the previously picked one (i.e. left-clicked,​ possibly with ''​ALT''​),​ the material is seamlessly aligned across the common edge. This is a worthwhile feature especially when the two surfaces are not coplanar. (It even works when the clicked surface is not immediately adjacent to the other.) \\ FIXME What are the restrictions when Bezier patches are used? +    * **Apply Edge Aligned**: This mode makes sure that when you click on a surface //next// to the previously picked one (i.e. left-clicked,​ possibly with ''​ALT''​),​ the material is seamlessly aligned across the common edge. This is a worthwhile feature especially when the two surfaces are not coplanar. (It even works when the clicked surface is not immediately adjacent to the other.) \\ FIXME What exactly ​are the restrictions when Bezier patches are used? 
-    * **Apply Projective**:​ Like Apply Normal, but this mode also applies the //texture planes U- and V-vectors// of the picked surface to the clicked surface. This mode is the generalization of both the Apply Normal as well as the Apply View Aligned modes, and as the underlying technique is a mathematical projection, it is called Apply Projective. Refer to the advanced section below for more technical information. \\ This is the mode of choice whenever you want to texture a Bezier patch exactly like an adjacent brush face. For example, if you have a wall or a floor that is made of both brush faces and Bezier patches, and you want to apply the material on the brush faces seamlessly to the Bezier patches, just pick up the surface attributes from a brush face, and Apply Projective to the Bezier patches. ​\\ Mode limitations:​ Picking up the attributes from Bezier patch surfaces may not provide sufficient attribute information for this mode to work in some cases. This is true whenever ​the Bezier patches surface was defined by non-projective means. This situation ​is pointed out by the colored backgrounds ​of the Orientation fields in the dialog.+    * **Apply Projective**:​ Like Apply Normal, but this mode also applies the //texture planes U- and V-vectors// of the picked surface to the clicked surface. This mode is the generalization of both the Apply Normal as well as the Apply View Aligned modes, and as the underlying technique is a mathematical projection, it is called Apply Projective. Refer to the advanced section below for more technical information. \\ This is the mode of choice whenever you want to texture a Bezier patch exactly like an adjacent brush face. For example, if you have a wall or a floor that is made of both brush faces and Bezier patches, and you want to apply the material on the brush faces seamlessly to the Bezier patches, just pick up the surface attributes from a brush face, and Apply Projective to the Bezier patches. 
 + 
 +When ''​SHIFT'' ​is held during a right-click on a brush surface, ​the application ​is performed on all surfaces ​of the brush.
  
 The button **to all Sel.** is equivalent to (but more convenient than) right-clicking on all currently selected surfaces with the current **Right MB mode** setting. The button **to all Sel.** is equivalent to (but more convenient than) right-clicking on all currently selected surfaces with the current **Right MB mode** setting.
Line 66: Line 67:
 The materials of selected //brush faces// (not Bezier patches) can be automatically aligned at the top, bottom, left or right edge of the face by the related button in the **Alignment** section of the dialog. The material can also be centered or made fit on the brush face. In all cases, the effect is achieved by auto-adjusting the Shift and/or Scale attributes of the selected brush faces appropriately. The materials of selected //brush faces// (not Bezier patches) can be automatically aligned at the top, bottom, left or right edge of the face by the related button in the **Alignment** section of the dialog. The material can also be centered or made fit on the brush face. In all cases, the effect is achieved by auto-adjusting the Shift and/or Scale attributes of the selected brush faces appropriately.
  
-( FIXME The above applies to brush faces only. ) \\ 
 ( FIXME Re-pick the first selected surface in order to update the dialog attributes! ) ( FIXME Re-pick the first selected surface in order to update the dialog attributes! )
  
Line 72: Line 72:
  
 ==== Fit on Bezier patches ==== ==== Fit on Bezier patches ====
-Note that for Bezier patches, the **Fit** button works a little ​differently than for brush faces: +For Bezier patches, the (highly useful!) ​**Fit** button works slightly ​differently than for brush faces: 
-Although in both cases the material will be made "​fit" ​on the underlying surface, Bezier patches are from then on in a different texture-coordinate generation ​mode than brush faces. This is because for brush faces, you could have achieved the same effect by manipulating the Scale and Shift manually until the result is identical. With Bezier patches, which can be curved to any shape (e.g. cylindrical or spherical), this is impossible.+Although in both cases the material will be made "​fit" ​to the underlying surface, Bezier patches are then in a different ​mode regarding ​texture-coordinate generation than brush faces.
  
-As a result, the Bezier patches ​whose material is applied with the **Fit** button ​(a highly useful button with Bezier patchesputs them into a different texture-coordinate generation ​mode that is not compatible with that of brush faces: You cannot pick such Bezier patch surfaces and apply them directly to brush faces (but still to other Bezier patches), and -- more importantly -- the Scale attribute now indicates the number of repetitions of the material on the surface, rather than the number of texels per world unit as usual. The background of the Orientation attribute fields is colored in order to indicate that a Bezier patch surface has been picked that is in this special texture-coordinate generation mode.+This is because for brush facesyou could have achieved ​the same result by manipulating the Scale and Shift manually. With Bezier patches, which can be curved to any shape (e.g. cylindrical or spherical), the same mathematics cannot achieve the same effect, and thus using the **Fit** button ​on Bezier patches puts them into Fit mode that yields ​the desired result.
  
-You can "​revert"​ the behaviour ​of such a Bezier ​patches ​surface by picking the surface attributes of a brush face and right-click ​applying them to the Bezier patch in **Apply Projective** mouse-button mode.+The essence of Fit mode is that the Scale attributes now indicate the number of repetitions of the material along the surface, rather than the number of texels per world unit as usual. 
 + 
 +Because of this difference, while applying the surface properties of such Bezier patches to other Bezier patches is straightforward and intuitive, applying the same attributes to brush faces is sometimes not possible without distortion. Such cases are easily fixed though by clicking and editing the affected brush surface. 
 + 
 +The line “Mode: Fit” near the Orientation controls indicates that the current surface values were taken from a Bezier patch that was in Fit mode. 
 + 
 +You can "​revert"​ the mode of such a Bezier ​patch surface ​back to normal ​by picking the surface attributes of a brush face and applying them to the Bezier patch in **Apply Projective** mouse-button mode.
  
 ==== Plane Indicators ==== ==== Plane Indicators ====
Line 87: Line 93:
 ===== How do I ... ===== ===== How do I ... =====
  
-==== texture brush faces? ====+==== ... texture brush faces? ====
  
-==== texture Bezier patches? ====+Individual brush faces are easily textured by left-clicking them to pick their attributes into the dialog. 
 +Then you use the controls in the dialog to directly modify the orientation,​ alignment, etc. 
 +The changes become immediately visible on the selected face in the 3D view. 
 +You may check the **Hide Selection Overlay** checkbox in order to hide the selection mask.
  
 +For texturing a larger area of your map where many brush faces are to be textured in a similar style,
 +you should first texture one of the surfaces as described above, then use the [[#​right-click_application|Right-Click Application]] feature to apply the texture to all desired surfaces in the 3D view quickly.
 +Make sure that you understand the apply modes of the right mouse button in order to get the best out of them.
  
-===== Using the Edit Surface Properties tool =====+Repeat this with other textures of your choice, and fine-tune them individually in the end.
  
-On activation of the edit surface properties tool, its dialog is opened immediately. When activating the tool for the first time, you'll find default orientation values and the default material displayed in the dialog. 
  
-To edit the properties of a surface you have to select one by left clicking on itThis results in a pickup of its current surface properties into the dialog, so you will probably see a change in the orientation values.+==== ... texture Bezier patches? ====
  
-Now you can adjust these values using the +/- Buttons or by entering a value and pressing ''​ENTER''​. ​This will immediately apply the changed value onto the currently selected surface(s). You can also use the alignment buttons to automatically shift and scale a material so it is properly aligned onto the surface. Note that this does not change the shift and scale values in the dialog. To see the newly created orientation values in the dialogyou would have to reselect the surface.+This is as easy as texturing brush facesbut sometimes Bezier patches are textured for a specific purpose:
  
-Another possibility ​to pick up material properties is to use the eye dropper. This is done by left clicking onto a surface while holding down the ''​ALT''​ key. Using the eye droppersurface properties are picked up and shown in the dialog but the clicked surface is not selected.+Bezier patches that are a part of a floor or ceiling plane are often to be textured so that the transition ​to the adjacent brush is seamless. This is easily achieved ​by picking ​the texture from the nearby brushselect **Apply Projective** as the **Right MB mode**, then right-click apply the material to the Bezier patch.
  
-As hinted above changes in the dialog ​are applied ​to all selected surfaces. To select more than one surface you have to hold down ''​CTRL''​ and left click on a surface. This will add the surface to the current selection. Note that when selecting a surface holding down ''​CTRL''​ its properties are not picked up as it is done with a normal left click.+Bezier patches that represent bulges, dents or small terrains that are expected ​to blend seamlessly into neighboring brushes are also well approach by the projective or view aligned apply modes.
  
-Applying orientation values trough the dialog only applies the value that is changedso if you edit the x shift valueonly this value is applied to all currently selected surfaceYou can also apply an orientation value to the current selection without changing it by selecting its input field and just pressing ''​ENTER''​.+Pipespillarswall arches and similar objects are best textures by using the **Fit** alignment button. 
 +The material then covers them naturally, and you can conveniently set the number of texture repetitions ​by the Scale values in the dialog.
  
-Another way to apply orientation values from the dialog is by right clicking onto surfaces. Doing this the right mouse button mode is used to apply the properties shown in the dialog onto a surface. These modes are described above. You can also use the apply mode on all currently selected surfaces by clicking the **to all Sel.** button. 
  
-Sometimes it is desirable to adjust orientation values in the dialog without applying them immediately to a surfaceTo do this you have to deselect all surfaces by pressing ''​CTRL''​+''​Q''​Now you can edit the orientation values in the dialog freelyIf you want to apply the orientation values to a selection of surfaces, you have to select them holding down ''​CTRL''​ even when selecting the first surface, so your orientation values are not overwrittenThen you can click the **to all Sel.** button and apply the prepared orientation values using the current right MB mode.+==== ... deal with the "​Picking [...] is not possible"​ message? ====
  
-It might happen that picking ​up surface properties ​(either by selecting or with the eye dropper tooldoesn'​t work and the message "​Picking orientation values from objects ​with custom UVs is not possible."​ appears on the screen. This means that the material is applied in a custom way and the dialog is not able to read definite orientation values from this surfaceIt is still possible to select such surfaces ​and apply new values ​to them, thus ending their custom state.+This message can occur when picking (left-clickingBezier patches that were created ​with previous versions of CaWE, or Bezier patches ​that were imported from other games and file formatsSuch Bezier patches got custom texture-coordinates assigned ​and are in "​Custom"​ tex-coord generation mode; you may refer to section [[#​advanced_considerations|Advanced Considerations]] below for more details.
  
-Another special case are bezier ​patches that are newly created or whose material ​is applied using the **FIT** button. In both cases the material ​is not plane projected onto the patchbut applied in a way only suitable for bezier patches. Picking up the properties of such a bezier ​patch results in blue colored orientation values. This shows that applying these values onto a face might have an unexpected result since these values have another meaning for fit applied bezier patches.+Nothing is inherently wrong with Bezier ​patches ​in Custom mode, you just cannot pick their surface properties and apply them to anything else. As soon as you assign surface properties from another brush face or Bezier patch (that is not in Custom mode) though, ​the Custom mode is overwritten with the newly applied propertiesand the Bezier ​patch acts normally then.
  
-===== The Edit Suface Properties Tool mouse usage ===== 
  
-  * ''​Right click''​  +==== ... deal with "Mode: Fit" orientation attributes? ====
-    * no key pressed: Applies surface properties shown in the dialog using the selected apply mode only to the clicked surface. +
-    * ''​SHIFT''​ key down: Applies surface properties shown in the dialog using the selected apply mode to all faces of a brush, if performed on a brush (no effect on bezier patches).+
  
-  ​''​Left click''​ +Bezier patches that are newly created or whose material has been applied using the **Fit** button are in the "​Fit"​ texture-coordinate generation modewhose essence is that the Scale attributes now indicate ​the number ​of repetitions ​of the material along the surface, rather than the number of texels per world unit as usual.
-    ​no key pressed: Selects a surfaceclearing ​the previous selection and picking ​the surfaces properties up. +
-    * ''​SHIFT''​ key down: Selects all surfaces ​of a brush clicked on (no effect on bezier patches), but picks up only the properties ​of the clicked ​surface+
-    * ''​CTRL''​ key down: Adds a surface to the current selection without picking up its properties. +
-    * ''​ALT''​ key down: Doesn'​t affect the selection and only picks up the clicked surfaces properties.+
  
-===== The Edit Suface Properties Tool keyboard shortcuts =====+Refer to section [[#​fit_on_bezier_patches|Fit on Bezier patches]] above and [[#​advanced_considerations|Advanced Considerations]] below for more details.
  
-  * ''​SHIFT''​+''​A''​ 
-    * Activates the Edit Surface Properties tool. 
-  * ''​CTRL''​ + ''​Q''​ 
-    * Deselects currently selected surfaces. 
  
-===== Advanced ​considerations on Texture Mapping ​=====+===== Advanced ​Considerations ​=====
  
 +The Edit Surface Properties tool has been written in order to make the texturing of brush faces and Bezier patches simple and consistent.
 +However, brushes and patches are inherently different, and therefore you can do things with the one that you cannot do with the other, and vice versa. This is true for geometric modelling but also has consequences for texturing them with this tool.
 +Moreover, the tool offers several advanced ways to apply textures to the different kinds of surfaces, and you might be interested to learn more on how they work.
 +
 +This section first describes the texture-coodinate generation modes that the tool internally uses, then explains the details of the plane projection mode.
 +
 +==== The Tex-Coord Generation Modes ====
 +
 +Each surface (brush face or Bezier patch) is internally assigned a texture-coordinate generation mode that determines how the texture-coordinates at the vertices of the surface are computed:
 +
 +  * **Plane Projection** is the most frequently used and most important mode. It is //always// used on brush faces (which can never use another mode), but it can also be used on bezier patches. The Plane Projection mode is explained in greater detail below.
 +
 +  * The **Fit** mode is special to Bezier patches, and can only be used on them. Whenever you press the **Fit** button in the dialog, the tex-coord gen. mode of the selected bezier patch is changed to this mode. It is typically used on pipes, columns and similarly shaped objects, making sure that the material naturally fits into the surface of the object. The number of repetitions can be given by the "​Scale"​ parameter in the dialog, which therefore has a different meaning from the Plane Projection mode. \\ (When the **Fit** button is pressed for brush faces, a visually similar operation is performed in Plane Projection mode.)
 +
 +  * **Custom** is reserved for future use and applies whenever the user has specified custom UV texture-coordinates for the vertices of a surface that cannot be achieved with the other modes. It is also used on Bezier patches that were created when the CaWE map file format did not support the tex-coord generation modes. This is true for older CaWE maps and for maps that are imported from other games or file formats.
 +
 +When you pick the attributes of a surface into the dialog, it also remembers the tex-coord generation mode of that surface. Picking is only possible when the surface is in Plane Projective or Fit mode, never in Custom mode.
 +Applying previously picked attributes to another surface (either a brush face or Bezier patch) is always possible, although applying "​Fit"​ mode attributes to brush faces (which can only be in Plane Projective mode) can yield unexpected results. FIXME
 +
 +Picking and therefore applying attributes that are associated with Custom mode to any surface is not possible at all.
 +
 +
 +==== The Plane Projection Mode ====
 +
 +In Plane Projection mode, the texture-coordinates at the vertices of the desired surface are determined by an orthogonal projection of a texture plane P onto the vertices.
 +The parameters of the plane are determined by the Orientation controls in the dialog.
 +
 +The following figure presents the setup in a top-down view: \\
 {{:​mapping:​cawe:​editingtools:​texturemapping.png}} {{:​mapping:​cawe:​editingtools:​texturemapping.png}}
  
-This graphic shows how textures are mapped onto faces. Note that the graphic shows top down viewso the texture planes ​y axis is not visible ​in it+The texture plane P is indicated by the dark blue color, its normal vector in dark green. 
 +The x-axis span vector is indicated in red, as well as integral multiples of its length in both directions. 
 +The y-axis span vector is not included in the image, as it points up or down, into or out of the figure. 
 + 
 +A texture plane is obtained by picking a surface in Plane Projective mode. 
 +For example, texture plane P in the image was obtained by left-clicking on the highlighted face of brush A. 
 + 
 +Note that the x-axis represents one width of the material that is to be applied to the surfaces: 
 +If you change the Scale values in the dialog, the length of the x-axis (and y-axis) changes, too, implying that more or fewer repetitions of the material span given distance in the world. 
 +Changing the Shift values in the dialog moves the x-axis arrow and its multiples along the plane. 
 +If rotation was applied, the x-axis would rotate "​into"​ our "out of" the image, while the y-axis became ​visible.
  
-Textures are mapped on a face by parallel projecting ​the texture from a texture plane P onto a face. +In the dialog, ​the **wrt. World axes** and **wrtFace plane** checkboxes indicate whether ​the dialogs last picked ​plane happens ​to be parallel to the major world axes and/or parallel to the physical surface ​of the picked-from face.
-The texture ​plane from which the texture is projected can be any plane in worlds coordinate system, but is usually chosen ​to be parallel to the face on which the texture should be projected (see faces of brushes A and D in the graphic).+
  
-In the texture plane, a point of origin is needed to determine where the first texture ​is drawn onto the plane. This point of origin is the normal vector from the plane to the world origin and therefore unique for every plane.  +The dotted lines indicate how the material would be applied from the texture-plane to the objects surfaces
-Starting from this point the texture ​is tiled onto the plane whereat ​the length ​of the x axis vector ​is the textures width and the y axis vector (not visible ​in this graphic) is the textures height. The texture repeats itself along the x and y axis (see red dashes).+At object A there is a natural fit, because integral multiples of the material match the extends ​of the object. 
 +Object D is also natural case, but the material would appear shifted on it's surface. You would have to modify ​the Shift attributes ​in order to align it with the extends of the surface.
  
-The vectors ​that decide ​the width and height ​of the texture can be increased or decreased in size to scale the texture. This is what happens when you increase or decrease ​the **Scale** value in the Edit Face Properties dialog (see above). The **Shift** values in the dialog are added as an offset the point of origin of the texture plane to shift the texture in x or y direction. The **Rotation** value is used to rotate the point of origin and in this way rotate ​the texture.+Note that objects B and C are special cases: When you normally apply the attributes ​of plane P to their surfaces, P is moved and rotated first so that it gets parallel ​to the desired surface. This is what the **Apply Normal** mode of the right mouse button does.
  
-How a texture is projected onto face depends on the position of the face in relation ​to the texture plane. In this example ​the face of brush A lies exactly ​in the dimensions of the x axis vector and therefore the texture fits exactly on the faces width. The face of brush D however lies outside the regular tiling of the texture plane and therefore the texture is mapped shifted onto the face starting at the first half of the textures x coordinates.+The **Apply Projective** mode however does not include the additional move and rotate step, and applies ​texture-coordinates //directly as indicated in the figure//. This is sometimes ​very useful feature ​in order to achieve certain effects, for example ​with texturing Bezier patches ​in some cases.
  
-As said above the texture ​plane can be any plane in the worlds coordinate system. This results in texture planes that are not parallel to the face the texture is projected on. +The **Apply View Aligned** mode works similarly, except for the fact that plane P is always forced to be parallel to the base of the view pyramid of the currently active 3D camera.
-In this case the texture is projected in the same way as before, but the result is a contorted texture on the face due to the fact that a smaller texture area is mapped onto a bigger face area (see brushes B and C in graphic).+
  
-In the Edit Face Properties dialog the **wrt. World axes** and **wrt. Face plane** show if the texture plane of this face is parallel to the world axes or to the face plane. It is also possible to set these values and therefore explicitly set the texture plane to world axes or face plane. 
mapping/cawe/editingtools/editfaceprops.1197148491.txt.gz · Last modified: 2013-01-07 12:07 (external edit)