Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need advice - 2d Sprites sequence (no sprite sheet) & normal maps

Discussion in '2D' started by Bathofblood, Nov 20, 2015.

  1. Bathofblood

    Bathofblood

    Joined:
    Apr 11, 2015
    Posts:
    7
    Hi all, we have a problem about normal maps.
    We use a lot of sprites sequences for our bosses and big sprite objects.

    IrelleClosed0001.png
    same as this because it's too big (X/Y) to be a sprite sheet sequ.jpg

    We need to know if : there is a way to use this animation (frame sequence) as normal maps ? how to apply ?
    or do we need to create a second animation with the normal map frame ? how to apply ?
    or do we need to add 1 shader at each frame on the original animation ?

    Many thanks to help us on this one because we are a little lost.
    Sorry for my bad english.
     
  2. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    431
    really interested too in normal maps and animation, I'm gonna check this thread later ^^
    Now, for what I already know : your normal maps should be only gray scale, so first, i would take this sprite sequence (what is this ? i only use spritesheet !) and desaturate it.
    But I'm a noob in this field.
     
  3. Andreas Loew

    Andreas Loew

    Joined:
    Feb 27, 2013
    Posts:
    17
    It seems that many parts of the image are static. Why don't you slice the image in 2 parts: The ones that are static and the "mouth" of the ship? With this 2 normal maps should suffice. You might even be able to pack the sprite into a sprite sheet.
    But it's hard to tell because the images are too small.

    What advice do you need for the normal maps?

    @RemDust Normal maps have 3 components, encoded in RGB. The grayscale is not a normal map but a height map. It's converted into a regular normal map in Unity.

    The important part about normal maps is that they have the same layout as the sprites. Especially if you use sprite sheets.

    Using them is easy: You create a material, assign the sprite as albedo and the normal map. Then you choose the shader you want. The standard shader should work - but you might also try others. Then assign the material to the sprite.

    I have a normal map tutorial for Unity. It might give you the ideas for this. Just skip the first part if you already have normal maps.
     
  4. kayupla

    kayupla

    Joined:
    Apr 1, 2014
    Posts:
    4
    Actually we just made like that.... each frame has it material with normal mapping.

    Question :
    Does each material take a lot of ressources ? once there will 20,30, 40 or more, elements like this on the screen?
    predicting that we also implement height map and occlusion further...

     
  5. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    431
    Well, I don't really want to buy plugins for the moment, but if I got it right, Normal (or height maps) can also be used as spritesheet (to match every frame) ?
    I guess that means we need one material per animation, right ??
     
  6. Andreas Loew

    Andreas Loew

    Joined:
    Feb 27, 2013
    Posts:
    17
    Yes - you set up 1 material with albedo and normal map. The important thing is that the sprite sheets and the sheet containing the normal map have exactly the same layout. The shader takes the coordinates from the sprite sheet data and uses them to locate the textures. But I don't think that Unity's sprite packer is able to do this.

    sprites.png sprites_n.png Bildschirmfoto 2015-11-23 um 23.39.04.png Bildschirmfoto 2015-11-23 um 23.40.25.png
     
    theANMATOR2b and RemDust like this.
  7. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138


    this one is new, and this is what you need i guess
     
    Last edited: Nov 25, 2015
    RemDust likes this.
  8. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    431
    Ok man, thank you, now how can i switch the material with animations without using a plugin (btw, thank you biscito :) )
    I guess i just have to make a script that check the animator state and set a new material to my renderer component with any animation state change, right ?
    Don't have to take care of any lag if I use a simple update loop ?
    Thank you again for you inputs guys.
     
  9. CodeAndWeb

    CodeAndWeb

    Joined:
    Jul 31, 2014
    Posts:
    60
    @RemDust : If your sprites fit into a single sprite sheet you don't have to switch materials.
    Otherwise you'll have to experiment what works and what not. I assume that it should be possible to update animation phases and the material at once.
     
    RemDust likes this.
  10. Bathofblood

    Bathofblood

    Joined:
    Apr 11, 2015
    Posts:
    7
    We find 2 solutions. Thx all. End Topic