Textured sprites

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Textured sprites

Post by BlackBulletIV »

kikito wrote:
Lafolie wrote: You could use no input texture but instead have a function that takes these values and draws a template texture and works this out for you.
I'm sorry, but this doesn't help me to understand what you were saying neither. Right now it sounds to me like BlackBulletIV asked "how do I do xx?" and you answered "you have a function that does xx".
Oh good, I'm not missing my brains then.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Textured sprites

Post by Lafolie »

Right, let me attempt to explain a little better, haha.

At the moment it's taking RGB values from the 'model' image and using them to 'grab' pixels from the 'texture' image. Instead of grabbing pixels from a loaded image, you could create a new one and write pixels to a new imageData, then output that to a file, thus you will have created a template texture map for your model.

The model is fairly simple to create. It's just a silhouette with a depth-map of sorts. If you have talent using Photoshop or something similar and are confident in your artistic ability, then it should be obvious that creating the model is easy.

Is that better? :neko:
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Textured sprites

Post by BlackBulletIV »

So let me get this straight. You're creating a texture based off the map? How would you then specify what colours go where on the texture? I'm pretty confused; as I said before, a code sample would help a lot. But anyway, it doesn't really matter, I get how the texturing part works.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Textured sprites

Post by Lafolie »

I'm too busy to sit down and write the code right now, but basically, replace all the [read pixel] commands with [set pixel] commands so that it would draw a template map for you. It's pretty obvious/simple, I must be explaining it really terribly haha
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Textured sprites

Post by BlackBulletIV »

No worries. I think I get what you're saying now, it creates the separate areas of the texture for you and then you color them in or something? But that still doesn't eliminate the tediousness/difficultly of creating a proper placement map.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Textured sprites

Post by Lafolie »

BlackBulletIV wrote:No worries. I think I get what you're saying now, it creates the separate areas of the texture for you and then you color them in or something? But that still doesn't eliminate the tediousness/difficultly of creating a proper placement map.
After creating a few, I'm pretty sure you'd start to figure it out and be able to work efficiently with them. Practice man, practice.

EDIT: Alternatively, you could make a Löve drawing app, or even one that loads a bunch of images and allows you create composites with a 'live preview' sort of thing. Perhaps if you tried enough you could even manipulate an existing sprite and stretch/morph it to fit, although that would be heavy stuff given the current functionality of Löve.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
lizard
Prole
Posts: 16
Joined: Wed Aug 04, 2010 6:38 pm
Location: Thailand

Re: Textured sprites

Post by lizard »

Lafolie wrote:Not at all. It's a matter of working backwards really. You could write a function that draws an input texture map template and you're all set.
backwards
OMFG, man, you are genius! At this weekend I will try a reverse algorithm. Thank you for suggestion!
EDIT: second look - hmm, but the texture will be distorted - on rendered sprite we don't have a correct texture coordinates.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Textured sprites

Post by Kadoba »

Wow this is awesome. I still can't completely wrap my head around it though.

I made an animated version of lizard's example.
animated_textured_sprite.love
(21.03 KiB) Downloaded 218 times
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Textured sprites

Post by BlackBulletIV »

Kadoba wrote:Wow this is awesome. I still can't completely wrap my head around it though.

I made an animated version of lizard's example.
animated_textured_sprite.love
Looks good mate!
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Textured sprites

Post by Lafolie »

lizard wrote:
Lafolie wrote:Not at all. It's a matter of working backwards really. You could write a function that draws an input texture map template and you're all set.
backwards
OMFG, man, you are genius! At this weekend I will try a reverse algorithm. Thank you for suggestion!
EDIT: second look - hmm, but the texture will be distorted - on rendered sprite we don't have a correct texture coordinates.
Thanks! And yeah, it will be distorted. It would take some experimenting to get it right, but at least you have a template to work from, better than a blank canvas eh?
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests