AuthorTopic: [WIP] Action-platformer sprites from a complete beginner  (Read 15034 times)

Offline PixelPiledriver

  • 0011
  • **
  • Posts: 997
  • Karma: +6/-0
  • Yo!
    • View Profile
    • My Blog

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #20 on: March 16, 2012, 08:16:57 pm
Depending on the hardware some games do actually run on an Color Table or Index based graphics engine.
But it is not necessary to run in an indexed color mode (some graphics APIs such as OpenGL give you the option) as you can write your own code to handle color palettes.

You can totally alter image data using Pixel Shaders:
http://en.wikipedia.org/wiki/Shader
http://www.facewound.com/tutorials/shader1/

Many different effects can be achieved including palette swaps.
How you write the Shader to handle the color swap is very flexible.
The data can be passed in as RGBA values or you could pass in a tiny texture that has your palette of choice lined up.
Then using some simple index math you can access each of the colors as if it were an array.
Conceptually it would be something like this:


But really you could pass in a texture with a single pixel of each color (I've made a 2x2 just for a bit more clarity):


So now that you have a base table if you pass in another palette as a texture:



you can compare them and make the color swaps inside the shader.
This is HLSL code:

float4 ColorSwap(InStruct data) : COLOR  <-------- Pixel Shader function signature
{
  float4 color = tex2D(image, data.texel);  <-------- Get the image data of the current texel

  if(color == colorTable1(0))                    <-------- Compare current texel color to the "Base" Color Table's index 0
    color = colorTable2(0);                        <-------- Swap the current texel color to the new Color Table's index 0

  if(color == colorTable1(1))                    <-------- Compare current texel color to the "Base" Color Table's index 1
    color = colorTable2(1);                        <-------- Swap the current texel color to the new Color Table's index 1

  .....for each index......

  return color;                                       <-------- Set the current texel color to be drawn
}

Of course if you're looking to do something like this it requires some prerequisites:
- C and C++ coding knowledge
- DirectX, OpenGL or some other graphics API
- HLSL or GLSL or other Shading language
- Basic game engine

If you are not a coder some of the more "Game Maker" type programs also support Shaders.
I know that MultimediaFuison2 HWA does. Not sure what other programs do.
There is a few decent packs of Shaders that you can download for MMF2.
But if you want to make your own you'd have to learn HLSL or some similar shading language.

I want to do another post about how to do quick palette swaps in Graphics Gale.
But I'm off to eat lunch.
And knowing that it is, we seek what it is... ~ Aristotle, Posterior Analytics, Chapter 1

Offline 9_6

  • 0010
  • *
  • Posts: 416
  • Karma: +0/-0
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #21 on: March 16, 2012, 08:22:00 pm
Why are you bombarding him with all that complicated, unnecessary stuff? This is pretty scary for a newbie you know.

You do not need color tints or even shaders for sprites to work on multiple backgrounds.
Making sprites stand out from the background is even a desired thing in games.
You have to keep the balance between standing out and still looking coherent.

I'd suggest you make an actual background to see how that works out.
You may just find out that your fear of this sprite not being able to work on multiple backgrounds is unfounded.
« Last Edit: March 16, 2012, 08:25:43 pm by 9_6 »
Does scaling an image blur it?
Opera fix Firefox fix

Offline Charlieton

  • 0010
  • *
  • Posts: 167
  • Karma: +1/-0
  • awkward dancer
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #22 on: March 16, 2012, 09:18:37 pm
Why are you bombarding him with all that complicated, unnecessary stuff? This is pretty scary for a newbie you know.
While true that it's a bit out of place for this particular thread, I still found it to be an interesting read. I'm glad he wrote it! ;D

I want to do another post about how to do quick palette swaps in Graphics Gale.
Please do!
Det skulle vara lätt för mig att säga att jag inte gillar dig, men det gör jag; tror jag

Offline PixelPiledriver

  • 0011
  • **
  • Posts: 997
  • Karma: +6/-0
  • Yo!
    • View Profile
    • My Blog

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #23 on: March 16, 2012, 09:57:07 pm
Quote
Why are you bombarding him with all that complicated, unnecessary stuff? This is pretty scary for a newbie you know.
Knowing more stuff can never hurt you.
I'm a graphics programmer doing dev work on games so I'm able to elaborate on such topics.
I was more responding to this sort of side conversation:

Quote
I would hope I wouldn't have to change the tint for every level.
Quote
Of course, most game engines will easily allow you to tint your sprites through code anyway, so you actually *could* tint your sprites to match their environment if you wanted to.

rather than offering an art process solution to working with his sprites.
Just sharing some info on what is possible.

Quote
Please do!
Cool. I'm actually rather sick so it'll take me a bit to put it together.
And knowing that it is, we seek what it is... ~ Aristotle, Posterior Analytics, Chapter 1

Offline PixelPiledriver

  • 0011
  • **
  • Posts: 997
  • Karma: +6/-0
  • Yo!
    • View Profile
    • My Blog

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #24 on: March 16, 2012, 11:23:55 pm
Here's how I work with Indexed colors in GraphicsGale.

Start a new file and draw some stuff.
This is your dude:


Then you'll want to put your image into an Indexed color mode:


If you select a color and edit it with the color sliders it will change the color anywhere it is used in the image:


But this will act as the palette for the entire animation.
So let's set an option that allows each frame of animation to use its own palette:


Now add some new frames:

I like to use the Hotkeys:
1 - Copy frame
2 - Paste frame to the right
They are simple and accessible. But it's up to you.

Now when you edit colors they will be isolated per frame:



More Hotkeys:
Q - Previous frame
E - Next frame
That way we can jump between them quickly.

The preview window will be flashing all of the color palettes like crazy.
If you find the Preview window annoying you can pause it:


Save your work. Make a backup. Eat a sandwich.
When you're done if you really want to see them side by side you have to change back the color mode:


Then export the frames:


and you'll get an image like this:


Notes:
A lot of the UI shown has been edited to be more compact.
It will look similar but not exactly the same in GraphicsGale.
You can start drawing in one of the Index Color modes right from the start if you like.
And knowing that it is, we seek what it is... ~ Aristotle, Posterior Analytics, Chapter 1

Offline BowTieDaddy

  • 0001
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #25 on: March 16, 2012, 11:36:55 pm
Oh, interesting.  It's good to know that changing the color scheme and comparing it is that simple.

I'll have to work on backgrounds in general at some point in the future, but for now I can try to move away from the gray to a blue or something else inoffensive.  In terms of sketching I have much more experience with characters than with backgrounds/objects, so that's going to be a trial in and of itself.  Probably won't come until I have basic strategies to get my sprites coherent-looking under my belt, though - even animation is looking pretty foreboding from here, haha.

Thanks for all the help, everyone!

Offline 9_6

  • 0010
  • *
  • Posts: 416
  • Karma: +0/-0
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #26 on: March 17, 2012, 12:55:20 am
Eyes are shaped like this:
(> )
So the iris isn't flat. You should consider than when shading.
You could also add more contrast into it and do some hue shifting because you tend to stay on the same hue for each ramp which looks kind of monotone.
Does scaling an image blur it?
Opera fix Firefox fix

Offline BowTieDaddy

  • 0001
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #27 on: March 20, 2012, 07:11:33 pm
Edits on the eyeball, as well as edits on that new knight:





Tried to take the shading and coloring comments I got into account on both of them.  The pupil of the eyeball isn't quite as highlighted as some of you suggested, but everything I tried made it less sharp and so less emotive, which I'd like to avoid.

I'm thinking a simpler style (a la the eyeball and the sort of direction the knight is going) is going to satisfy me most, so I may have to see what I can do with the old knight.

Thanks!

Offline BowTieDaddy

  • 0001
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile

Re: [WIP] Action-platformer sprites from a complete beginner

Reply #28 on: March 27, 2012, 02:55:49 pm
Going to assume the lack of comments means I'm on the right track, so I started on my next set of projects.



I also did the run cycle for that eyeball, but unfortunately I didn't realize I had to buy the full version of GraphicsGale to save as .gif, so I'm going to have to wait a little tog et the money to upgrade so I can show that.  In the meantime, I'm fairly happy with this one, but I think some of the shading is off and I'm having a hard time on the hair.  Looking at it as I've just posted it, the frizziness definitely isn't working, so I'll have to find some other way to make it work.  The face is also a concern - having a hard time cramming all those features on there, haha.

Thanks!

EDIT: had a burst of creativity today and figured out how to solve some of those problems.  Here's a redesign:

« Last Edit: March 28, 2012, 12:39:23 am by BowTieDaddy »