Hang tight while we fetch the video data and transcripts. This only takes a moment.
Connecting to YouTube player…
Fetching transcript data…
We’ll display the transcript, summary, and all view options as soon as everything loads.
Next steps
Loading transcript tools…
How To Create Animated Plants With Shaders | Vercidium | YouTubeToText
YouTube Transcript: How To Create Animated Plants With Shaders
Skip watching entire videos - get the full transcript, search for keywords, and copy with one click.
Share:
Video Transcript
Video Summary
Summary
Core Theme
This content introduces a novel technique for game developers to generate 3D plant and terrain models directly within the game engine's shader, bypassing traditional 3D modeling software like Blender for certain assets.
Mind Map
Click to expand
Click to explore the full interactive mind map • Zoom, pan, and navigate
for years game developers have created
3D models in a program like blender
before loading them into their games but
we can skip this step completely in this
video I'll show a new approach that I
use to render plants and terrain without
importing any models first let's look at
the default blender Cube It's composed
of a bunch of triangles which are saved
to a file this data is loaded onto the
GPU and render to the screen using a
Shader every vertex that the Shader
processes has a unique ID called GL
vertex ID this triangle has three
vertices with ID 0 1 and 2 we can use
this ID to modify the position of each
vertex the Shader on the right has two
lines commented out when uncommented the
top vertex in this triangle will move
from left to right this ID can also be
used to create geometry from scratch
first we'll set the position of each
vertex to zero then we'll position each
ID we are no longer using model data
from blender and we have complete
control over the position of each
vertex I use the same approach to render
terrain and I'll cover this in another
video now let's create a fern by adding
more vertices our Shader code is pretty
messy so let's replace it with some
maths vertices now mooving groups of two
along the x- AIS an odd and even
numbered vertic SE move up and down
along the Zed
AIS now let's use this geometry
generating technique to create some
plants we want our phone to start in an
upright position so rather than
increasing its length it should increase
vertically we also want our Fern to be
curved I'll demonstrate how I achieve
this using pitch and your maths think of
a firstperson game you've played moving
your mouse up and down controls your
character's pitch and moving your mouse
left and right controls its your
pitch and your values can then be
converted to a 3D direction using S and cos
cos
functions let's do this in our Shader
first we need to change the way we use
GL vertex ID it's currently controlling
the height of each vertex but we want it
to control distance which is how far
away the vertex is from the bottom of
the mesh the pitch value controls which
direction to move and the distance value
controls how far to move to bend the
mesh we will increase the pitch value as
the distance increases this causes the
top of the mesh to bend further than the
base of the mesh these two pitch and
bend strength values can now be
customized to bend this mesh in different
different
ways this looks very blocky but when we
put a texture over the top it disguises
the low poly geometry we now have a leaf
that we can use to construct larger
vegetation like a fern but we're missing
the ability to rotate it
horizontally with the leaf standing
upright let's forget about pitch for now
and just look at your similar to before
Geo vertex ID will no longer modify the
x value directly instead it will control
the radius of a small
circle when we Bend this Leaf its tip
moves outwards and has to move in a
larger Circle the orange code controls
the width of the leaf and the blue code
moves vertices perpendicular to the WID
we now have a leaf that we can bend and
rotate it's time to add more leaves but
when I add more vertices the leaf just
keeps getting longer we need a way to
start a new
Leaf in the Shader I'll increase the Y
of the leaf by 90° every 10 vertices
this worked but an Uninvited third Leaf
snuck its way in this is because the top
of the first Leaf is now connected to
the bottom of the second Leaf therefore
creating a new Leaf let's look at a
clearer example we need to get rid of
the two red triangles that are
connecting the mesh on the left with the
mesh on the right one way to do this is
to render each mesh separately but for a
fern containing 100 leaves that involves
sending 100 separate draw calls to the
GPU which is not optimal instead we can
make the triangles invisible I'll move
the bottom right vertex towards the one
on the
left the triangle completely
disappears to use this in our Leaf mesh
we need to add one more triangle at the
start and one more triangle at the end
then the trick is to make these two triangles
triangles
invisible if we repeat this with our
second mesh we can see the connecting
Tri triangles
disappear we've solved our connecting
triangle problem and can now render more
leaves finally we need to animate them I
want each Leaf to move up and down in a
wind-like pattern we can achieve this by
modifying the pitch of the leaf based on
a sine wave this looks weird for three
reasons wind doesn't work like this
every leaf is moving in unison and every
leaf is
rigid let's go back to one leaf and make
this wind animation look more natur
natural a single sine wave is
predictable so let's add and subtract
intervals the leaf is still rigid so
I'll subtract the current time by the
distance variable this makes the tip of
the leaf lag slightly behind the base of the
the
leaf let's add the other leaves
back they are still moving in unison so
we'll offset Time Again by The Leaf ID
the leaf ID is unique per Leaf similar
to to how GL vertex ID is unique per
vertex the very last step is to enable
Shadows I hope you've enjoyed watching
in my next Dev Vlog I'll show you how I
use GL vertex ID to render terrain I'll
leave you with a fancy Fone montage and
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.