Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Mr-Random570 · Jan 05, 2021 at 03:10 AM · textureobjectmaterialsrendereralpha-channel

Changing scrolling textures on a plane using transparency

Hi,

Im trying to change between two textures on a plane with a scrolling effect and have hit a road block trying to achieve this.

My current attempt is to create a texture scrolling effect by setting the textures offset using something like this.

GetComponent<Renderer>().material.mainTextureOffset = new Vector2(F_Scroll_X, F_Scroll_Y);

I would then use the same method to move a second texture from a preset offset to 0,0 making it the visible texture.


I was hoping to find a method of having 2 materials on the mesh renderer and follow something like these steps

  1. First material is shown

  2. First Materials texture is offset to the side creating the scrolling effect

  3. The second materials texture would be starting at an offset, and by changing its offset to 0,0 It would scroll into place as the First material is scrolled out


The problem with this is the first material is not transparent when offset so it is still visible with the result been you see whatever wrapping mode the texture is using rather then the second material.

Im looking for a way to make the original texture appear transparent when its wrapped. Is this possible?

an alternate solution to achieve the same effect I considered was to have the two textures overlap but the original would somehow have an offset alpha channel that I could scroll to make it fully transparent, but I have no idea how I would go about achieving something like this. Is this possible with shaders and something I need to look further into?

Sorry if my question isn't worded to well, but I hope it makes sense. Thanks in advance for any help/advice,

Comment
Add comment · Show 5
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 Pokedlg3 · Jan 05, 2021 at 11:08 PM 0
Share

@$$anonymous$$r-Random570 Do you want to make the texture completely transparent or translucent?

And I don't understand where you would fit this, because I didn't quite understand your question, maybe the full script, or some images and videos would help.

avatar image Mr-Random570 Pokedlg3 · Jan 06, 2021 at 03:49 AM 0
Share

I would like the texture to be fully transparent on the part that is been wrapped, but im unsure if that is possible. Perhaps its possible to disable texture wrapping and just leave the plane untextured where the texture has been offset?

Perhaps a better way to explain what im looking for is similar to an advertisement billboard in a major city. An ad is shown for a period of time and then a new advertisement is 'scrolled' into the frame as the last one is scrolled out. However instead of a set rotation of ads been cycled I need to replace the original ad with a new ad dependent on some other logic in the program.

I would like it to have an effect where the first texture is 'scrolled' out as the new one is co$$anonymous$$g in rather then a simple instant swap.


So I was hoping to find a method of having 2 materials on the mesh renderer and follow something like these steps

  1. First material is shown

  2. First $$anonymous$$aterials texture is offset to the side creating the scrolling effect

  3. The second materials texture would already be set at an offset, and by changing its offset to 0,0 It would scroll into place as the First material is scrolled out


The problem with this is the first material is not transparent when offset so it is still visible with the result been you see whatever wrapping mode the texture is using rather then the second material.

So essentially what i am trying to achieve is when a texture of material is offset rather then any wrapping I would like it to be transparent. I'll edit the original question to try to make it more clear what im trying to achieve

avatar image Pokedlg3 Pokedlg3 · Jan 06, 2021 at 04:13 PM 0
Share

Do you want this transparency to be immediate or does it have a fadeout effect?

avatar image Mr-Random570 Pokedlg3 · Jan 07, 2021 at 12:26 AM 0
Share

The transparency would be immediate but only only the part of the texture that is wrapped. So for example if the Texture was offset 0.5 to the left, the plane texture would be on the left half of the plane and the right half would be transparent.

avatar image Mr-Random570 · Jan 07, 2021 at 03:21 AM 0
Share

I have found the solution to my problem, Ill post it as an answer for future reference

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Mr-Random570 · Jan 07, 2021 at 03:24 AM

This issue came down to my lack of knowledge around TextureWrapMode.Clamp and how it worked.

To solve my problem I had to make a 1 pixel border around the textures that was transparent, this pixel is what is used when the texture is wrapped using the Clamp Wrap mode.

Doing this allows the texture set at an offset of 0.5 to be displayed on half the plane whilst the other half is transparent. Using two materials setup like this I can move both offsets at the same time to scroll 1 texture in as the other is scrolled out.

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

147 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Having wrong texture on my model? 1 Answer

So, what's the problem with this code? 1 Answer

Having a problem with the second material (on the same renderer) 0 Answers

Textures are not tiling properly on my wall model! 3 Answers

Change the texture on a material at runtime without creating an instance 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