Page 2 of 4

Re: Textured sprites

Posted: Thu May 19, 2011 7:40 am
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.

Re: Textured sprites

Posted: Thu May 19, 2011 7:49 am
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:

Re: Textured sprites

Posted: Thu May 19, 2011 8:49 am
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.

Re: Textured sprites

Posted: Thu May 19, 2011 8:56 am
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

Re: Textured sprites

Posted: Thu May 19, 2011 10:32 am
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.

Re: Textured sprites

Posted: Thu May 19, 2011 11:41 am
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.

Re: Textured sprites

Posted: Thu May 19, 2011 5:31 pm
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.

Re: Textured sprites

Posted: Thu May 19, 2011 7:44 pm
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 217 times

Re: Textured sprites

Posted: Thu May 19, 2011 8:35 pm
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!

Re: Textured sprites

Posted: Thu May 19, 2011 9:39 pm
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?