Forum rules - please read before posting.

Different posteffects on different cameras

edited October 2014 in Technical Q&A
Sorry that I often write but the further delve into the development then more of questions.

I understand that is always active only MainCamera. However, in many situations, I would like to use different post-effects. For example, I ran into a problem with DOF. In some places, it looks good but in other is bad and i need to change its settings. What can i do?

image
image

Comments

  • This was the subject of a discussion a while ago, and - though I actually went and implemented a solution - it wasn't ideal by any means.  The best method at this point is to attach your effect script(s) to the MainCamera, and manipulate them according to which camera is currently the "active" Camera.

    Though the MainCamera is only the one that's ever technically active, you can easily work out which camera it is currently copying with this code:

    _Camera activeCam = AC.KickStarter.mainCameraPrefab.attachedCamera.name;

    You could then either check it's name, or compare it with public _Camera fields you set in the script and assign in it's inspector:

    if (activeCam.gameObject.name == "BathroomCam")
    {
     // Do something
    }

  • Hmm... This is problem for me.. I'm not programmer( Are there any other options?
  • Sorry if I hook myself into this thread, but I use Playmaker very much (not for everything, some things are still best made with scripts) but wouldn't this be a perfect case for the use of PM?
  • ChrisIceBox Its will be very very very good if you can make this:

    Main camera take component settings from GameCamera if it have the same component. And return settings back when camera changed back or change different GameCamera.

    I was hoping that your Asset completely rid me of programming. And now this is the only issue that prevents me to work :(
  • Is this just about DoF?  I've been looking into a DoF setting for 1.40.  When it comes to custom effects, a little bit of programming is to be expected - since there's just so many things you could want to implement.

    1.40 will come with the ability to set a focal length per camera, and retrieve it with a single line of code.
  • Yes about DOF) I found a way how to change the value of the DOF but it is very stupid) I have a script that in Start() changes the value of DOF. AdventureCreator creates Prefab (there are several different setups) - that change DOF value in the Camera and Prefab immediately deleted. It sounds really stupid but it works)))
  • One thing I was hoping would be that (for 2D games) a way to have a GPU/sprite blur depending on the player position in the sorting map to achieve a fake DOF blur.

    I expect it will involve a complicated coding.

    Just a thought :)
  • Would it be better to have a Focal Length target like triggers that you can place in your scene or attach to your character then when you click on the DOF target you can assign the camera to it? So when your camera is triggered it will already have the Focal length set for that camera... That way it can be either an object or your character and you can decide for each scenario....

    .02
  • Anyway you need to coding. But i think my method is more good for scene organisation)
  • @megawave: Indeed - you'll be able to either define the DOF distance explicitly, or set the camera's "target" (by default the player, but you can set it to any object) as the focal point.
  • Well.. Anyway i think its will be good to create system for control posteffects. Moreover, in Unity 5 they have not changed.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.