I'm working on some foliage (maya 2014), mainly bushes and trees, and I've tried several methods but the way the light just seems random.
What I'm looking for is the results showed in the polywiki:
Although I'm closer to the example to the left.
I've tried setting up each branch with individual vertex normal, that follow a couple of tutorials, one shown here:
So this is how one of my branches looks like, and the results when clumped together to form a tepmorary bush:
Doesn't seem so smooth.
Here it is in UDK, which I intend to use the foliage in:
I also tried using a sphere to transfer it's attributes as some other people have mentioned:
But, yeah, it looks even worse (ignore the sphere).
What am I doing wrong? How do I get the same result shown in the first example?
Thanks
Replies
I dont really remember very well but I think in the past I had it not working so well because the scale of the sphere I used as a base was too small.
Also, when importing, make sure you choose to read the normals from the FBX. Otherwise UDK will just automatically generate them.
This is my setup:
I realised a brighter specular would better define where the light hits, but it won't solve my initial problem. Is it the way my branches are set up (seen in my first post, 3rd picture)?
Getting problems but tbh I didn't even know it's supposed to use a sphere ref hah .. that tutorial is really sketchy I'll give it another go, thanks for the thread
Edit: thanks again, I got it working thanks to your sphere image !
I didn't even fit the sphere to the shape of the tree, so I don't think that's the issue ..
So your normals look fine to me, I guess the problem is somewhere in the UDK import as others pointed out, sometimes the engine split normals on import (e.g. uv borders, etc), or maybe the tangents get screwed up, sorry my knowledge with UDK is really limited ..
How are you making the backfaces? I had to explicitly duplicate and flip the faces (in Max), then edit the normals, then make sure to prevent the game from creating any backfaces, and use a single-sided shader too.
Also it could be the shape of your leaf planes to blame. Is it simply 3 quads intersecting? It almost looks like a tetrahedron, but it's hard to tell.
The branches are not tetrahedrons, not sure what to call them
I'll try making the backfaces in maya, see if that will fix it.
Was actually about to message you, seeing as you made the tutorial! Thanks.
Your mesh may cause problems because you have a vertex directly in the middle there, which will make it very difficult to get good shading... i.e. which direction would those middle normals go? You could get a similar look if you made it into 3 quads. I'll make a pic.
So I basically did what Eric told me. Extrude each face on the branch, then merge the vertices together again (creating 2 faces).
I then stretched a half sphere to cover up the entire tree
Selecting the sphere then tree, I went Mesh>Transfer Attributes and made sure only Vertex Normals were being transferred. The trees vertex normals then looked like this:
I then turned off Two-sided on the branches material. And this left me with this pleasurable result:
Compare it to what I started with and it's 10x times better.
Now I just need proper textures.
Thanks a lot, everyone!
Can we get that info in the WIKI? I remember about a year ago, I went through this process. I eventually figured out what you said, but it wasn't easy.
monster, yes!
I'm writing an automatic bent normals generator for my modo exporter
I'm confused, so you're not putting the sphere in the middle of the tree, but rather half a sphere from origin ? I'll try both methods and check results
With the sphere/half-sphere thing, I imagine it would only make a significant difference if the trees were viewed from a low angle (In which case you'd want to have used the full sphere)? Just a guess from this thread, haven't played around with this stuff myself yet.
Should look good with baked vertexcolor gradient
Ofcourse! Would be an honor!
callebo... done. http://wiki.polycount.com/VertexNormal#Editing_Normals_in_Maya
Chai... that's awesome! OK to add this to the wiki as well?
Sure thing, and btw thanks for the original article mate !
http://wiki.polycount.com/VertexNormal#Editing_Normals_in_Modo
pipelineIO looks great.
Cool, cheers mate
For any modo users reading this, just released new version of pipelineIO with the bent normals support
Also, the wiki has moved since this thread was written. The relevant pages are now here:
http://wiki.polycount.com/wiki/VertexNormal
http://wiki.polycount.com/wiki/Foliage
How to proceed for first person camera ? Move the botton verxtices normals so it will point to the ground ? but then, looking from a distance, the botton of the tree will look dark. Right ?
Also depends a lot on your lighting setup. If the game uses a single top-down directional, you'll want some sort of ambient light to prevent black backsides. It's best to get a directional ambient if available, so it's not just flat ambient brightness, which looks.... flat.
Here's an inexpensive method we used for a MMO. In the shader we reused the incoming directional light, just flipping the direction, and adding a color control.
So the main light is colored a very light orange, the backlight is colored dark tan, and the ambient is dark blue.
Ambient comes from everywhere, so it tints everything the same. It simulates light coming from all over the sky, hence the blue color. But flat ambient is very horrible looking on its own, because there is no directionality, so it should be used sparingly if at all.
A better way, but a bit more expensive, is to use Spherical Harmonic lighting. Unity uses this with the light probe system (I think it's SH, they don't say exactly).
http://docs.unity3d.com/Manual/LightProbes.html
Light probes (for your dynamic models) and pre-computed GI (for your static ones) work pretty well, check out Unity 5's GI system. Real nice, and supports dynamic lighting changes... sunrise to sunset, etc.
http://blogs.unity3d.com/2014/09/18/global-illumination-in-unity-5/