Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Luca Belluccini · Jan 21, 2014 at 01:22 AM · shaderdecalfade out

Fading off texture and multiple instances

Hello, I am developing a game in which the gameplay is strongly based on decals. Those decals will be dynamic and the best would be to make them self-illuminated.

So I think to proceed with:

  • Texture with alpha + Transparent/Cutout/Soft Edge Unlit Shader

  • Change dynamically the Main Color from White to Black for the decay (this is only good if I have a completely dark scene)

I also found on the internet some custom shader developed by the community Self-Illuminated and taking into account Alpha.

Any other Shader+Texture suggestion to achieve the same is well accepted.

For the Footprint I found a nice script with a pool of data to be used to be assigned to a Mesh. The problem is that I think if I update the Material, the MeshRenderer will apply the same texture to the mesh.

My idea is to have a Footprint or Decal "Factory" that will instantiate a Footprint with a set of settings (position, direction, material, etc...) and make it evolve independently from the other instances. Those objects will have a Time to Live and then will be Destroyed (or reused).

For the TTL and "decay", depending on the law of decay, I can use:

  • Update() and use the time or an internal counter as parameter of the function

  • InvokeRepeating() or yield WaitFor* if I want discrete changes

  • Coroutines...

Since Footprint will not be the only decal to behave like that, I would like to ask you for some help.

The best would be to have a factory class to instantiate GameObjects (or get them from a pool). Each GameObject has its own mesh and material. The GameObject will be initialized with the decay settings and the mesh properly instantiated in the correct position & orientation. The GameObject will be self updating the values for making itself fade off until Destruction or reuse.

Is it the right approach?

Comment
Add comment · Show 3
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 robertbu · Jan 21, 2014 at 01:39 AM 0
Share

This is more of a design discussion that is more appropriate to the Unity Forums than to Unity Answers. For things like lots of decals, usually you want to display them in a single mesh. Each quad of the mesh represents one 'footprint'. The uv coordinates of that quad control what gets displayed from a texture atlas, so you can switch between left or right foot, or even have a set each with different amounts of fade. If you have a shader that supports uv colors, you may be able to control the fade as well by the assignment of colors in the mesh colors array. Here is one post on UA that you may be interested in:

http://answers.unity3d.com/questions/475795/rendering-permanent-trails-such-as-footsteps.html

I don't believe you want separate game object for each decal. That's were you are headed when you write about 'update the $$anonymous$$aterial'. If possible, you want to modify the mesh, and leave the material alone.

avatar image Luca Belluccini · Jan 21, 2014 at 10:08 PM 0
Share

hello, yes this is the script I was talking about.

The problem is that the tradeoff is between:

  • a huge texture with all shades * each kind of footstep + update at each decay trigger to change the uv mapping of the correct footstep shade

  • a texture with only the different kind of footsteps and change the shade by some change in color or alpha in the shader

avatar image Luca Belluccini · Jan 29, 2014 at 11:08 PM 0
Share

I tried with the following:

  • An empty object with a Footprint$$anonymous$$anager script: it Instantiates a copy of a Footprint prefab, creates a new mesh and adds this mesh to the new instantiated object

  • The Footprint prefab starts to fade off thanks to a script which updates the material settings

Any idea on how to optimize draw calls?

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Project vertices on surface, make a shape 1 Answer

Shader to paint at coords? 1 Answer

How do you set the UVs for a decal texture? 0 Answers

Decal Alpha Blend 0 Answers

How do I build A texture from decals? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges