Assigning normal directions for foliage/trees

   3860   4   0
User Avatar
Member
46 posts
Joined: March 2016
Offline
I'm trying to set up the normal directions for the leaf cards on a bush, and having some difficulty.
Normally in other 3D software, you would place a sphere around the bush and copy the normal directions from that sphere onto the bush, then delete it.
With this in mind, I assumed all I needed to do was make all the normals face directly away from the center of mass, but this is apparently not the case.
Using a point wrangle node, I input this;

@N = normalize(@P-cm);
Where cm = the vector coordinate for the center of mass, in this case 0,0,0.
This is the result I'm getting, though.

As you can see, the normals are facing exactly as I had intended, but the result looks terrible. Simply moving the center of mass in the calculation doesn't help either.
I've also tried a slightly more complicated process of replicating the method used in other software, in which you copy the normals from an enveloping sphere;
int pt = nearpoint(1, @P);
@N = point(1, 'N', pt);
The effect was nearly identical.

What would be the correct way to set up the normals in Houdini?
Edited by Grimwolf - April 1, 2018 21:14:42
User Avatar
Member
46 posts
Joined: March 2016
Offline
Well, it seems it actually is working correctly, it just isn't rendered well in Houdini. I had to fully texture it and bring it into UE4 to find out.
I guess this could just be considered more of a guide, then. With that in mind, here's an even better approach;
vector cm = getbbox_center(0);
@N = normalize(@P-cm);
That will automatically find the center of mass, and then direct all the normals away from it.
Edited by Grimwolf - April 1, 2018 22:33:40
User Avatar
Member
8037 posts
Joined: Sept. 2011
Offline
Looks like it is shading as expected to me, given the spherical normal. Houdini does not normally shade the diffuse component on backfaces, which is why you see the black in places. If you enable “hide backfaces” in the display properties optimization tab, and disable specular, it may more closely approximate how it will appear in game engines.

I don't know much about developing content for game engines, but is there a reason for adding the outward facing normals to the card geometry? I would think you would want the cards themselves oriented outwards rather than their normals, which would make them shade funny. Does unreal use the normal for something other than shading?
User Avatar
Member
46 posts
Joined: March 2016
Offline
When using cards, it prevents them from awkwardly shadowing each other or exposing their flat nature, and creates a nice, smooth appearance.


(Images not made by me)

The modified appearance on the right actually is what I'm getting in UE4, it just isn't visible inside Houdini.

It's not an issue of the backfaces, because I tried to mirror the cards so there would be a face on each side, and it looked the same.
Houdini might not be rendering normals accurately.
Edited by Grimwolf - April 2, 2018 11:18:16
User Avatar
Member
4 posts
Joined: Feb. 2016
Offline
mark
Edited by iJasonLee - Dec. 29, 2023 03:00:18
  • Quick Links