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 AmbientAlchemist · Jan 29, 2013 at 10:31 PM · texturecoloralpha

How do I change the color of a texture in a specific radius?

I am working on an idea where I have several colored characters moving around a white map, and as they move I want them to leave a trail of color behind them, however I cannot find anything about changing color of textures in real time.

I have though of other ways to achieve this effect, like placing a model with a proper colored texture on top of the surface.

A while back in XNA I used render targets to create a black overlay for a map and cleared a circular area around lights using alpha blending.

If any of these things are possible, any advice on how to proceed would be greatly appreciated.

Thank You.

Comment
Add comment · Show 7
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 schaddemm · Jan 29, 2013 at 11:14 PM 0
Share

Could you elaborate? What kind of map(is it just a flat plane, whats our perspective, is it 2d/3d).

Sounds like something that needs a solution very specific to what you want to do, since performance should be an issue.

ideas: -maybe you can do something with the trailrenderer -maybe you can use the unityterrain, and paint the spot the characters walk on -maybe you can solve it with something like spawning particles or semitransperent planes where the characters walk

avatar image AmbientAlchemist · Jan 29, 2013 at 11:17 PM 0
Share

Sure, it's 3D, I want to start with a flat plane, but eventually adapt the method into any type of texture, so for now I would like to focus on how it would work on a flat plane, 3rd person camera.

avatar image Berenger · Jan 29, 2013 at 11:20 PM 0
Share

Particles, maybe ?

avatar image robertbu · Jan 29, 2013 at 11:35 PM 0
Share

You can change the pixel values of a texture directly. Take a look at methods Texture2D. But mapping your world coordinates to specific places on the texture could be a real pain.

You could leave game objects at bread crumbs. As long as they all have the same material, and you don't change the material at runtime, they will be batched together into a single draw call. But if the path can be long, you end up with a bunch of game objects that could hurt performance.

The Vectrosity is a line drawing package in the AssetStore. They have API for both 2D and 3D lines (including dotted lines). For an array of 3D lines, Vectrosity builds a single mesh, so there will be only one game object and one draw call for the entire path. I don't know how they handle 2D.

Apart from Vectorsity you could take their approach and dynamically build and expand a mesh as the players walk around.

avatar image AmbientAlchemist · Jan 29, 2013 at 11:35 PM 0
Share

The trail render works as a tracer to deter$$anonymous$$e where things have been, but I was looking more for something that can actually change a texture.

Sorry if it was not too clear to start.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MountDoomTeam · Jan 30, 2013 at 11:40 AM

actually I have done a lot of this! And nice name!

Every time that you use another texture it uses a lot of processing power.

You're supposed to use one texture with lots of colours like a pallette, and use it like a texture Atlas. get whatever meshes you want texture, when you instantiate them, and change all their UV coordinates to a single point, for example if you wanted them to be white, change all the UVs to 1, 1, the corner of the pallet, and 0.5, 0.5 let's say would the blue.

You would need an image you know the colour coordinates of, but that's a very efficient way to do it in unity, there is even a code somewhere on this forum by someone Bentley I think to change mesh UVs into points.-that's the way I would do it because it's really convenient to know how to do, I should upload it to unify wiki actually. http://answers.unity3d.com/questions/13316/how-to-move-uvs-of-a-mesh-so-you-can-have-two-text.html

Another option is that you can change the colour in code of the material http://wiki.unity3d.com/index.php?title=Animated_Color_Procedural_Texture

Although I think that uses the same as a different texture for every texture, maybe it's okay if you use shared material, I don't think it's draw call efficient.

another thing to know about is there is a shader that allows you to use to textures with transparency on an object in the unity wiki.

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.

Follow this Question

Answers Answers and Comments

12 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

Related Questions

Problems With Alpha Channels When Loading DXT5 Texture2D From PNG 1 Answer

Texture with alpha upon a color 0 Answers

How to paint a texture transparent ? 0 Answers

How to Make a Character Flicker? 1 Answer

Need Help adding Main Color Property to a complicated Shader 1 Answer


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