Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dissolve texture #75

Closed
teacoat opened this issue May 30, 2018 · 7 comments
Closed

Change dissolve texture #75

teacoat opened this issue May 30, 2018 · 7 comments
Milestone

Comments

@teacoat
Copy link

teacoat commented May 30, 2018

I have a bunch of UI elements that I want to dissolve one after another, change the text, and then dissolve it back in. This doesn't look great with the dissolve texture for each one being the same.

Is there any way to change the texture being used? Even more amazing would be something I can call on each UIDissolve to generate a new perlin noise texture on the fly?

Thanks for the great asset!

@mob-sakai
Copy link
Owner

mob-sakai commented May 30, 2018

Hi, @teacoat.

It's good feature!
It is not supported yet, but will be supported soon, I think.

Now, I have two ideas.

Solution 1: Create new material instance with another noise texture.

You can use any texture.

Solution 2: Generate perlin noise in shader with some parameters.

Noise pattern is generated without material instances.
To send parameters to the shader, use UIVertex.normal etc.

@mob-sakai
Copy link
Owner

If you want to do it immediately, please make the following modifications.

1. Comment out the ISerializationCallbackReceiver interface from UIDissolve.cs

public class UIDissolve: BaseMeshEffect
#if UNITY_EDITOR
//	, ISerializationCallbackReceiver
# endif

2. Create a new dissolve material

  • Set the UI/Hidden/UI-Effect-Dissolve shader
  • Set inspector to debug mode and set shader keyword according to ColorMode.
    (Additive: UI_COLOR_ADD, Subtract: UI_COLOR_SUB, Override: UI_COLOR_SET)
    5 -30-2018 12-17-06
  • Set your noise texture

3. Set the material as EffectMaterial and disable/enable component

5 -30-2018 12-25-21

@teacoat
Copy link
Author

teacoat commented Jun 1, 2018

Will this make the material texture in UIDissolve public and accessible during runtime to change textures as well?

@mob-sakai
Copy link
Owner

mob-sakai commented Jun 1, 2018

It is possible by creating a new material instance.

https://gist.github.com/mob-sakai/57341af242e28f55aa2b579981364559

  1. Import above script to your project.
  2. Add a ChangeDissolveTexture component to the GameObject contains UIDissolve.
  3. You can change the texture from the inspector or a script like this:
    changeDissolveTexture.dissolveTexture = _your_dissolve_texture;

@mob-sakai
Copy link
Owner

hmm.. I think that the noiseTexture property should be added to UIDissolve.

@teacoat
Copy link
Author

teacoat commented Jun 1, 2018

A noise texture property and a method you can call to regenerate the noise texture would make this perfect!

@teacoat
Copy link
Author

teacoat commented Jun 1, 2018

I will try your other solutions sometime this weekend and let you know!

@mob-sakai mob-sakai added this to the v2.6.0 milestone Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants