Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL: Transparency vs Modeling

Discussion in 'WebGL' started by troy_halsey, Jul 5, 2015.

?

Which is better: Modeling cavities or using transparency maps?

  1. Modeling

    1 vote(s)
    33.3%
  2. Transparency Map

    2 vote(s)
    66.7%
  1. troy_halsey

    troy_halsey

    Joined:
    Oct 21, 2014
    Posts:
    63
    Hi Experts and Happy 4th of July!

    Has anyone done testing on which is less processor heavy for WebGL - a map with an alpha channel for transparency (in my case just pure black and white) vs modeling.

    I am building trussing for an architectural scene and a 10'x12"x12" truss stick modeled is a minimum of 1k tris...pretty heavy for how much I need to add to the scene. But a double side box (a box inside a box, with the inside box inverted) is only 24 tris. Pretty big savings....

    But I am curious, based on what I have read, if the saving on the lower tris will be wasted with using transparency maps.

    Thanks in advance for any advice,

    Troy
     
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687
    It depends on how many truss's you will have in your scene, but in general I would say go with modeling them with polygons. Triangles are cheap these days. Since you are using WebGL it is more likely that your performance bottleneck would be in the number of individual objects that are in your scene rather than the number of triangles. There is also download size to consider. You would think that having more tri's would increase the size of your application, but you also have to consider the size of your texture that you would use to make the alpha.
     
  3. troy_halsey

    troy_halsey

    Joined:
    Oct 21, 2014
    Posts:
    63
    Thanks for the quick reply @jRocket!

    Totally agree with your logic. But I'm curious if it will save on the overall triangles. I also have close to a 1,000 chairs in the scene (corporate event). So I'm already pushing 600k tris per frame. I've noticed about 500k is the max to stay close up to 60 fps on WebGL.

    My tiff with alpha channel is only 1024. So I don't think it will add too much more to my build size.

    But that's why I'm asking. To debate the theory...thanks for joining the discussion.

    Troy
     
  4. troy_halsey

    troy_halsey

    Joined:
    Oct 21, 2014
    Posts:
    63
    Here is the demo I'm working on for reference before I add the truss:

    HTTPS://www.hgroupdemos.com/AVDemo

    Considering redoing my chairs using alpha maps also, that would dramatically decrease my poly/tri count.

    Thanks again,

    Troy
     
  5. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    If the issue is running into your triangle limit but prefer the polygon version you could always just use both - in terms of both the chairs and the trusses - hi-poly for LOD0 and the low-poly alpha version for LOD1
     
  6. troy_halsey

    troy_halsey

    Joined:
    Oct 21, 2014
    Posts:
    63
    @PlatformSix Hey stranger (and guru)! I'm using LOD on the chairs. But hadn't thought of using alpha maps on the lower LOD. That's a pretty clever idea, if I can match them perfectly.

    But overall, do you think Alpha transparency maps are more expensive than poly/tri count?
     
  7. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    If mip-maps work in WebGL (they may not, there's some warning in console about them), alpha transparency with low poly is the best bet for your project.

    Performance isn't a linear resource, so it's difficult to measure poly vs texture fill and sorting across all hardware.

    Just make like 1000 200poly planes and put a transparency texture on them and see if the performance is what you need