How do I get a material to face the camera?

Hi there. I wanted to ask if there’s any way to make a material to always face the camera. I’m trying to import a 3d model of a tree, and from a frontal point of view, everything looks fine, but when moving the camera, the leaves looks flat, as they consist of textures with an alpha channel mapped onto planes. You can see it in these pictures.

I’m trying to achieve the same effect as with “Billboards” ([Unreal Engine 4 Billboards - YouTube][3]) but as a material instead of an actor blueprint, as I need it to react to material properties (roughness, normals, …etc.) and I need it to be mapped onto the tree.

Does anyone know how to do it?

Advanced thanks!

This should be helpful:

Check the section titled : “Foliage Material

Thanks for the info, it’s exactly what I was looking for, but I’ve got a little problem when trying to apply it: how can I set up the Custom Expression node? Firstly I want to point out that I don’t have any programming knowledges. I’ve copied that node structure and connected it directly to WorldPosition Offset, but I don’t know how to set the HLSL code given in that link into the custom node. If I copy that code into the “Code” text input, it gives me the following error.

Solved,but even now, it’s not perfect. xD When I rotate the object, it faces the camera but every face keeps their original orientation. That looks really weird applied to the leaves of the tree. Is there any way to make every face of the object to face to the camera, not only the object as itself?

Really appreciated thanks!

Can you show me the output? ie the image of the tree from two different angles?

I have this same problem, that node setup adds any rotation the object had in the scene to start with to the billboard rotation for some reason, not sure why. This is a problem for me since I’m using it for lods and want to be able to randomly rotate my foliage around the z axes to keep it looking un uniform when looking at more detailed lods but obviously I would still want the billboard lod to face the camera when I get to it!