Double sided material cost

Hello there.
I’d like to know how double sided materials compare against real geometry. Being more specific, is it fine using a double sided material for a mesh that only needs it for a small part of it (something like a flag (needs two sided mat) with its pole (no need for two sided mat)) or would it cost less to thicken the flag resulting in doubling its polygons on that part of the mesh?
Thank you in advance.

Hey B14ckfir3,

The normal will be flipped on back faces, which means lighting will be calculated for both the front faces and the back faces. This is commonly used on foliage to keep from having to double up the number of polygons. Two Sided does not work correctly with static lighting, since the mesh still uses only a single UV set for light mapping. As a result, two sided materials with static lighting will be shaded the same on both sides.

Whatever material is applied to the mesh, will also be rendered on the back side of the faces. If used on material that uses the Translucent Blend Mode, it will create more overdraw and will be more expensive to render. In your case it all depends on the amount of polygons on your flag mesh. If it has a fairly high number of polygons, you will gain better performance from using the ‘Two Sided’ option rather than doubling your poly count.

Just in case you wanted to read up on some more material properties I have provided a link to that specific documentation page below. Let me know if you have any further questions.

Material Properties

Cheers,

I’m totally aware of everything you’ve mentioned above but my question is a little different.
Let’s go back to the flag example: The flag’s fabric is about 100 tris. That part of the flag needs double sided geometry to prevent the back face culling.
On the other side, the flag’s pole, has about 20 tris but it doesn’t need double sided mat.

Which one of the following options is the most efficient:

  • Double the fabric’s faces (total 220 tris)
  • Use two different materials for each part (double draw calls)
  • Use layered materials (no idea about the cost)
  • Use one material for both fabric and pole with “two sided material” option enabled (pole gets also the double sided material which is useless)

If the last options is the most efficient because of the low number of tris for pole, which option would be better for a mesh that has something like 10 tris which need double sided material and 1000 tris which do not?

Hey B14ckfir3,

Your most efficient bet, and how I would approach this situation, would be to apply a two-sided material to the flag mesh as its own material. That way, if you want to use the material again on another cloth asset, you can create a material instance and modify whatever parameters you establish within the material. This will eliminate the overhead of creating multiple materials using a similar approach, and so you don’t quickly start increasing undeeded poly/triangle count for the flag pole itself. Layered materials are comprised of various material functions which is generally used for more complex shader work.

Material Instances

For the flag pole you can apply however simple or complex a material as you would like. If you are looking to test performance and optimize you project I would take a look at the performance and profiling documentation. It can give you a bit more insight on how, when, and where to use and apply certain materials in certain situations. Profiling your project is very important if you have a target platform and need to make sure your levels are optimized to run efficiently at the settings desired.

Performance and Profiling

In your case, using two separate materials for your mesh would be the most efficient. Especially if you plan on using those materials more than once.

Regards,