Hello Guest

Author Topic: multiple tk2dCameras? (For Pro Image Effects like blur, etc)  (Read 8427 times)

39thstreet

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 77
    • View Profile
multiple tk2dCameras? (For Pro Image Effects like blur, etc)
« on: April 20, 2012, 11:19:01 pm »

I've been playing with some of the Unity Pro image effects like blur, glow, and the like.    I've been doing this outside 2dtoolkit using basic unity scenes.  Since these effects are attached to cameras, I have to create multiple cameras (one with the effect, one without) and then set their layer, culling mask, and depth accordingly.    This all *seems* to work in my test scene.

But when I try to do the same thing using tk2dCameras it no longer seems to work.  I can get both cameras showing, and I can get the blur effect on one.  But it always seems to either hide one of the cameras, or show and blur both. 

So, is it possible to use multiple tk2dCameras in a scene?  If so, any idea what stupid thing I might be doing that would mess it up?  I admit to still being fuzzy on how the layer/culling mask thing works.  Anyone have a demo project I could look at?

Also, related question:  are there other, simpler ways (shaders?) to achieve some simple effects like blur?

Thanks in advance!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: multiple tk2dCameras? (For Pro Image Effects like blur, etc)
« Reply #1 on: April 20, 2012, 11:47:08 pm »
What are you trying to achieve with the blur? Just a general blur all over?

If you've got 2 cameras, do you have the depth set to different values, and the clear flags set to none on the one which is drawn after the first? Otherwise, the camera which is drawn second will simply overwrite the output of the first...

39thstreet

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 77
    • View Profile
Re: multiple tk2dCameras? (For Pro Image Effects like blur, etc)
« Reply #2 on: April 20, 2012, 11:57:39 pm »
I was trying to blur a single gameobject/sprite.  My understanding is that the way to do this was to give that sprite it's own camera.

Depth values were different,.  I thought I had the clear flags correct, but maybe that's my problem, I'll give it another look.  Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: multiple tk2dCameras? (For Pro Image Effects like blur, etc)
« Reply #3 on: April 20, 2012, 11:59:14 pm »
You're not targetting mobile are you, as if you are thats a very very bad idea.

39thstreet

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 77
    • View Profile
Re: multiple tk2dCameras? (For Pro Image Effects like blur, etc)
« Reply #4 on: April 21, 2012, 12:13:18 am »
You're not targetting mobile are you, as if you are thats a very very bad idea.

Hah, I am, thanks for the warning!   

Although right now I'm mostly just trying to get a handle on both Unity and 2dtk.  I'm already plenty familiar with doing these kind of effects (blurs) with texture animations from years of cocos2d dev.