Issues making a forest (lots of issues!)

So, I’m pretty new to unity which means don’t hold back on the obvious advice, because I might be missing it.

For my first project I’m just trying to make a clone of something like Slender (who doesn’t start there?!)

So I’m running into some issues:

-The SpeedTree sample trees have been my go-to so far. I’ve been placing them using the terrain paint tool, and they look great but they cause some performance issues. My computer isn’t super high end - i5 3.2ghz 8gb ram GeForce 750 TI. Is this just to be expected on this rig with a forest environment?

Most of the performance comes from what seems to be when the LOD levels of the trees change, it causes a graphical hitch and drops FPS from about 30 to 12 momentarily. For reference I’m working with about a 750x750 environment with no other models other than trees.

-Second Issue is with other tree models. I’m using very low environmental lighting with some spotlights for a flashlight on the player model. When any small part of the light hits any small part of the tree leaves the entire canopy lights up to full lighting. (This doesn’t happen with the SpeedTree trees). Any idea what might be causing this or how to fix it?

-Unity Tree Creator: I haven’t used much of it yet, how is it for performance? Lighting? Is any 3d modeling experience needed for making a tree? I’m more of a coder / designer.

Thanks for your help and any guidance you might be able to offer.

On the first issue, this depends. It depends on how high poly the trees are, your quality settings and how many you’re placing.

Speed trees on Terrains usually don’t cause problems at all. Maybe try going into Edit > Project Settings > Quality and changing it from Fantastic, assuming it is. But usually it’s not even an issue on Fantastic if all there is simply speed trees and terrain. The grass of the other side… Loads of that can definitely slow your computer. And, it’s true your computer, by looking at the information, isn’t super high end. But it’s definitely way more than enough to get a bunch of speed trees in there.
Also, inside of the speed tree view there is an option that is checked by default which says “Enable Tree Colliders” with loads of colliders, if all are colliding with the Terrain, it’ll decrease performance even on better computers. Especially if they’re all programmed to do things upon collision. But it shouldn’t hurt Edit Mode while Play Mode is off at all. But just make sure your trees isn’t colliding with eachother or the Terrain. By changing layers. But I’m pretty cure they don’t collide with the terrain. Maybe with themselves, though. Again, no. It shouldn’t decrease performance. (Of course unless your Terrain is at the size of 2000 and your trees are very small causing like 500 different trees with colliders to fit on there a bit spaced out… Then maybe.)

I’d say get lower poly trees. Or just don’t use Mesh colliders on the trees. Box our Capsule Colliders do the job with trees just fine.

On the second issue: Yes. This is very common for trees or plant textures. This is due to their material settings. (Transparent > Cutout > Soft Edge Unlit, etc.) You can go into their settings and play around with it to change that to actually go about with the lighting/shadow. For regular materials, it’s usually Standard by default. But standard isn’t usually what you’d want to use for trees if the trees’ leaves aren’t made up of actual polygons. You’d want to go to Legacy Shaders > Transparent and play with those settings so they will be lit, have specular, etc.

Speed Tree is usually a good way to go for backgrounds or far distance, unreachable areas in your game without colliders. (For example in Slender, trees on the other side of the gate) This is because of their performance. They are usually very good for performance if you use the correct polygon count, etc. Which shouldn’t be a lot at all. But for trees that are closer, you might want to actually use more detailed trees. And hand-placed on your scene. Of course speed trees can still do the job. Along with Speed Grass but it’s all on your liking.

Tree Creator you really only need to know basic modeling practice. Since you aren’t actually creating the trees yourself, instead you have a preset polygon and it’s shaped, in Unity’s Tree Creator, to look as if it’s a tree. And, yeah, it’s doable even for people that aren’t very good with 3D modeling skills. But few basic knowledge is still recommended when using speed tree.

Hope this little guide helped.

EDIT: Yeah. The material on the trees reacting to your scene lighting (Not really your character flashlight much, just depending on how many trees the flashlight is hitting) can slow the game if it’s heavy shadows everywhere with hundreds of trees that has reacting material. If you absolutely need shadows, or darkened area such as in Slender - It’s recommended you go into Windows > Lighting and changing the Ambient Intensity to 0. This’ll create completely dark areas where no light is available.

Thanks for the awesome write up. I didn’t see your response right away and made a video of the lighting issue, but it sounds like you know exactly what I’m talking about.

The funny thing is, the speed trees work 100% fine with the spotlight. It’s any other tree I buy or find that doesn’t. Going to leave the video here just because I made it so why not?

Ah. thanks! :smile:

Oooh. Ok, so notice how ONLY THE CANOPY leaves get lighten up in an odd way and not the trunk of the tree. This is because of the material settings. Obviously the trunk can’t have any transparent cutouts like the leaves have. Due to this, it’s giving it a weird lighting. XD So yeah. Playing around there fixes that problem. But you said you didn’t see it in time, so understandable. But still pointing it out again.

Any other question or help with your game just message me! :smile: (I’m a bit excited for this. Since I loved the idea of Slender. Even though the first Slender that was made in an older version of Unity wasn’t so good. But hey, the idea was fun.) And keep me updated on your game!

Okay I’m still struggling. I’ve tried all of the different shaders on the leaf material, but nothing seems to be changing. Any chance of you putting up a step by step? I feel like I might be doing this wrong.

For what it’s worth, when I change the shader, the objects I’ve placed in game don’t seem to look any different although the texture / mesh in the project explorer do change. Am I editing the wrong things? I’ve tried the branch mesh and the leaf material.

Then I dropped in a speed tree (on which the lighting works just fine) and changed all of its shaders around, and I couldn’t manage to “break” it.

Hm. Ok. Do you mind allowing me to look at your project in my Unity?

No problem at all, do I just zip the entire folder and upload it?

One note: My “project” currently is pretty much just what’s in that video. I wanted to get everything working before I really dove in.

Yeah, just Zip it up and upload it. Now usually I’d just solve your problem but I’ve had similar issues in the past with such materials and sometimes trial and error is needed due to Unity being… A tad unstable. So sometimes things just don’t work as they should. O-o
Anyways, yeah. Just Zip it. I’ll look into it and just reupload it with fixed problems.

Going to upload it over night, I’ll post the link here. Really appreciate your help!

https://www.dropbox.com/s/iew9bvnzw0c7i2n/New%20Unity%20Project.rar?dl=0

There we go!

Ok, cool. I’ll get back to you around tomorrow. ^^

IMAGE 1

IMAGE 2

2534023--175922--Screen Shot 2016-03-01 at 8.16.52 AM.png

IMAGE 3

IMAGE 4

Ok. I looked over your project.

Firstly, notice how your speed trees’ materials aren’t editable in their current form. (Speed Trees > Mesh > Mesh Textures 1 and 2) This is because Speed trees use a packed texture. It combines the textures you applied to the speed tree and puts the two (or more textures) into one. To change this, I’m not sure. XD sorry. Never actually used speed trees. (I make my trees in an external application and out of; use the Terrain tree placer, or place them manually where I want them to be) However. I can gather you are to retexture the trees. BUT THIS TIME change the textures applied to the trees before you pack them up! So it’ll pack up the leaves in it’s edited state. (You know. Where you placed the leaf textures?)

Ok, simple version of up there:

retexture the trees. But edit the leaf textures to be what you want (Specular, VertexLit, etc) and when it has a good material Shader you then put it to your speed tree and pack it up and then it’ll combine the Leaves and the bark together to make the material on the image.

IMAGE 1 is the optimized version of the two textures (Or the packed)
IMAGE 2 are the two textures that are separate in the Optimized. But unpacked obviously.
IMAGE 3 is the Optimized material showing how it cannot be edited as you’d be editing BOTH. And that’s apparently unsupported by Unity.
IMAGE 4 is the leaf texture inside of the Optimized alone. But this is one editable.

See how it works? Ok, so remember: If you edit the textures separately, it won’t effect the Optimized material, since it’s a separate material. So, yes. Just repack the two materials, but this time edit the leaf material first before packing it.
So yes, if you notice, the trees you have that have children in the scene, the non-speed trees, have editable materials. And they don’t cause the problem as the speed trees do. But you can see why.

EDIT: SpeedTrees’ Shader is set to Nature/Speedtree. That’s interesting. Anyways. Try doing stated above ^ And come back.

OMG!
POST SCRIPTING!!!
I forgot to mention! the reson your game it going slow is because your trees have Rigidbodies.
Take them off. -.- Non-mobile GameObjects should NEVER have Rigidbodies. Instead, put Rigidbodies on your player. you only need 1 rigidbody for collisions to happen. Rigidbodies slloooowwww the game. Especially is your tree are colliding with Terrain… ALL of them. Etc.

Great info. Another question though: I don’t actually have speed tree - the trees in that game are a trial pack that was released for free.

Is using speed tree to retexture / repack the trees my only option of fixing them?

Also I didn’t actually make any of these trees. They were all downloaded from the asset store for either free or $2.00 for a pack or so.

As far as packing textures and such - I’m not familiar with the process unfortunately. I’m starting to think I don’t have the background to effectively use this engine that I might need to start somewhere else…

My hope was to just acquire the assets I needed cheaply or for free and then get to coding the guts of the game after making the environment.

Hmm… Well if you needed trees… I’ve literally folders upon folders of them. XD Long ago I used to get trees (not buy them. But from random free websites) or even get those and edit them out. So I could send you some if you want. didn’t need to buy them. (Even though spend that money wisely for the people that got your money. ^.^)

Now making trees are very easy. Well, I’m sorry, IMPORTING trees are texturing them are very easy. Especially if you have trees that have separate leaf and trunk meshes. (Just give a material to both)
Then, since it’s an asset with a mesh, you can go to Terrain and go to the tree icon and just “Paint” those created prefabs onto the scene. (Or the terrain, same thing.)

Well, I’ve used that technique ^ and it works fine. Especially with super-low poly trees. (Which they shouldn’t be highpoly anyway) You can get good normal-supported tree barks to make them look really good. So trees really shouldn’t be a big problem. It’s really just dragging a material on a tree and changing it’s Shader. Then do the same with the leaves meshes of the tree.

Infact, I can make a little test scene for you with colored terrain and a bunch of trees, etc. Then you can change that up as much as you want if you’d like. Since that should literaly only take no more than 10 minutes. (You see, I keep my assets from previous projects obviously. XD And I still have loads of textures and trees.)

ALSO: UNITY it’s self provides a free load of trees and props for Terrain use (Trees, bushes, grass, textures, etc.) but it’s a little outdated. And since it’s just prefabs it’s not harmful where you need to import and cleanly upgrade scripts and stuff. Simple stuff. But what I truly mean about it being outdated (Like 2012?) is the fact that it’s no longer on the Asset store for whatever reason. But I still have it and can give it to you. ^.^ It’s a really nice pack if you want some assets for terrain use. So yey. ^^

If you could hook me up with some trees I would be ever grateful!

I never thought I’d get stuck on foliage as a huge obstacle in making a game - lol!

In the meantime, I’ll work on retexturing mine and see where I can get.

(Couldn’t upload it though Upload File like I did with images due to it’s size, so you gotta get it from Mediafire)
Der yer ger! :smile:

Ignore all of the source files if you find any. (.c4d, .maya, etc.) What you’re looking for, (Hopefully you’re savvy with file extensions and know what you’re doing ahead of time.) is .obj files or .fbx. I usually export my work via .fbx, but that’s old and most of it isn’t my work. So you’ll see loads of .obj. There you go! :smile: I have bushes if you need, etc. But that’ll be a little more digging. But I can see what I can do if you need.

What? Non mobile game obects should never have rigidbodies? :confused: Seems like quite the incorrect blanket statement…

Whoops. what I mean is objects that just sit there. Such as the environment or the ground. They should have colliders. While the players would have the Rigidbodies. Should have cleared that up.

You have been beyond helpful, thank you again. I’ll take a look tonight after work and see if I can’t get these trees to cooperate!