[Music]
welcome to this presentation about
authoring workflows for believable
training and vegetation within unity
hopefully after this presentation you'll
have a better understanding of the
recently added and available resources
for creating your own believable terrain
my name is barrington campbell i'm a
technical artist within the terrain team
at unity
i specialize in tools development and
improving user experiences within the
editor
previous to unity i acquired a game
design and development degree from
rochester institute of technology and
worked in the double a as well as the
indie space
within this video i'll briefly go over
exporting speed tree assets to your
unity project
the new features and updates for speed
tree 8
how to use the new detail instancing
mode to paint instance details on hdrp
terrain and lastly add a distance fade
and terrain layer blending effect to
instance details using shader graph
when it comes to vegetation on terrains
one of the first aspects that springs to
mind is trees
creating believable trees from scratch
can be quite a painful process so the
team over at interactive data
visualization has been working on
speedtree to deal with this hurdle
with the help of the terrain team at
unity we've updated and added new
features allowing you the artist to
utilize the latest installment of speed
tree as a dccc of choice for creating
trees and helping you stay in flow
longer
let's jump into speedtree to edit and
export trees to unity
for this presentation i'm using the
latest version of speedtree 8.5
now that we're at speedtree we can start
working on exporting a tree model
when opening speedtree you'll be
presented with five tree models that are
free and accessible for use within any
project
these free tree models are a great
starting point for familiarizing
yourself with the editing and exporting
of trees from speed tree
let's use the conifer tree for our
terrain
to export a tree go to file
export the
game an export mesh window will appear
i'm exporting directly to my unity
project asset folder
you'll then be prompted with the export
to gate window which requires a few
changes to make life easier you can
start by selecting the unity preset
within the preset drop down
customizing the exportation settings
depends on your project's needs
for example if you desire to achieve
better performance you can select lods
plus billboard under the lod section to
export the full led chain with billboard
cards
within the include section enabling
variations tells the exporter to create
new materials and textures with embedded
variation information
also enabling seam blending adds small
pieces of geometry to the model hiding
any unwanted intersections of the branch
and its parent
under the atlas section you can select
the aggressiveness of the atlas wrapping
to minimize draw calls and memory
consumption a more aggressive wrapping
is recommended
we'll select everything which atlases
all the materials of the tree to help
with performance
the geometry section is used to arrange
the tree's transformation to meet the
requirements of the engine or software
you're exporting to
using a preset drop-down pre-populates
the proper settings for the selected
software
lastly the texture section is used to
alter the resolution and formats of the
exported textures which is useful for
minimizing memory consumption or
increasing texture quality
once the desired settings are selected
you can click ok
wait for exportation to complete
and transition to unity
as of the recording we're using unity
2021.2 beta 1 for this hdrp project
you'll be able to use the same features
in this video with newer editor versions
as well
after the speed 3 assets are imported
the normal map settings window will pop
up
make sure to click the fix button to
assign the proper normal settings
within the project window we can find
the exported speed tree assets
if you follow the previous speed tree
exportation settings you should see the
trees sd file shorthand for speed tree
and the big textures for the billboard
as well as the model
one benefit to using the latest b3a
assets is the ability to make shader
changes to your trees within shader
graph
unlike the previous spetry shader
importing speedtree assets automatically
assigns a specific shader graph within
hdrp
the shadowgraph is also sop battery
compatible while not using wind
to access the tree's materials in shader
graph first select the speed tree model
within the project view
then select the materials tab within the
tree's import settings inspector window
lastly click extract materials
after the materials are extracted you
can access the shader by selecting the
materials and clicking edit
within the speech create shader you have
access to the normals
subsurface scattering
billboard
wind
and more
editing the sub graph gives you full
control over how you want your trees
rendered
with all the necessary assets properly
imported we can begin adding trees to
the world using one of two approaches
the first approach is by individually
hand placing the trees
simply select the tree model within the
project folder and drag it into the
scene
hand placing trees gives you the
greatest control over the tree's
positioning
the second approach is by using
terrain's tree brush to paint or mass
place trees
to start painting trees you'll need to
select the terrain and then the tree
brush
click edit trees
add trees
assign the speed tree model
and finally click add
from this point you can start painting
individual trees or mass place them with
one click
with the trees placed in our scene we
can then begin adding terrain details
terrain details within unity are
considered foliage assets that are not
trees for example bushes flowers and
grass
unlike trees details cannot utilize lods
and collision detection but are more
performant when rendering a greater
amount of foliage
the new instance details greatly
improves on the performance while adding
new features
here's a comparison between the new
instance and the original billboard
details
starting out with detail's instance
limit
the new instance details does not have
an instant count limit while billboard
details is limited per patch
in terms of shaders instance details can
utilize any shader including those
created within shader graph while the
billboard grass is limited to the
built-in grass shader
for hardware usage instance details
improves on leveraging more of the gpu
which minimizes cpu overhead compared to
the billboard details
lastly details are now supported on hdrp
when using instance details
now that we have a better understanding
of the differences let's see how we can
paint instance details on hdrp
training to begin painting instance
details you need to select a terrain and
then the paint details brush
click edit details
add details
assign the details prefab
make sure to have use gpu instancing
enabled
and click add
from there you can start painting
with the details painted we can begin
breaking down the custom grass shadow
graph highlighting new shadowgraph
features that lend to creating effects
for believable details
to begin we'll first need to access the
graph
a simple way to access the shader graph
is through the detailed material
first we'll select the grass material
within the project view
within the materials inspector view
there is an edit button clicking this
button will direct you to the graph view
of the material shader graph
within the graph view there are few key
settings worth highlighting when
creating shadow graph shaders
specifically for details
the first setting is material type
material type determines the underlying
material that is most suitable for your
assets with translucent material type
being the recommended choice for details
unlike the subsurface scattering
material type the translucent type
doesn't blur light and transmits through
the material
utilizing the translucent type enables
subsurface scattering using a thickness
map and diffusion profile
in this instance we're using the default
foliage diffusion profile from hdrp
to minimize on performance degradation
it's also recommended to use alpha
clipping
alpha clipping utilizes the alpha
channel of the base mount texture and
the float value for the clipping
threshold
now with the detail setting established
let's dive into the new custom
interpolated features used to make
believable detail effects
custom interpolators allow you to
perform calculations in the vertex stage
and pass the results directly to the
fragment stage
creating a custom interpolator is fairly
simple and intuitive
first you'll select one of the notes
within the master stack
then you can press the space key to
access the create node window
within the window you'll see an option
for creating a custom interpolator
with the newly created custom
interpolator selected you can edit its
graph properties from the inspector view
the precision field determines the
floating point precision of the result
the name field prescribes a name to use
for referencing
and the property type determines what
data type to use for input and output of
the custom interpolator
accessing the interpolator results is
similar to adding other nodes to the
graph view
start by pressing the space key or right
clicking within the graph view to access
the create node window
then open the custom interpolator drop
down
within the drop down you can select the
desired custom interpolator
simply drag and connect the pin to
access the interpolator's results
now that we understand how to create
interpolators let's look at a few
examples of how this shader utilizes
custom interpolators for distance fade
and blending terrain colors
distant fade is a useful technique not
only for enhancing the visual quality of
details on terrain but also for
improving performance
thanks to the latest updates of instance
details we can now achieve these effects
using per instance positions
let's dive back into shadow graph to see
how distance fade is handled
within the vertex stage there are two
custom interpolators used for handling
distance fade
the first interpolator determines the
intensity value of the fade utilizing
the detailed distance from the camera
the second interpolator determines the
falloff or transition point of the
distance fade color
these two interpolators are connected to
a distance cut off subgraph that
utilizes the three shader graph
parameters we previously changed in the
scene view
let's open the distance cutoff subgraph
to better understand how the fade
results are calculated
the distance cutoff cell graph utilizes
the position of the camera and detail
instance to calculate the distance
between the two points using a variation
of the manhattan distance formula
the remap distance is then used to
determine the output values of the
vertex wave animation movement cutoff
the fade start end and distance learning
between 0 and 1
as well the color falloff transition
also learning between 0 and 1.
back in the main graph view both the
fade and falloff outputs are then piped
directly into the interpolator
while the movement output is utilized in
the wind vertex animation calculation
transitioning to the fragment stage
within the graph view allows us to see
how the custom interpolator results are
incorporated
the fade interpolator value is passed
through both a smooth step and lerp node
to finally be used as the power of the
base map texture
the result is then piped into the alpha
channel for faded alpha clipping
the falloff interpolator value is
multiplied by the w or alpha channel of
the fade color
the purpose of this channel is to be
used as an intensity value
the result of the multiplication is then
raised and left with the fade color
creating the distance faded falloff
color
now that we better understand the
distance fade technique we can
transition to seeing how the shader
handles terrain color lending
terrain color blending is a great
technique for unifying your details
within a terrain
the blending technique utilizes the
train's alpha map to identify the
terrain layer color to blend
each channel gets a separate color
these colors correspond to what type of
terrain layer is painted in that channel
for example
the b channel in the terrain alpha map
is designated to soil
to match the soil splappy's color
parameter is set to brown and blended in
the detail scattered over the soil
texture
the shadow graph also takes into
consideration the terrain size and world
position for mapping uvs
let's see how the uvs are calculated and
the process of blending terrain colors
within the graph view
back in the graph view we can look at
the train space uv group which
calculates the results passed to the
vector 2 custom terrain uv interpolator
the calculation begins with getting the
absolute world position of the detail
instance
a swizzle node is used to mask the x and
z channels
the return vector 2 is then transformed
into terrain space by subtracting the
terrain origin and dividing the scale
the final transform value is passed to
the custom terrain uv interpolator
transitioning to the fragment stage we
can see how the custom uv is
incorporated into blending
fragment blending begins by sampling the
terrain spot map using the calculation
results from the custom terrain uv
interpolator
the sampled fragment channels are then
multiplied by their respective blend
colors
the multiplied colors are then blended
together using interconnected larp notes
the result is then passed to a branch
for toggling the blend effect and lurked
with the fade color before being piped
into the base color of the fragment
master node
i hope you've enjoyed this presentation
and have taken away some useful
information on authoring workflows for
believable terrain and vegetation within
unity
[Music]