TurfFX Effect Layer

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Replaced content with "#redirect Help:TurfFX Effect Layer")
 
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The TurfFX Effect Layer is an [[Effect Layer]] type which is used to render grass (and similar foliage). As with all effect layers, turf is painted onto the terrain and automatically generates appropriate geometry for the area surrounding the camera. As compared to the [[Clutter Effect Layer]], TurfFX offers less flexibility but substantial improvements to performance which in turn allows for greater density at greater draw distances and effective wind-synchronised animation.
+
#redirect [[Help:TurfFX Effect Layer]]
 
+
 
+
=Configuration=
+
 
+
TurfFx is made up of individual polygon blades with many options to configure each blade in your Turf Effect Layer and within the asset itself (the individual asset is explained in [http://online.ts2009.com/mediaWiki/index.php/TurfFX_Effect_Layer#Asset_Creation Asset Creation] below).
+
 
+
== Creating and Editing Turffx Layers ==
+
 
+
[[File:turfeffectlayeredit.jpg]]
+
 
+
 
+
=== Effect Layer Window ===
+
 
+
The Effect Layers window allows you to edit your effect properties. The UI in this window will change based on what effect you choose (clutter, turf, something else).
+
 
+
[[file:turfeffectlayerwindow.jpg]]
+
 
+
 
+
==== Select ====
+
 
+
This allows you to select any existing effect layers to view and edit their parameters.
+
 
+
[[File:turfeffectlayerselection.jpg]]
+
 
+
 
+
 
+
==== Delete ====
+
 
+
This button will delete the currently selected effect layer.
+
 
+
[[File:effectlayerwindow1b.jpg]]
+
 
+
 
+
 
+
=== Add ===
+
 
+
This button will allow you to create a new effect layer.
+
 
+
[[File:effectlayerwindow1c.jpg]]
+
 
+
 
+
 
+
==== Name ====
+
 
+
Enter a name for your effect layer.
+
 
+
[[File:turfeffectlayername.jpg]]
+
 
+
 
+
 
+
==== Turffx-Asset ====
+
 
+
This is where you select a turf asset to be generated for your entire turffx layer. Select an asset you want used in your turffx layer from the dropdown list.
+
 
+
[[File:turfeffectlayerasset.jpg]]
+
 
+
 
+
 
+
 
+
 
+
 
+
==== Turffx-Density Data Binding ====
+
 
+
The "turffx-density" options and associated "constant" value control the [[Effect Layer Data Binding]] (read this link for details) which controls the density of this turffx layer across the route. Density ranges from 0.0 (no turf present) to 1.0 (maximum density).
+
 
+
[[File:turfeffectlayerdensity.jpg]]
+
 
+
[[File:turfeffectlayerdensitydefaultvalue.jpg]]
+
 
+
[[file:turfdensity1.jpg]]
+
 
+
[[file:turfdensity2.jpg]]
+
 
+
[[file:turfdensity3.jpg]]
+
 
+
NOTE: The turffx-density parameter (int1, int2, int4 ...etc) determines how accurate your density will be when painting with the height up/down and sensitivity radius in the topology tab. For example, int1 will give you 1 click while painting to get 50% density and another click for 100% density. Int4 will give you 1 click for 25% density, 2 clicks for 50% density, 3 clicks for 75% density and 4 clicks for 100% density. Obviously the more accuracy you need the more data will need to be stored so use the appropriate data binding for the effect you require.
+
 
+
 
+
 
+
 
+
==== Turffx-Height-Scale Data Binding ====
+
 
+
The "turffx-height-scale" options and associated "constant" value control the [[Effect Layer Data Binding]] (read this link for details) which controls the height of this turffx layer across the route. Height ranges from 0.0 (no turf present) to 1.0 (maximum height).
+
 
+
[[File:turfeffectlayerheightscale.jpg]]
+
 
+
[[File:turfeffectlayerheightscaledefaultvalue.jpg]]
+
 
+
 
+
 
+
==== Geometry-Scale ====
+
 
+
This changes the height of your blade geometry.
+
 
+
[[File:turfeffectlayergeometryscale.jpg]]
+
 
+
 
+
 
+
==== Blade-Width ====
+
 
+
This changes the width of your blade geometry.
+
 
+
[[File:turfeffectlayerbladewidth.jpg]]
+
 
+
 
+
 
+
==== Blade-Width-Noise ====
+
 
+
This adds random variation to the width of your blade geometry.
+
 
+
[[File:turfeffectlayerbladewidthnoise.jpg]]
+
 
+
 
+
 
+
==== Blade-Height-Noise ====
+
 
+
This adds random variation to the height of your blade geometry.
+
 
+
[[File:turfeffectlayerbladeheight.jpg]]
+
 
+
 
+
 
+
 
+
 
+
 
+
==== Width-Scale-Near ====
+
 
+
This defines the shape of your blade geometry up close to the camera.
+
 
+
[[File:turfeffectlayerwidthscalenear.jpg]]
+
 
+
==== Width-Scale-Far ====
+
 
+
This defines the shape of your blade geometry in the distance.
+
 
+
[[File:turfeffectlayerwidthscalefar.jpg]]
+
 
+
[[file:turfshape.jpg]]
+
 
+
 
+
 
+
 
+
 
+
 
+
==== Bending-Scale ====
+
 
+
Defines how much your blade geometry will bend in the wind. (bending strength for wind animation)
+
 
+
[[File:turfeffectlayerbendingscale.jpg]]
+
 
+
 
+
 
+
 
+
 
+
 
+
==== Dispersal ====
+
 
+
Dispersal controls the radius around a seed point to place individual grass blades.
+
 
+
[[File:turfeffectlayerdispersal.jpg]]
+
 
+
[[file:turftdispersal.jpg]]
+
 
+
 
+
 
+
 
+
 
+
 
+
==== Bunching ====
+
 
+
Bunching controls radial alignment of individual grass blades around the seed point. Bunching equal to one (1) produces maximally aligned distribution of grass blades, while zero (0) would result in completely random distribution.
+
 
+
[[File:turfeffectlayerbunching.jpg]]
+
 
+
[[file:turftbunching.jpg]]
+
 
+
 
+
== Painting Turffx ==
+
 
+
 
+
[[File:turfeffectlayerpainting.jpg]]
+
 
+
=Example Usage=
+
[[File:TurfFX-Example0.jpg|1000px]]
+
 
+
[[File:TurfFX-Example1.jpg|1000px]]
+
 
+
 
+
=Surveyor Bulk Editing Tools=
+
 
+
TBD
+
 
+
 
+
=Asset Creation=
+
 
+
==Asset Files==
+
 
+
This section provides help with setup of your individual turf asset (config.txt and textures).
+
 
+
[[file:turfassetfiles.jpg]]
+
 
+
 
+
===Asset Textures===
+
 
+
Turf requires an albedo, normal and parameters set of texture files.
+
 
+
 
+
====Albedo Texture====
+
 
+
RGB: The albedo map defines the base color of each texel. The sRGB color space is used.
+
 
+
A: The alpha channel provides a "black and white" masked alpha channel. Black indicates full transparency, meaning that the fragment is discarded. White indicates full opacity. Transparency will always cost more performance than a full opaque blade of turf so where possible try and reduce the amount of transparency in your texture.
+
 
+
[[file:turfassetalbedo.jpg]]  [[file:turfsubtexturealbedo.jpg]]
+
 
+
 
+
 
+
====Normal Texture====
+
 
+
RGB: Surface normal map. This defines which way the surface is facing, relative to the interpolated vertex normals. Since this is an XYZ format rather than color data, it should never be modified in Photoshop. Using Photoshop to add a fourth channel or copy/paste smaller textures into a texture atlas is acceptable. Per-pixel manipulation or use of filters on the "RGB" channels is not acceptable.
+
 
+
A: Minimap Color Tinting. 0.0 avoids any color tinting from the minimap, while 1.0 tints each blade of grass with whatever ground texture minimap color it is positioned on top of.
+
 
+
[[file:turfgroundcolor.jpg]]
+
 
+
[[file:turfassetnormal.jpg]]  [[file:turfsubtexturenormal.jpg]]
+
 
+
 
+
 
+
====Parameters Texture====
+
 
+
This texture is the same as any other parameters texture in the new PBR materials format. See [http://online.ts2009.com/mediaWiki/index.php/M.clutter#Parameter m.clutter] or [http://online.ts2009.com/mediaWiki/index.php/M.pbrmetal#Parameter m.pbrmetal] for an example of a parameters texture.
+
 
+
[[file:turfassetparameters.jpg]]  [[file:turfsubtextureparameters.jpg]]
+
 
+
 
+
 
+
===Asset Config.txt===
+
 
+
First declare the normal config.txt tags. You must use a "turffx" kind and the trainz-build number must be 4.6 or avoid.
+
 
+
  kuid                                    <KUID>
+
  kind                                    "turffx"
+
  username                                "NAME"
+
  trainz-build                            4.6
+
  category-class                          "FF"
+
 
+
 
+
Next you will want to start the main season-turffx container. This container provides a lot of configuration for your turf asset.
+
  season-turffx
+
  {
+
 
+
 
+
Container "0" is for the season summer in this example. (see the "season-selector" below for clarification on this). We will also use container "1" for winter and "2" for above the snowline.
+
    0
+
    {
+
 
+
 
+
We declare our summer textures here.
+
      albedo-texture                      "summer_albedo.texture"
+
      normal-texture                      "summer_normal.texture"
+
      parameters-texture                  "summer_parameters.texture"
+
 
+
 
+
You now need to determine if you will be using 2 or 3 control points to generate your turf blades. We will define a set of control point values to generate blades from in the "blade-control-points" container below.
+
      num-control-points-per-blade        3
+
 
+
 
+
Expansion constant is used to determine the max density of the overall turf effect layer.
+
CPU Procedural.
+
Range -10.0 .. 10.0
+
Default 1.0
+
Expansion = "expansion-constant" + "expansion-multiplier" * "value0"
+
      expansion-constant                  0.5
+
 
+
 
+
Expansion multiplier is used to determine the max density of the overall turf effect layer.
+
CPU Procedural.
+
Range -10.0 .. 10.0
+
Expansion = "expansion-constant" + "expansion-multiplier" * "value0"
+
      expansion-multiplier                0.1
+
 
+
 
+
Number of seeds is used to determine the max density of the overall turf effect layer.
+
CPU Procedural.
+
Range 0.01 .. 1.0
+
Number of Seeds = "number-of-seeds-multiplier" * "value0"
+
      number-of-seeds-multiplier          0.15
+
 
+
 
+
Per grass zone.
+
"Density falloff affects the amount of grass blades used to represent an individual grass patch. Density should decrease or remain constant with distance. It should always be in the interval [1, 0]. Negative power would produce constant density = 1."
+
"Density = pow(max(1.0 - clampedDistance / densityClampFar, 0), densityFalloffPower)"
+
      density-clamp-far                  500
+
 
+
 
+
Per grass zone.
+
      density-clamp-near                  0
+
 
+
 
+
Per grass zone.
+
"Density Compensation parameter allows to increase individual blade width up to the limit specified and compensate grass density with reduced number of glass blades."
+
      density-compensation-max            2
+
 
+
 
+
Per grass zone.
+
      density-falloff-power              6
+
 
+
 
+
Per grass zone.
+
      edge-offset-far                    0,0,0,0
+
 
+
 
+
"Edge profile offset relative to strand shape (m)."
+
4-component vector.
+
Per grass zone.
+
"If edge profile is lower than this, it would be zero."
+
"If an absolute interpolated edge offset value is less than a minimal threshold, edge offset would be zero. Offset threshold should be used to simplify the blade at a distance where edge offset doesn't affect visuals."
+
In other words, use this to turn off crease rendering in the distance to save polygons.
+
      edge-offset-minimum                0.004
+
 
+
 
+
Per grass zone.
+
"Edge profile offset relative to strand shape (m)."
+
"Defines edge offset along the normal in world units relative to the center of the grass blade."
+
So basically, you can add a crease in the center of each blade. Again, you can control root, mid low, mid high, tip.
+
4-component vector.
+
      edge-offset-near                    0,0,0,0
+
 
+
[[file:turfedges.jpg]]
+
 
+
 
+
 
+
 
+
Per grass zone.
+
"Smoothness = pow(max(1.0 - clampedDistance / smoothnessClampFar, 0), smoothnessFalloffPower)"
+
"Smoothness falloff is used for a linear interpolation between near and far per-blade parameters. Near value would be chosen for smoothness = 1, far for smoothness = 0."
+
      smoothness-clamp-near              0
+
 
+
 
+
Per grass zone.
+
      smoothness-clamp-far                20
+
 
+
 
+
Per grass zone.
+
      smoothness-falloff-power            2
+
 
+
 
+
Per grass zone.
+
"Number of subdivisions along the strand"
+
"Tessellation controls subdivision along the blade. Valid values should lie in the interval [1, 64]."
+
      tessellation-level-near            16
+
 
+
 
+
Per grass zone.
+
      tessellation-level-far              1
+
 
+
[[file:turftessellation.jpg]]
+
 
+
 
+
 
+
 
+
Clutter-assets are used as a fallback when TurfFX is disabled or not available. You can configure this manually in the game settings for testing.
+
 
+
The intention here is that you should provide a clutter effect which looks reminiscent of the TurfFX asset in question. You should not attempt to exactly duplicate it, and you should especially not attempt to achieve TurfFX levels of polygon density, animation, etc. It is a safe assumption that any computer which is using this fallback is below our recommended spec, and the user will value performance over full graphical detail. However, you should avoid the effect looking completely terrible- if performance is that important, the user can switch the grass effect off entirely.
+
 
+
A single asset to use as a clutter mesh.
+
      clutter-asset                      <KUID>
+
The spacing (in meters) for the clutter asset.
+
      clutter-draw-distance              100
+
The draw distance (in meters) for the clutter asset.
+
      clutter-spacing                    1.4
+
 
+
 
+
Per grass zone.
+
This is an array of (2x or 3x (3-component-vector)) depending on what you defined in your "num-control-points-per-blade" tag.
+
Control points define the global shape variation for a particular grass type. Currently there are only two options: grass blades with 2 and 3 user-defined control points. For example with 2 user- defined points there is a root point and 2 extra points (with coordinates relative to root) which form each blade. An asset stores an array of those 3d control points where each pair corresponds to a separate grass blade(they are assigned in round- robin manner) . Also there is no need to vary the rotations as those are automatically added by the library. You can start with a single blade and later add as many as needed to create a variety of shapes."
+
      blade-control-points
+
      {
+
        0                                0.02,0.7,0.1
+
        1                                0.63,1.25,0.6
+
        2                                1.1,1.15,0.95
+
      }
+
[[file:turfpointcontrol.jpg]]
+
 
+
 
+
    }
+
  }
+
 
+
 
+
 
+
=Hardware Limitations=
+
As an NVIDIA-provided visual effect, there are some hardware requirements and limitations which apply to TurfFX.
+
 
+
1. TurfFX is currently supported only for Windows.
+
 
+
2. TurfFX requires a GPU with substantial amounts of VRAM. Whereas Trainz will typically run (albeit slowly, or at reduced settings) on below-spec computers, TurfFX may need to be disabled entirely if the GPU is insufficient.
+
 
+
Trainz offers a fallback mode which effectively replaces the TurfFX layer with an equivalent Clutter layer. This results in a weaker but still acceptable overall visual result. Alternatively, the user may opt to disable TurfFX entirely, in which case the TurfFX Effect Layers become invisible.
+

Latest revision as of 16:35, 12 June 2018

  1. redirect Help:TurfFX Effect Layer
Personal tools