Hello Guest

Author Topic: camera anchor by percentage and grey scale shader questions?  (Read 5125 times)

mamamia

  • Guest
camera anchor by percentage and grey scale shader questions?
« on: November 04, 2012, 09:18:03 pm »
Hi!,

I want to anchor my gui elements. I'm socked that just absolute points coordinate is allowed. Won't this be a problem when having different resolion assets? I mean, imagine we have 3 buttons that will be placed one above the other at even intervals. in a 1x resolution they are positioned ok when using anchors, but what about when we want to render same scene with 2x resolution sprites? They will be overlapped. I think one solution would be allowing percentages in the offsets. Perhaps I'm missing something, could you give a hand here?

On the other hand,would it be possible to add a grey scale shader to a sprite to avoid (in my case I need some extures with color and others in greyscale) having to double textures just to have a black and white version?

Thanks in advance.
« Last Edit: November 04, 2012, 10:06:26 pm by mamamia »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: camera anchor by percentage and grey scale shader questions?
« Reply #1 on: November 04, 2012, 10:20:40 pm »
1. When switching 1x and 2x sprites, the 2x sprites will be scaled to the size of the 1x sprites. Well you start off with a "native" resolution whatever that may be and everything else is scaled to that resolution automatically. You don't have to care about the sizes of sprites, unless you're dealing with different aspect ratios, and even then only in cases where the whole layout will be changed. So your example of 3 buttons aligned to the center would just work.

2. Set it to white, and tint using the color on the sprite.

mamamia

  • Guest
Re: camera anchor by percentage and grey scale shader questions?
« Reply #2 on: November 06, 2012, 10:39:51 pm »
Hi!,

Sorry for the delay but I have been out for 2 days.

About your first answer, what I meant is that if you anchor a sprite 100 pixels from the left and the sprite has a width of 50 and then you want to create another set of sprites for HD where resolution change (I don't mind about ratio in this example) and your sprite is 200px for that resolution part of the sprite will be out of the screen because it was anchored to x=50 and not with a percentage. I don't know if I'm missing something.

About your sencond answer, won't this just draw my sprite just with less vibrant colors? (Tinting to gray), What I need is convert the sprite to a gray scale. Don't think what you suggested would work. Again, I could be wrong or missing some importarnt point.

Thanks again for all your patience.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: camera anchor by percentage and grey scale shader questions?
« Reply #3 on: November 07, 2012, 02:31:50 am »
1. If you anchor a sprite 100 pixels from the left, you can configure the camera to leave the scene alone - i.e. it will scale the scene to fit the view, so 100px will really be 200px, but you don't know or care. With HD/SD switches, the sprite sizes are the same in world units. Just one has 2x the detail. Make sense?

2. Oh I see what you mean. You can take the base shaders and modify them - look for a desaturate shader on google and do that. Keep in mind doing this means you lose support for fixed function shaders & the shaders will perform quite a lot slower...

mamamia

  • Guest
Re: camera anchor by percentage and grey scale shader questions?
« Reply #4 on: November 07, 2012, 06:26:53 pm »
Thanks for all the info.