• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Zyar · May 25, 2014 at 01:39 PM · transparent-texture

PNG's with Translucency, and Optimization

Hi everyone, I've been working on optimization for my levels but I'm a bit confused about translucency. One common tactic I've noticed in games is to reduce what could be a complex model into a single surface.

An example from Dishonored:

alt text

I've seen countless examples of this in games, but what I don't understand is why the textures never appear to have anti aliasing, leaving very rough edges between the solid and the transparent like in the example above.

Here's a grass texture I found:

alt text

This one has a translucent edge and looks much better. Is there a reason that the pixels of the PNG should only be at 100% opaque or 0% opaque and that anything between would slow things down? I have tested this myself in Unity and I see no performance difference between either method. But if this is the case, than why do so many games do this? Is there a reason I should be avoiding translucency when using PNGs like this? I would really appreciate any suggestions.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fornoreason1000 · May 25, 2014 at 01:46 PM 0
Share

The reduction to a single surface is called Bill boarding, nice question BTW. $$anonymous$$y guess is that the opacity bits would be encoded as 1 or 0 ins$$anonymous$$d of 0.66857524631524 which is easier to process.

avatar image Owen-Reynolds · May 25, 2014 at 07:55 PM 0
Share

An obvious sharp border between opaque and transparent probably means they're using sub meshes. As to why -- maybe Unreal just makes that way easier to do.

And, of course, overlapping partly transparent objects can be tricky.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by supernat · May 26, 2014 at 05:32 AM

In shaders (this goes back to the original fixed function pipeline design), you have two options with regard to alpha: 1) reject a pixel with an alpha value less than some threshold (Alpha Testing) (which is what you see) or 2) blend the alpha with the background. By design, the 1st is much faster (it used to be anyway), because you don't have to perform any blending. The pixel in the non-opaque areas is just immediately tossed out and the color buffer remains with the last color. When you alternatively use the 2nd approach, you have to blend all of the texture, so even places with zero opacity will take a hit, and the actual blending itself is a bit heavy. They don't specifically call this out as the reason on this linked page, but I think they are doing a two pass render to optimize the speed: https://docs.unity3d.com/Documentation/Components/SL-AlphaTest.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I soften the edges of a transparent Plane texture 1 Answer

Mobile shader with transparent rendering mode 1 Answer

How to use Transparent Material ? 0 Answers

How to make a part of a texture transparent? 0 Answers

Problems with Textures 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges