Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a better sprite format #697

Closed
Jon0 opened this issue Jan 14, 2017 · 6 comments · Fixed by #1317
Closed

Create a better sprite format #697

Jon0 opened this issue Jan 14, 2017 · 6 comments · Fixed by #1317
Labels
area: assets Involved with assets (images, sounds, ...) improvement Enhancement of an existing component lang: c++ Done in C++ code lang: python Done in Python code

Comments

@Jon0
Copy link
Member

Jon0 commented Jan 14, 2017

Converting from slp to png seems to lose some of the original information, which pixels are part of the outline, or which are real colours, or player colours.

For use in opengl or vulkan, we could save multiple layers per converted slp file:
1: Sprite plain colours as RGB
2: Player colours: mono (later replaced in shader, with player colour)
3: Outlines: mono (later replaced in shader, with player colour)

Maybe use a different format (can png save multiple layers in one file?)
or create a new format, probably just some container for png, and save to different files in conversion.

@TheJJ TheJJ added area: assets Involved with assets (images, sounds, ...) lang: c++ Done in C++ code improvement Enhancement of an existing component lang: python Done in Python code labels Jan 14, 2017
@TheJJ
Copy link
Member

TheJJ commented Jan 14, 2017

The information is not lost, instead, we encode it in the alpha channel.

We should try to keep common formats so that people can easily edit the files for modding.
An option could be having multiple files with suffixes like .._playercolors.png and .._outlines.png.
But this multiplies the amount of files by factor 3. This may also complicate things when editing.

A solution would be a "common" image format that supported 5 channels: (r, g, b, a, special).

@Jon0
Copy link
Member Author

Jon0 commented Jan 15, 2017

Ok I missed how the alpha worked. if the extra channels are all exclusive that works.
Maybe use alpha = c + base_pcolor with some constant c, for player colours, in case modified / custom png assets collide with the default player colours. Also how many colours should be given to each player?

They can be separated into layers when loading too. I'm not sure how to make shaders with outlines appearing in front. maybe the depth buffer could be used in reverse somehow.

Is the rendering branch still being used for this stuff?

@TheJJ
Copy link
Member

TheJJ commented Jan 15, 2017

First, draw the scene like normal. Then, as next pass for the outline rendering we can basically use a shader to draw just outline pixels with a fixed color if things are obstructed (aka inverted depth buffer).

Yes, my rendering branch is up to date and compiles. @Vtec234 has started to think about the new renderer architecture.

@TheJJ TheJJ added this to TODO in renderer Jan 30, 2017
@TheJJ
Copy link
Member

TheJJ commented Feb 6, 2017

Do you have a better idea how we can store the additional information without having multiple files per sprite?

@detrumi
Copy link
Contributor

detrumi commented Feb 6, 2017

We'll most probably need multiple files anyways, as we already have shadow textures in different files.

I don't think keeping every part of a sprite really helps, especially if you have shadows, animations, or multiple sprites in a single file.

Maybe we should use a standard naming scheme for different parts of the texture, and use a single folder for each sprite.

@TheJJ TheJJ moved this from general to input in renderer Feb 15, 2017
@TheJJ TheJJ added this to conversion in convert Apr 5, 2017
@TheJJ
Copy link
Member

TheJJ commented Feb 2, 2018

This is very related to #965, which proposes a new metadata format for sprites. This issue here is about the png image data.

@TheJJ TheJJ moved this from input to todo in renderer May 2, 2018
@heinezen heinezen moved this from conversion to in progress in convert Aug 22, 2020
@heinezen heinezen moved this from in progress to conversion in convert Aug 22, 2020
@heinezen heinezen linked a pull request Sep 9, 2020 that will close this issue
convert automation moved this from conversion to done Sep 23, 2020
renderer automation moved this from todo to done Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: assets Involved with assets (images, sounds, ...) improvement Enhancement of an existing component lang: c++ Done in C++ code lang: python Done in Python code
Projects
No open projects
convert
  
done
renderer
  
done
Development

Successfully merging a pull request may close this issue.

3 participants