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 [2008-01-09 23:42]
Carsten Started revision of the "Advanced considerations" section.
mapping:cawe:editingtools:editfaceprops [2013-01-07 12:07] (current)
Line 41: 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, 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 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.
Line 58: Line 56:
     * **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 exactly 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. When ''​SHIFT''​ is held during a right-click on a brush surface, the application is performed on all surfaces of the brush.
Line 69: 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 75: 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 86: Line 89:
  
 The **wrt. Face plane** checkbox indicates whether the texture plane of the surface is parallel to the spatial plane of the surface. This is never true for Bezier patches (they in general have no inherent spatial plane), and normally always true for brush faces; however you can use the **Apply Projective** right-click apply mode in order to force any texture plane onto any surface. The **wrt. Face plane** checkbox indicates whether the texture plane of the surface is parallel to the spatial plane of the surface. This is never true for Bezier patches (they in general have no inherent spatial plane), and normally always true for brush faces; however you can use the **Apply Projective** right-click apply mode in order to force any texture plane onto any surface.
- 
-( FIXME Update code so that these are indeed indicators only. Move into Orientation section? ) 
  
  
Line 93: Line 94:
  
 ==== ... texture brush faces? ==== ==== ... texture brush faces? ====
 +
 +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.
 +
 +Repeat this with other textures of your choice, and fine-tune them individually in the end.
 +
  
 ==== ... texture Bezier patches? ==== ==== ... texture Bezier patches? ====
 +
 +This is as easy as texturing brush faces, but sometimes Bezier patches are textured for a specific purpose:
 +
 +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 brush, select **Apply Projective** as the **Right MB mode**, then right-click apply the material to the Bezier patch.
 +
 +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.
 +
 +Pipes, pillars, wall 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.
 +
  
 ==== ... deal with the "​Picking [...] is not possible"​ message? ==== ==== ... 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 screenThis means that the material ​is applied in a custom way and the dialog ​is not able to read definite orientation values from this surface. It is still possible to select such surfaces and apply new values to themthus 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 formats. Such 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. 
 + 
 +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 properties, and the Bezier patch acts normally then. 
 + 
 + 
 +==== ... deal with "Mode: Fit" orientation attributes? ==== 
 + 
 +Bezier patches ​that are newly created or whose material ​has been applied ​using the **Fit** button are in the "​Fit"​ texture-coordinate generation mode, whose 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.
  
-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 patch, but 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.+Refer to section [[#​fit_on_bezier_patches|Fit on Bezier ​patches]] above and [[#​advanced_considerations|Advanced Considerations]] below for more details.
  
  
Line 117: Line 147:
   * **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.   * **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.+  * 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 loaded from map files of previous versions or imported from other games or file formats.+  * **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 have picked ​the attributes of a surface into the dialog, it also remembers the tex-coord generation mode of that surface. Applying ​the attributes to another surface (either brush face or Bezier patch) is always possible ​when the attributes are associated to the "Plane Projection" mode. However, if you picked up the attributes ​from a Bezier patch that was in Fit mode, application is possible only to another Bezier patch, but not a brush faceApplying ​attributes that are associated ​to Custom mode is not possible at all.+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 ​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 resultsFIXME 
 + 
 +Picking and therefore applying ​attributes that are associated ​with Custom mode to any surface ​is not possible at all.
  
  
 ==== The Plane Projection Mode ==== ==== 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.1199918523.txt.gz · Last modified: 2013-01-07 12:07 (external edit)