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 AndreasX12 · Feb 01, 2015 at 04:59 PM · mobileimagelageffectgrayscale

Black and white effect on mobile?

Hi.

I attached the GrayscaleEffect.cs image effect to my camera and it works perfectly in the Editor.

However, when I builded to my devices the framerate went down to less than 5 FPS when I activated the Grayscale Effect.

How can I create a black and white effect on mobile devices running with a decent framerate?

 

Best regards, Andreas

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 black843 · Feb 01, 2015 at 07:21 PM 1
Share

what are u doing exactly in your script? If u want to change to something like this you could just change the materials of each object, and it would work ;)

avatar image AndreasX12 · Feb 02, 2015 at 09:05 AM 0
Share

This is the script:

 using UnityEngine;
 
 [ExecuteInEdit$$anonymous$$ode]
 [AddComponent$$anonymous$$enu("Image Effects/Color Adjustments/Grayscale")]
 public class GrayscaleEffect : ImageEffectBase {
     public Texture  textureRamp;
     public float    rampOffset;
 
     // Called by camera to apply image effect
     void OnRenderImage (RenderTexture source, RenderTexture destination) {
         material.SetTexture("_RampTex", textureRamp);
         material.SetFloat("_RampOffset", rampOffset);
         Graphics.Blit (source, destination, material);
     }
 }

You are right that it would work by changing each material, but I have a lot of them, so it wouldn't be the best method, unless it's the only one working method for mobile devices of course.

avatar image black843 · Feb 02, 2015 at 08:09 PM 0
Share

Here I'm back. Ahm. What you simply clould do is something like this. ( sorry, I don't know the exact references for the materials but I try to give you my logic. )

So. This is what I think of. You are making one script. For example. $$anonymous$$aterialchanger.cs

Then u assign the other script that contains the variable that is being activating that grayscale effect. And then you can make a refference to it. The looking script uses update because we want to look each frame. Example script:

using UnityEngine

public class $$anonymous$$aterialchanger : $$anonymous$$onoBehaviour {

public Texture gray; public Texture white;

TheChangingScript TCS;

//catch the activating script void Start() { TCS = FindObjectOfType(TheChangingScript) }

//update each frame and look if TheChangingScripts bool is changing void Update() { //just execute that if it is my networkview if(Networkview.is$$anonymous$$ine == true && TCS.bool == true)

{ material.SetTexture(gray); } else { material.SetTexture(white); } }

}

attach something like that on each object where you would like to change the texture. Good luck!

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

20 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

Related Questions

Image Effects on MovieTexture 0 Answers

Can Paritcle Effects Cause Lag? 1 Answer

Unity3.4 Mobile Terrain Lag 1 Answer

shown like 16bit color image 1 Answer

How to improve mobile speed with particle systems? 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