Hello Guest

Author Topic: Few question regarding sprite rendering  (Read 3998 times)

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Few question regarding sprite rendering
« on: April 10, 2013, 03:31:28 pm »
How do I adjust the camera and sprites to make pixel perfect in different situation?

I was originally using the default camera provided and the sprite tk2dCamera unchecked, simply by clicking 1:1 button to make them pixel perfect. It worked fine for a while until I realize I should use ortho setting in my camera (I was using perspective before) so I swtiched. After few back and forth and tweeking I noticed the pixel perfect button doesn't work anymore, no matter on what mode by clicking that button the sprite will do absolutely nothing, I have to create a new scene and this time around the button worked again. What will be the possible reason to make the button stop functioning in the first senarios?

I then noticed there is a tk2dCamera but I saw the message:

Please keep in mind that while the tk2dCamera is compatible with sprites created with the old method, sprites created with the tk2dCamera tickbox enabled will not auto-size correctly with standard ortho cameras.

So it means I have to use tk2dCamera along with sprites with that option in order to make pixel perfect sprite, is this camera ortho only?

EDIT: I plan to have parallax scrolling for my game, but seems 2DTK doesn't have come with this feature suppored, so I plan to use ThinkScroller, seems they have they own custom camera for parallax effect, in that case is 1:1 button still supported?



Also I found that even after using the make pixel perfect button (I assume it worked since texture changed size to reflected changes), in the in-game rendering there is still a differentces in size and quality downgrade. The in game rendering is slighly smaller and has lower quality than that in the editor (see attachment). Is this supposed to be? Can I force highter quality render such that it produces that same effect as the view in the sprite editor? In my project setting the texture quality is set to Full Res

Another question: how is the sprite been lit? I noticed the differences between the sprite in game and in the editor, in game sprite matches the correct brightness and in editor sprite is slightly darker for some reason. As I know even in this 2D work we still need to see lighting in order for texture to work, and the default ambient light in unity is rather dark. How is the sprite in 2DTK been setup in regards of lighting? Can I change the light value? If I want to create a level with custom light (only lit the textures where a torch is at, and the brightness fades around it, for example), how do I adjust the light in the sprite? I also want to do some self shawding by putting a light source in front of the sprite (or maybe even use a normal map). How can I achieve these?

Thanks
« Last Edit: April 10, 2013, 03:39:44 pm by ryf9059 »

m4ko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 75
    • View Profile
Re: Few question regarding sprite rendering
« Reply #1 on: April 11, 2013, 12:09:46 pm »
To get pixel perfect results I use:
- use tk2dcamera
- in the sprite collection from where your sprites come from check "use tk2d camera"

Finished. That always gives me perfect results. Also I don't have any lighting issues. Sprite colors in collection, editor and game view are all identical.

When you import new textures (before you put them in the sprite collections) change them to "advanced", no mipmapping, filter mode "point", no "stretch to nearest"!


Of course parallax scrolling is supported. Parallax scrolling is not a "feature" of tk2d because it is just a display technique and not a part of a 2d api framework. There is a full demo from the developer in the private support forum here:
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,87.0.html