Stylized Grass and the many techniques available in UE to reach the desired style & performance
Vložit
- čas přidán 9. 07. 2024
- Files are available as a Tier 2 reward on my Patreon: / ghislaingir
Twitter: / ghislaingir
Links:
- Ghost of Tsushima Video: • BEAUTIFUL environments...
- Nanite & Fornite: www.unrealengine.com/en-US/te...
- GDC God of War Talk: • Interactive Wind and V...
- Stylized Trees: • My process for creatin...
- Baking Pivots & Data in UVs: • Baking custom data int...
- Flipbook FFT: • #notGDC 2023 - FFT Oce...
- Candles: • Advanced Stylized Cand...
0:00 Intro
3:12 Blender - Grass Cards
4:49 Performance Considerations
7:10 Blender - Grass Mesh
8:10 Blender - Data Baked in UVs
9:17 Blender - Grass Textures
9:58 Color Splat Map
10:28 Blender - Distance Field Texture
11:00 Flowers & Plants
11:21 LODs Import & Setup
12:05 Shadow Casting Grass?
12:49 LODs Distance
13:10 LODs Materials
13:34 Instancing - Foliage Tool
13:55 Instancing - Procedural Foliage Tool
14:10 Instancing - Custom Blueprint
14:42 Instancing - UE5 New Procedural Tool
14:52 Instancing - Using a Landscape
16:39 Landscape Material
17:28 Ground Grass Texture
18:15 Landscape PBR Properties
18:43 Runtime Virtual Textures
19:22 RVT Setup
20:08 RVT YCoGg Format
20:29 RVT Grass Layer
20:49 Grass Material
21:09 Grass Normals
21:49 Grass SSS
22:10 Grass RVT Landscape Blend
24:03 WPO - World Position Reconstruction Basics
26:41 WPO Issues
27:50 WPO - Using Pivots
29:47 WPO - Applying the Object Transform
37:33 Scale World Map
38:29 PerInstanceFade Scale
39:09 RVT Grass Layer Scale
39:24 RVT Tricks
40:06 View Tilt Offset
41:37 View Occlusion
41:52 View Occlusion - Dithered Opacity
42:05 View Occlusion - Distance Field
42:32 View Occlusion - Camera Avoidance
46:23 Wind Animation - Intro
47:57 Spherical Reprojection
50:47 Wind Map
51:19 Sampling the Wind Map
52:22 View Depth Offset
53:02 Ground Projection
54:24 Clump Map
55:56 Custom Billboards
57:09 Billboard WPO
1:00:00 Custom LOD Setup
1:05:00 Outro
Hey! Here's my long awaited stylized grass breakdown/tutorial/course/whatever-it-ended-up-being.
Apologies for the very long video, I tried to make it as beginner friendly as possible while trying my best to explain quite a few complicated techniques, so the duration exploded! I might have over-explained some things here & there so feel free to use the timestamp to skip to the good parts!
Huge thanks to my patreon supporters for making this video possible. Feel free to join in if you want to see more videos like this one!
I hope you'll like the video, cheers! - Hry
Dude I love you.
These kind of tutorial never go in depth and never speak about performance issues, which is the main problem when actually trying to ship something.
Thanks a lot!
me being completely lost the whole video
Ghislain: buckle up, heres where things get tricky
😬
@@ghislaingirardot btw it Is awesome And something i ve been looking for the entire time ♥️
1 hour grass tutorial wtf....AND I'M ALL UP FOR IT, brb snacks :D
This is absolute platinum of a learning resource, just loads of well organized good to know, shown clearly and concisely. This is going to be providing immense benefit to so many artists for years to come
Thanks for the kind words 😉
Amen, this is the absolute gold standard of grass tutorials.
The top-down orthographic render method to get the ground texture kind of blew my mind. I've been making landscapes for years and such an obviously simple solution never crossed my mind. Thanks!
Sometime the simplest solution works best :D
Even though a lot of math goes over my head, it's still incredibly clear and I'll do my best to follow this approach! Thank you!
This is now my favorite Video on CZcams and I am so thankful for it! This is such a nice learning ressource and I can not wait to recreate it step by step. It might take me a full week to really grasp all the vector magic necessary, but with your clear explanation I will manage.
I do truly love you for your work and we are blessed to be gifted with all of it, especially with it all being so accessible and free. Thank you so much! 🙏
Np, glad I can help and thanks for the kind words! Mcuh appreciated! Best of luck with your stylized grass (=
I just recently started using UE5 and I was struggling to make a proper landscape and get the grass to work, thank you so much for giving such an extensive tutorial!! I've looked through many videos and this one is by far the most thorough one :) thank you!
Man, you're insane. Thank u so much for providing something clearly like this.
Been anxiously waiting for this video. What a perfectly thorough tutorial!
Thanks for making a cool grass shader seem a lot less daunting.
Ty! :D
What a masterclass, and the work that went into making the video and visually explaining concepts and techniques is equally amazing. Subscribed to Patreon.
Thanks for joining in & the kind words :) appreciated
Ghislain Girardot tutorials are gold. 10/10 IGN
Thanks :D
His tutorials are gold, but if IGN recommended them I'd have never clicked on the video.
@@SomethingEternal 🤣
Loving your new video format man. Thanks for all of this knowledge
Thanks! Glad to share.
Amazing video, I love that you explain the reasoning behind every choice, elaborate on the various options and suggest various ideas to experiment with.
This was really informative also the grass tiling texture trick seems so simple but it's small things like that, that people can miss so easily or try to come up with something more complicated when a good solution to a problem is right in front of you.
Thanks, much appreciated :)
This will be the video I'll return too when I need to do grass again. Not being much of an artist, this is the sort of thing I struggle with. Nice to see all the different approaches. Nice work.
Thanks!
Wow I really need to try this out for my next project!
Absolute banger of a video!
tres tres bon video, merci boku
incredible video, thank you
Thank you soo much!
Thank you very much for your wonderful sharing. By the way, I find that ClumpMap or ScaleMap can be used to add more color variations, such as grass that grows very lush due to organic matter accumulation, and their color will be more saturated. I applied them to my grass and they looked better👍.
You know I've been trying to recreate the feel of digital anime nature art in ue5 and keeping it reasonable perfomance-wise, the goal is up there, my knowledge is not quite, so the journey was pretty rough. But dear fucking god watching you feels like cheating. You've solved so much problems for me and probably saved weeks, if not months. I thank you from my very soul, and hope you'll do more similar in-depth videos about something else
Thanks for the kind words, I m glad I could help😇
Fantastic!
Fantastic!!
hi i'm in 3d/video game school just to tell you that, your video is so much better in every sense of the word than my courses i have, thanks for this tutorial ♥
Thanks! Sorry to hear that, in a way. Hope your course ramps up in quality!
超详细,超赞!👍
Awesome tutorial! love your French accent bro.
Thanks! What French accent? 🙃
Please tell me more about it. It is very interesting to study this method.
new hero of a realm discovered!🎉
AAA looks ! Greeat tutorial
Wow the ground grass texture by screenshot is so smart haha
Yay
I need to learn how to do this grass cause I dont know how I get the bevel in like you have and how you make them in this way exactly
I have to say I've spent hours, days, maybe even months watching technical gamedev videos on youtube and elsewhere trying to grasp what I possibly could with my failing maths & programming "skills", but this is by far the most effective learning tool I have ever come across in terms of pure quality vs effectiveness.
Even without a strong programming or technical background the pure simplicity in the way this shader addresses the many problems of grass rendering in non nanite UE is just elegant, beautiful.
and I'm not speaking of the art quality here, just purely from a technical standpoint this is already magnificent. thanks so much for sharing!
Thank you! Much appreciated :)
Why arent you using nanite and lods instead? I didnt finish the video so idk if you answer the question, there is so much content haha
Got a bit lost in the textures part, I'm a begginer in Blender and also UE. So I tried baking normals after shear, but they didn't take effect in the flat one. Also, one side of the plant is invisible. I'm first doing one single grass to multiply, but if I manage to know how, I intend to make more plants.
Yup I couldn't afford to explain everything in great details so I went a bit fast over the Blender part. I'd double check your material setup & bounding box. Best of luck.
Great video! But how the baked pivots in a 0-1 uv range translated in offsets larger than 1 unreal unit? I mean since the dots were values from 0 to 1 dont you need to multiply them with a number to hit the initial offsets that might be 50 units for example?
Ty! The baked pivots are not in a 0-1 range in UVs but in centimeters so there's no need for a multiplier
@@ghislaingirardot Oh thank you very much! I just put them in the 0 to 1 uv box and multiplied with the counding box size that is 40 for me. And it works. But I will just scale the uvs in blender
@@steliosstavropoulos499 Yup, it works just the same :) Normalizing position based on bounds is great if you want to bit pack position! You'll likely use 16bits UVs in UE though, so you can definitely afford to store the pivots directly in centimeters and avoid a multiply in the vertex shader. Realistically, it's not going to make any difference, performance-wise, but oh well, you do you :)
Very interesting techniques discussed in this video. Unfortunately most of the WPO stuff won't work in UE5 because pre-skinned local position doesn't work with nanite foliage.
Never mind, the issue was in the TransformPosition!
@@Xperto_ You could always use AbsoluteWorldPosition passed in a TransformPosition node from World To Local, if PreSkinnedLocalPos is troublesome with Nanite. I haven't toyed much with Nanite unfortunately so I fear I won't be able to help you troubleshoot any issue. Best of luck I guess :D
@@ghislaingirardot The preskinned local position seems to be working fine even with nanite foliage but thanks for the tip!
Thank you for such an amazing video! Lots and lots amazing technics. But I have a question.
You wrote such a complex shader and this shader would be instanced thousand of times, isn't this is equally bad in terms of performance as having a lot of vehicles? Isn't shader complexity is a concern for performance purposes too? Thanks in advance.
Hey, thanks for watching!
To answer you briefly:
- I'm not sure what you mean by that, but a shader isn't instanced thousand of times and the comparison with vehicles is... strange?
- Sure shader complexity is a concern for performance, but profiling speaks for itself, the shader is performant. It's not because you have a complex graph that a shader badly performs. Context matters.
- The graph looks complex but the HLSL code isn't that complicated and most of the logic happens in the vertex shader and doesn't contain costly maths nodes (trigonometry). And I have made sure to keep the vertex count as low as possible, as demonstrated.
- If you want a shader to perform as best as possible, use an empty shader and have no feature :) At one point you have to pay a cost to have a shader that has features. If you're tight on budget, get rid of some features. See what's worth paying the cost for your own use case.
Hope that helped
@@ghislaingirardot Yes, that's answers my question fully. Thank you very much.
this video not for beginner, its just advanced
@ghislain Giradot what is the command for that ? @ 5:55
stat memory
Great Tutorial, you are really good at explaining things. But still i have a little trouble with those textures in blender. When i made this material like you have in the video and i connect (Combined XYZ) to Emission i get a radient gradient on my grass (from center lower edge of camera) blue to green, and i have no clue how to fix this, before that i have done UV exactly like you. Would be glad if could help me a bit (i tried to find answer in comments bellow but i didn't😓) But still really awesome tutorial! :D
And when i connect normals as well i have just white texture :/
@@nazarboiko3917 Hi! It's hard to tell unfortunately :| double check everything, material/uv maps/object used to generate object coordinates/scene settings (linear color mapping/no world light)/viewport settings (shading view) and so on... Make sure the issue isn't just in the viewport and persists in the render as well, that might tell you something.
Short question regarding the setup of the parent objects. I have seen different approaches to parenting multiple LOD-levels to a parent to group them together but I am unsure about which one is the best. The way I usually do it, is by creating a plane, deleting all its vertices, and using this object as the parent of my LODs. Works better then empties for me, but I am unsure about what takes more ressources to process in Unreal, or if it even makes a difference. Never heard anyone talk about their method and researching it gives no results
Hmm I'm really not sure what you're talking about sry. Parent objects? There's no parenting to be done here, I'm confused.
Okay mb. After looking through it again I noticed that you always merged all the components. I was referring to objects like Grass_Cards_A_LODs and I assumed that this was a parent object and it's children objects were all the different LODs from 0-2. And I was wondering how you could replicate the random baking with such a setup, but now after noticing that you merged them together into one object, it all makes sense now. While recreating the steps I tried to keep it all as non-destructive as possible and have not thought about merging them, I handled all the LODs as seperate objects and was stuck on the UV information baking part
@@xKeaton Yeah each card model contain both LOD0, 1 and 2 at first, so that the baked normalized height & pseudo random value in uv are consistent across all LODs. The cards are all merged into one single mesh during the bake process and after that I just manually separate LODs into three distinct meshes. If that makes sense.
Wow thanks, absolute useful!
Do you apply these material nodes to one object (joining them all together before) or do you copy paste them into each object?
Wenn I apply these material to every object I get different colorization for different objects, connecting the last "Combine XYZ" with emission prop. Some are red-yellowish and some are purpil and white. Do You have any idea what could cause that?
EDIT: Seems like my objects on the left and right of my orthographic camera are in this red-yellow style and the one in the middle are in this purpil-white style
Thank You !
They all are merged! Hmmm not sure what's your issue sorry. Double check your uvs
UVs seem to be fine.
What should acutally be the effect of the bounding box. In my setup it seems that there is no difference if I have it or not. Should I have the same colors in RGB mask like you if I have the same values in my nodes or does ist depend on the steepness and other factors of my geometry? Are your grass blades on the same z-level as your grass cards or is there an offset between them? If there is no offset I can't see them anymore (of course).
Thank you !!@@ghislaingirardot
@@phi7006 The bounding box is here to build the TextureCoordinate's node Object coordinates, and not have that be computed based on the object the material is applied to (especially in case all your cards are split into different objects). It's a way to build & control normalized object coordinates. Your result should be pretty identical to mine, it isn't based on steepness, just the Z vertex height relative to that bounding box. Don't render your grass cards while you're rendering these masks textures. Maybe double check your location/rotation/scale are all applied.
Great tutorial, thanks a lot!
I got one question: If I put my geometries into a bounding box with sheared surfaces, I do not get this nice bidirectional gradient effect. My whole geometry is quite uniformly bright. If I simplify my geometry to a rectangle and shear until it fits my bounding box and then take a look in shading mode, only the right part of my geometry is shown. Am I doing something fundamentally wrong? Do I have to turn off blenders light or does this not matter?
Thanks a lot !
Hey! Hmm it's to hard to say, maybe make sure to apply your object's location/rotation/scale? (and possibly the bounding box's transforms as well)
It seems that you are importing only your LODs into the UE project. How do You get the original grass object in? In my current understanding the LODs are just cards, which are some kind of abstraction of the original grass object. In the scene it looks like your original grass object is there.
Thank You!!@@ghislaingirardot
@@SchlippSchlipp Hmm the 'original object' is just here to render grass card textures. You're only supposed to import & use cards in engine.
Thanks for the clarification.@@ghislaingirardot
Hey, great Tutorial! I am stuck on one thing tho: The PerDistanceFadeAmount. I just have a simple GrassWind applied to the World Position and none of your stuff, but the fade is not working and I dont really know how to implement it
Hey! Ty! What do you use the PerInstanceFadeAmount for? Have you customized the fade distance in your instance component settings? (or foliage settings?)
@@ghislaingirardot Hey, I want to use the PerInstaceFadeAmount for the same thing as you, so scaling the obejct. And I have set the cull distances (start 2000, end 2500)
@@moinammorgen9415 Well then you have to replicate my setup. You can't 'magically' scale an object with just the [0:1] value this node outputs. You gotta offset vertices in such a way that result in a scaling effect, like demonstrated in this video
@@ghislaingirardot Alright. Thanks! Thought there might be a less complex way
Is there a way to blend grass without runtime virtual textures? Uefn has a lot of features but also blocks a lot and unfortunately rvt’s are one of them.
You could capture the terrain into textures using a scene capture component (if UEFN allows you to do that). I've made a video on the subject, see czcams.com/video/ZwufX4JuF1U/video.htmlsi=c9O37lg32GVICluA
Instructions unclear.
I have grass all over my house now.
Haha. My bad :p
@@ghislaingirardot It's not bad. It's PERFORMANT grass.
I have the same "problem," buddy.
Hi
Absolutely amazing tutorial
I wanted to ask if I enable Nanite in UE5.2 the grass disappears on the landscape. Disabled the WPO and it shows again so its somehow related. Any idea why?
Thanks
Hey! Thanks.
Tbh I haven't tested Nanite yet... But Nanite is widely known to be extremely limited regarding WPO and is now only starting to get support for *minimal* amount of WPO. Considering this technique here does all kind of crazy WPO shenanigan, I'm not surprised Nanite breaks everything unfortunately. I don't think it's viable with Nanite sorry
@@ghislaingirardot Thanks for your reply! No worries ill just look at implementing those optimization's that you show in the video.
Quick question, I'm currently using latest version of unreal engine and I'm contemplating whether to use lod or nanite grasses for my game, which one is better for the current state of ue? Performance wise, thanks!
Impossible to tell, foliage is still where Nanite suffers a lot. Performance will depend highly on your meshes/workflow/ability to accomodate for Nanite's weaknesses.
@@ghislaingirardot thank you for the quick answer! Love ur stuff
@@korakot2003 Np. Thanks, appreciated!
Hi, Ghislain. What is the PPT name, at 5:15? Thank you very much.
Hi! Not sure what's your question? I selected the three HI poly meshes and pressed H to hide them and reveal the low poly card underneath
In the view tilt offset section why is there a Y unit vector transformed in view space? Isn't the Z axis the one pointing up in Unreal?
The Y axis in view space is pointing upward when camera is looking at the horizon, Z axis is forward in camera space.
@@ghislaingirardot Thanks so much for clearing this up. I am new to Unreal and you've probably saved me a lot of time figuring this out on my own. Is this mentioned somewhere in the official docs? Why would the coordinate system be different between view space and world space?
@@mateigiurgiu2586 No worries. I'm not sure it's mentionned in the doc but it's something one stumble upon quite early in its UE journey, generally. The coordinate system isn't different from view to world space. It just has to do with what is the "default" camera orientation in UE. Z is forward in camera space because the 'default' camera's orientation is a camera looking upward (so Z up, same as world, and same applies for X & Y). If that makes sense :D
what is software at 17:54 this is the first time I see such cool software?
i think he is using GIMP
Yup just the good old Gimp 😊
Would you mind elaborating what extra magic you did with the baked pivot points? You mentioned the Y axis having to be flipped, but when you show your baked pivot points at 28:18 they don't seem flipped?
When I try this, the whole mesh moves its position slightly, but not all cards individually.
Hmmm, from what I recall I had to do a 1-(y*-1) in the script, which is actually y + 1 :p So the baked uv ends up in the correct orientation but shifted. Having to deal with different coordinates system can be confusing...
@@Gandarufu Hard to tell what's wrong. Double check your pivots are correctly baked and not overwritten by lightmaps and double check your material setup
@@ghislaingirardot thanks mate, I suspected a y-shift could be in order. will definitely give that a try tomorrow. thanks nevertheless for your great work, I'm still blown away by your knowledge and willingness to help 👍
@@ghislaingirardot Okay, so turns out you also have to multiply each pivot position by 100 because of the unit difference of Blender and UE. Never would have guessed that.
Hey all! I appear to be having a pretty serious issue. Everything was fine up until appling the WPO to the material. Once I apply the the code to my material, all my landscape grass dissapears! However I can still place a single mesh down which works fine. Painting the grass with a foliage brush also doesnt work. Please help :( I am unsure what I have done wrong.
There has been a development. All my grass has not vanished, it has all just moved to the 0,0,0 position... any ideas ??
@@Elmoman11able Hey! It's impossible for me to tell :shrug: You likely missed a step. Having meshes at 0,0,0 probably means you didn't transform vertices from local to world space. It's explained in the video :)
@@ghislaingirardot hello! Thanks for the reply, I really appreciate it, not to worry I used a work around, doesnt quite look as good or is as technically impressive but it works! Keep up the awesome stuff you do its great
Who has faced the fact that he does not have grass, tell me, how did you solve this?
11:26
kino tutorial
this is a lot of useful information but I am having a hard time understanding what you are saying because your voice is a lot of lower and mid tones and it is kind of hard to pick out words. It might be helpful to adjust the audio in after effects or similar software, increasing the mid tones to high tones to get better word separation. or it could be the microphone. either way, if you could somehow make the narration more clear, it would help a lot. thank you for this video!
I would if I could. Between having the worst room accoustic ever & a speach impediment & being a non native english speaker, it's as good as its gonna get. I recently upgraded mic so I believe it got slightly better in more recent videos but not ideal still. But honestly, considering youtube's automated subtitles seem to understand every single word I say, I'd say you're just probably not used to hearing a french accent :D
You should get your hearing checked or replace your speakers / headphones. Audio is perfectly fine in this video.
Hi Ghislain, thank you so much for your videos holy fuck they have tons and tons in them, you should really get your self into houdini xd, I would definitely support you on patreon if am not struggling financially, it took me 4 days to apply this and am not done yet xd, I wish I can support you back somehow if I can help with houdini substance designer linux please let me know you are amazing artist and a gift for our community
Glad you liked the video! Houdini, eh I'd love to but I have barely enough time to remain up to date with UE considering how fast it's growing/changing. Plus UE's becoming a bit of an Houdini every day with things like PCG, Geometry Scripting and Scriptable Tools, so I'd rather invest even more time in UE. Blender is becoming a bit of an Houdini as well with its increasingly compentent geometry nodes, so I'm less inclined to invest time in Houdini nowadays. Although it remains a beast of a software and I definitely could make use of it :D Just have other priorities! I'm also familiar with Subs. Designer and have used Gentoo/Linux for ~7 years! So no worries, enjoy the free content :D
lastly best of luck again and thank you so much for your content :D
Great job there! Grass is a totally different beast to tackle :D
I also did a video on more or less the same topic ( czcams.com/video/gfQNjC69PCM/video.html ) and yes, funnily enouh is the longest I've ever done :D
Ty! I loved your mathematical approach to the problem, great breakdown as well. I'll have to take a look at the rest of your videos, interesting topics you got there! :)
Why stylized, not photorealistic?
wtf is that quality stuff
I still don't understand how you created a random color for all the grass
Color texture projected in a top down fashion using XY world coordinates to add random tint + using 'random value per instance' to further randomize things if you need to
Thank you so much for this. There are some seriously impressive techniques here. I feel so dumb trying to grasp some of these concepts but slowly making progress 🙃
Thanks, you're welcome! And thanks for joining the Patreon :) No worries, I probably made this all sound more straightforward than it actually is. Struggle is to be expected at first with that amount of WPO trickery, it's not easy. Keep at it and you'll get there :)
@@ghislaingirardot really appreciate the encouragement 😊 - i’m new to UE so it’s a big curve but it’s people like you that even make this possible.
I’m trying to repurpose your setup into my scene. If I’d like to replace the opacity map with a more abstract painted texture is it just essentially switching out the texture? Guess I should avoid going over the edge of your current one to prevent issues with the other baked maps?
@@smash.studio UE is amongst the most complex game engine out there and it has quite a steep learning curve indeed. Best of luck! Hmm I'd suggest replacing the entire grass texture set (opacity, normals & gradient masks) rather than just the opacity texture (which won't allow you to create a completely new look considering the other maps are meant to work with that opacity mask). You could use the workflow I described, using Blender, to create a new set, or you could handpaint everything. Handpainting gradients & normals is a bit tricky but plenty doable (you could also discard using a normal map and gradients if you don't have a use for them)
This is a totally stupid question, but how do I add the assets once the plugin is installed? 🤦
OK found the video you made for it! Thanks!