Forum rules - please read before posting.

What is the right texture setting for an animated cursor?

Does anyone know here what the best texturesetting is for an animated cursor? I have rendered out an animation in 1920 x 1080 resolution. But once I imported the combined pictures into Unity and using AC in the CursorTab, I get a lot of framerate issues. My texture is set as advanced with the read/write enabled. I don't have any warning messages, except for one in the advanced texture tab that says: Only textures with Width/Height beeing multiple of 4 can be compressed to DXT5 format. I don't know what to do about this warning message and I don't know if AC is related. I think it are my texture settings that cause the problem. So please: is anyone here that succeeded in making a high resolution animated cursor without lag? If so, please explain to me how. Thanks!

Comments

  • Your cursor texture resolution's weight and hieght must be the same e.g 140*140, 120*120 etc.
    I use .png 
  • The multiples of 4 warning will mean you should also have them of the size e.g. 64x64, 128x128, 256x256 etc.
  • edited June 2016
    Thank you @SkyTree and Thank you @ChrisIceBox and thanks a lot for the conversation today Chris!! :)
  • Ok, but how do I do this? I keep getting the error, I rendered it out on 1000 x 1000. Is that wrong? I don't get it..
  • @SkyTree Can you tell me how you made the animated cursor? I just succeeded to get the warning message of "the same width and height scale" gone. But my game drops to 40 frames. Because of a cursor? Even in low res? 
  • edited June 2016
    I just have a .png 468*468 sprite sheet, set it as sprite texture type (Why do you have it as Advanced? Try as Sprite) and sprite mode multiple, format compressed/default, filter mode bilinear. And Animated? checked with 6  rows and 6 columns in AC cursor tab.
     Never had any problems.

     Also, I see you changed it to 1000*1000, my guess you just squeezed the sides, it won't display right. You really have to have all your sprites in your sprite sheet nicely separate and uniform, like each sprite should be 24*24 and when combined into a sprite sheet the final texture should be 120*120 if you have 5 rows and 5 columns.
     Because you can not tell AC what exact resolution it should render out in Unity like if  you have a sprite sheet 278*624 and in it you have each frame with 42*68, it won't display correct.

    You can try alternatively to make your cursor animation follow your cursor and hide the cursor. But it would be cumbersome since every time you'd need to use an actionlist.

     However I do have this in my game too where I need some specific objects to follow my cursor.
    I made a simple script that make an object follow the cursor and a custom action that disables/enables that script/component. Here's the custom action to disable/enable your component http://www.adventurecreator.org/forum/discussion/3932/custom-action-disable-enable-your-component-your-custom-script#latest
    So when I need my object to follow the cursor I turn on it's visibility and enable follow cursor script/component.

  • edited June 2016
    @SkyTree Thank you for your long answer! That is much apreciated. 

    I have the sprite texture set to advanced because I get this Unity error otherwise (if set to Sprite multiple): 

    UnityException: Texture 'Cross_256x256' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
    UnityEngine.Texture2D.GetPixels (Int32 x, Int32 y, Int32 blockWidth, Int32 blockHeight) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:326)
    AC.CursorIconBase.GetAnimatedTexture () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/CursorIcon.cs:374)
    AC.CursorIconBase.Draw (Vector2 centre, Boolean canAnimate) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/CursorIcon.cs:425)
    AC.PlayerCursor.DrawIcon (Vector2 offset, AC.CursorIconBase icon, Boolean isLook, Boolean canAnimate) (at Assets/AdventureCreator/Scripts/Controls/PlayerCursor.cs:675)
    AC.PlayerCursor.DrawIcon (AC.CursorIconBase icon, Boolean isLook, Boolean canAnimate) (at Assets/AdventureCreator/Scripts/Controls/PlayerCursor.cs:686)
    AC.PlayerCursor.DrawMainCursor () (at Assets/AdventureCreator/Scripts/Controls/PlayerCursor.cs:422)
    AC.PlayerCursor.DrawCursor () (at Assets/AdventureCreator/Scripts/Controls/PlayerCursor.cs:328)
    AC.StateHandler.OnGUI () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:541)

  • And how do you fuse your layers? I fused my layers with Gimp with a filter (combined - Fuse layers).
    And with this filter I cannot make 6 rows and 6 columns because it doesn't want to do that! In my case I end up with 5 rows and 4 columns. There is no setting in the filter that can do that, it only has one setting that asks how many layers I want on the X axis. So.... how do you do it? Do you use Photshop?

    Also if I use this 256x256 spritesheet it says in the sprites multiple tab it is 1024x1280. However, if I set it To Nearest in the Advanced tab it says: 1024 x 1024 (or 256 x  256). It still gives a warning:  Sprites can not be generated from textures with NPOT scaling.
    UnityEditor.DockArea:OnGUI()


  • edited June 2016
    However, if I set the texture type to Cursor, I don't get any complains but...  the scale of the texture is set to 1024 x 1280 and in the Game it displays alright with the animation. But again.. my game drops 40 to 50 frames..

    So I really am hitting a wall here. And I can't find a normal Unity tutorial about how to do this, which surprises me the most of all!

    And thanks for the script. I don't have enough time this moment to look into it, so I am not sure I understand it correctly. But I will when I have.

  • edited June 2016
    What layers? I don't have any layers, just a .png file :D
    If your texture has layers like in .psd then no wonder your 1020*1024  texture causes such a huge fps drop.
    I use imagemagick for combining and trimming my sprites into one sprite sheet.
    5 rows and 4 columns are fine as long as the texture's width and height are equal e.g. 120*120, 256*256 etc

    Try to find a way to use your texure as Sprite and not as Advanced, try in .png perhaps .tga whatever Unity supports with alpha channel. Try to set it as Sprite but not as multiple.
  • Try setting the image type to Advanced, and then check Read/Write.
  • edited June 2016
    I meant with layers, the individual pictures of the animation that are merged on one canvas sheet (into one png picture). Thats the way I did it. In Blender the resolution is set to 256 x 256 per frame (picture). And Chris, unfortunately Read/write enabled won't solve the lag problem. :(
  • I think I tried everything, resized the canvas sprite also in Gimp so it is always 1024 x 1024. But is it even possible to have high resolution animated textures??? If the canvas size is 1024 x 1024 the cursor texture looks "ok", not great. So every individual texture then is 64 x 64 in the Sprite Editor. But even with this resolution my game drops from around 90+ frames to 30 frames(!) 
  • edited June 2016
          image
  • edited June 2016
    This are my settings in the texture tab (see above). So: the canvas sheet is set to 800 x 800. The textures on the canvas are each sliced 200 x 200 in the Sprite Editor. In AC: 4 rows and 4 columns, like you can see above. 


    Even with this settings that all seemed to be correct to me, and with a for me VERY LOW res texture setting, the game drops to 40 frames instead of keeping it at the normal 90 frames.
  • You have a lot of white space in your graphic - you should see about packing the frames much more closely together.  It looks lto me like you could fit the same sprites within an images less than a 1/4 that of this one.
  • Okey Chris, thanks! I will try that and report how it worked.
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.