Hello!
I've started fiddling with 3D and videogames production a few months ago, and now I'm involved in a small indie project.
We're just five people, so we have to be flexible and ready to learn every kind of new skills, one of which is making open world environments.
My tasks were to learn how to make a terrain in World Machine, then how to correctly import the heightmap in UE4, then how to make terrain materials in Substance Designer, and now how to make proper foliage (and more to come!).
I've started with grass because it's one of the assets that is going to recur the most in our open world environments.
Four days of tutorials, tests and troubleshooting led me to this....
Not too bad, for a total newbie, if I can say it myself.
Now, though, I'm not really satisfied with the quality. Not in terms of realistic look, more about.....I dont know, as it is now it's just a waving sea of fairly big strands of (allegedly) grass.
I'm not looking for something realistic, as this is going to be a fantasy game with a touch of cartoonish, but I'm pretty sure I could do something better.
Also, this is a quite tall grass type, 40-50cm tall, I'd like to also make something more suitable for a scruffy lawn.
What I'd like to learn is:
.- what's the best way to arrange "cards" when making grass clusters?
-. how big should a grass cluster (group of cards that compose the object) be depending on its use?
.- how should I arrange the cards to get the best look for a tall type and for a short type of grass?
-. what types of grass are more suitable for tall and short clusters?
.- when looking at a reference, what traits should I focus on to be sure my grass will look anything even slightly close to realistic/plausible?
-. what bad pratices should I avoid? any best practice I should learn?
.- what about efficiency and performance? any fairly feasible method to bring overdrawing down to the minimum?
The grass in the screenshots has been made by modeling a 3D strand, copying and bending/twisting it in 6-7 different versions, then "clone-painting" them onto a surface.
Then I exported the subdivided/smoothed bundle of grass along with five pairs of simple planes (low-poly and cage) to capture normals, color, thickness, height, AO and alpha from 4+1 directions.
Then I've composed the five projections onto a single tile (one tile for each type of map) and subsequently UV'd cards over it.
The result is a 45 vertices mesh composed of 5 cards, 4 arranged in an asterisk + 1 folded into a cone pointing downward halfway the bundle's height.
I've tried other configurations, but this is the one where cards' bounds seem less noticeable (as of yet).
Any advice is very welcome, I'm in learning mode full-time.
Thank you! ^o^
Replies
I use UE4, in tweaking the materials I get something like this:
The other part is the lighting in your screen. I would suggest getting that where you like it then tweak the materials to where it looks good.
- enough that it doesn't disappear in the distance easily, as a bonus stick to a multiple of 64 vertexes (GPUs like that but it's not really necessary at all)
- See first answer
- Eh? I'm sure someone out there thinks about that, but it's just whatever you find looks good.
- Grass sucks in games today, maybe like, for next gen exclusive games (PS5?) it won't, but right now it does. Just concentrate on the texture color/variation and make sure it's not too thin so it doesn't disappear easily.
- Throw all the cards at varying angles (you don't want it to disappear when looking straight down), and try to use alpha cutout over alpha whenever possible. Translucency might look nicer, but doesn't work with fancy TAA stuff and makes GPUs sad : (
- See above, and definitely do at least one if not two LODs.
All that being said, it looks great! It could use some color variation tricks and etc. But there's a thousand other "tricks" like bending normals, or etc. that are of varying value, but really you're off to a great start.
Don't just fill the landscape with the grass. leave some bare place and then keep the growth gradual. like small near to bare place and bigger as it will go further. It will look a lot better. Give the scale and color variation. Right now all the grass is uniform. You can put speedtree color variation node in the shader graph in the front of basecolor then plugging it to output. It works very well. Try these things and we'll see what you come up with.
Hope these will help. Keep up with the cool work.
-Bajwa
.- used a Constant3 to multiply the base texture to get a more "plausible" base color
-. tilted cards to hide the terrain better
Speedtree color variation node is VERY sensitive, I have to move by 0,01 steps and at 0,03 it's already very noticeable.
Better?
Anything that I might improve in applying your suggestions?
Also, you said "try to use alpha cutout over alpha whenever possible"; what do you mean with "alpha cutout"?
Right now I'm using an alpha map, as the opacity mask, that is a separate file from the texture (actually, all maps are separate files, didnt spend time on filling them into a single image's RGB channels, will do that later).
And...so I should just unplug the translucency color input altogether?
Btw, I made my maps with xNormal (it's awesome for this kind of works!!) and also extracted the thickness map.
I had planned to use it as an opacity input, so I mixed it with a scalar parameter through a multiply node and plugged it into opacity. But no matter what the scalar value is, 0.1 or 10, I see no difference whatsoever.
I even tried to plug in a full white Constant3Vector, but the result is just the same. =0
Thank you! ^o^
I mean, I've read some tutorials about your same method, separate cards for separate strands to minimize overdraw, but my grass has literally hundreds of strands in the bundle, it's very dense, do you think it would be possible to achieve the same dense look with separate cards rather than with normals projections? =o
For the short type it's probably the best practice, although....what about LODs, how do you put those strands together into one card to still look like the exact same grass, but with less polygons? =0
My head hurts.... -.-'
@Apocrs1980 @FreneticPonies @7bajwa
I have crafted LODs for grass, pushed high the triangles number for LOD_0 (~850 tris) to maximize the cutout, tweaked and reused old LOD_0 as LOD_1 (48 tris), and made a very cheap LOD_2 (6 tris).
Fade-off for grass is 100 meters so there's plenty of sight range, althought I could push it higher, now that LOD_2 is only 6 tris (and with no alpha holes).
In the second screenshots the PS value is in the green area, but it actually fluctuates for and back between green and white. It seems like there's no way to avoid it.
Question: does UE keep calculating alpha mask even if you resize UVs to leave no alpha holes visible on the mesh?
I mean, should I make a copy of the material and, like, disable the alpha mask node completely (or even change the type altogether)?
I tried to find tutorials to learn how to make distant LOD billboards rotate along with the camera so that they always face it, but all the ones I found started with "it's very complicated, when it comes to foliage", which discouraged me right away.
But I believe it will become unavoidable, when it will be trees's turn, for two crossed billboards wouldnt look good, in my opinion.
Any valuable source on the matter that could guide me step by step through the process?
Also, would I have to make a separate shader for the billboards, in order to activate the camera tracking function, or I could just make the effect affect only the most distant meshes?
I feel like there are more questions I should ask, but it's almost 4am and I've been working for the last 5-6 hours straight, plus a few hours this afternoon.....I'm quite exhausted. -.-'
Tweak the color of the grass to more real-world grass. Use the images of the grass if you can.
Color variation is fine but the frequency is small. check this image . see how the color is changing on the grass in the big clusters and it also consisting dry grass. add few dry blades of grass in between the cluster also.
for the scale, I was suggesting the same. size variation in the form of the clusters. Check this image how it is forming the grass clusters.
Check this Video. you will get more idea for the foliage population.
Hope that this will help.
-Bajwa
@Olingova <Total newbie>, remember? ^^'
How do I reference a simplified version of the shader?
I had thought of giving the farthest LOD a very basic color+roughness shader with no masking/wind/normals, but in case I need to modify the original materials (for multiple assets), maintaining the basic ones along would be a pain. =p
The white parts you see are from LOD0, so no LOD material will save it.
If you have any suggestion on how to furtherly reduce it (beside adding a number of vertices to better cut it out), you're very welcome. =o
Anyway, if that's a lot of white, to you, you should've seen it before the high-poly cards, that was a freaking "snowy" field of grass!! xD
What about the true/false switches to disable inputs, how would that work? Any tutorial/reference I could learn from?
@7bajwa I had set the color variation to something much higher, many clusters would look dry (while others oddly white!) and it was nice and kind of realistic, but the team asked me to bring back the blinding green (since this is going to be a fantasy/cartoonish game), so there it goes.
By the way, do you happen to know whether there's a way to clamp the color variation so that it doesnt go too high with lightness? =o
I'll watch the video for sure, but the reason for the current lack of variety in foliage is just that those two (grass and poppies) are all the assets I have at the moment. ^^'
More to come, of course, like dandelions and other plants I already have in mind.
@7bajwa I dont like highly automated things, the moment they stop to develop some tools you find yourself without the knowledge to replicate the same results without such tools. =p
Seriously, I've seen Fortnite, my stuff looks way less like a Playmobil toy. =0
Now that I think of it, I have a couple of questions about the foliage shader:
.- I've tried to use the thickness map plugged into the opacity output (not opacity mask, just opacity) to affect the amount of subsurface color depending on the thickness of the grass bundle; but no matter what value I plug into that output, nothing changes whatsoever. Why? Did I misunderstand the function of the opacity output?
@7bajwa Dynamic foliage?! =o
Dynamic Foliage in Uncharted
@7bajwa Now that you mention it, I've asked where I can learn how to implement that kind of interactivity, more specifically grass that moves apart when the player goes through it, but nobody answered.
Do you happen to know how, could you direct me toward some good tutorial? =o
Pixel depth offset is for tessellation or for pushing the pixels out, for grass it's not needed as it can be very taxing on performance.
I'm still learning techniques and all I can say is keep learning and messing with nodes.
You'll get there!
A simple solution: change the shader of the LOD you already have. If this shader is lighter (for exemple totally remove the transparent pass or the wind one if you got it) it will be easier.
To change a LOD material; check that it's pretty easy: https://answers.unrealengine.com/questions/578259/cant-change-lod1-material-grayed-out.html ( i know it's a "problem topic" but there's the solution below). So it's not even about having mipmaps; it's about applying different (and way lighter) shader on the LOD
Ok, it seems I misunderstood you, here, when you first told me that I should use a simplified shader.
I thought you meant that I should reference part of the LOD0 shader into a simplified one, so that I could modify the main one and see the same modficiations in LOD1 and 2.
I mean, if I change the tint of the main shader, I'd like to see the same changes happen in the simplified ones, so that I dont have to maintain them separately. Would that be possible? But most important, HOW?
Anyway, I dont see (relevant) white spots on LOD1 and LOD2 (see screenshots in 29 August reply), they're all from LOD0.
@Apocrs1980
So, basically, rather than plugging the thickness map into the opacity output and the subsurface color into subsurface, I should just LERP the two colors into the base color output using the thickness map as a mask?
Gonna try right away! ^o^
And I'll get rid of the height map. =0
This is the shader remade to ignore opacity, subsurface colour, AO and pixel depth while applying a range limit to normal and wind:
I re-interpreted the solution mentioned in Olingova's link to make a distance calculator that would work as a mask to decide whether to apply alpha, normals (replaced by a constant) and wind.
It seems to work well, but I have no idea whether this is what Olingova had in mind.
This is with a [25 meters] range:
This is with a [10 meters] range:
As you can see, the white spots are a bit less, with the 10 meters limit.
What you cant see is the wind not affecting the grass beyond 10 meters anymore.
What other improvement could I apply to the shader? =o
Why? =o