simplex Posted September 5, 2013 Share Posted September 5, 2013 It sounds like you've got it right though I've never expressed it in those terms so I may be overlooking. How I would phrase the process: Prior to being processed by the buildanimations.py script, the build specifies the size and offset of a symbol, an anim keyframe specifies a transform matrix for a symbol. An animated object is a clump of quads of those particular sizes in the build, which are first offset by the value in the build (to change the reference point), and then further transformed by the animation. The quad is then UV mapped to a subtexture in its atlas, but that has nothing to do with the transformation of the geometry. The script crunches down some of that directly into build.bin but that's the gist of it. (Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.) I see. Yes, that's what I meant with it (I just have a tendency to think in terms of maps and algebra). But in the animation, which gets applied first, the matrix or the translation? I'm assuming the translation gets applied last, so that it has the semantics of a projective transformation: but I'd like to be sure. (Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.) You mean... they're a simplicial approximation? (sorry, I couldn't resist ;P) Link to comment Share on other sites More sharing options...
KidneyBeanBoy Posted September 5, 2013 Share Posted September 5, 2013 Ugh. Me see shiny flicker knowledge box type things on flickerbox light colour thingy. Makes Kidney's head hurt. 1 Link to comment Share on other sites More sharing options...
TheHockeyGods Posted September 6, 2013 Share Posted September 6, 2013 Ugh. Me see shiny flicker knowledge box type things on flickerbox light colour thingy. Makes Kidney's head hurt. I read this several times and never understood a word other than the last four. Link to comment Share on other sites More sharing options...
TheDanaAddams Posted September 6, 2013 Share Posted September 6, 2013 (Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.) Aha~!So that's why we sometimes get strange 'chunks' missing from textures - they're being applied to a sort of auto-generated funky-geometry plane... not just a 2-tri poly-square as you would expect. Link to comment Share on other sites More sharing options...
tehMug Posted September 6, 2013 Share Posted September 6, 2013 Aha~!So that's why we sometimes get strange 'chunks' missing from textures - they're being applied to a sort of auto-generated funky-geometry plane... not just a 2-tri poly-square as you would expect.My head hurts even thinking about how they put animations together. Link to comment Share on other sites More sharing options...
realitymeltdown Posted September 7, 2013 Share Posted September 7, 2013 (edited) So I'm obviously not with klie, but I've looked at the binary files more than any sane person ought to, so i think I can answer some of those lingering questions... The build files are written as a series of 2 triangles, and each and every file I checked makes a square out of 6 vertices. They're tightly clustered around the build image where possible - I assume so they can pack more symbols into a single texture file. So if you wanted to draw over the original image using an existing build you can get cut off due to the boxes the build file uses even when the total texture file has miles of space. Take for instance, seeds. The build file actually draws the seeds using 3 boxes - one from the bottom to top in the middle, and two smaller ones on each side (about 2/3rds the way up). The way it's laid out in the texture, though, has more space. The other detail in the build file is the center of an object. This might make sense if you watch the spriter intro video (see http://youtu.be/Y5PBw4aCVNQ) since he demonstrates putting a center of rotation in and then spinning. Animations use entire symbols - so those 3 boxes for a seed become a single square when the animation rotates it or moves it around (just how spriter treats your single image file). That image is then rotated, scaled and skewed around the center of the build and then translated in each frame. To my knowledge, nothing is "planes" - that applies to 3D animation. This appears to be just rectangles copying from a file into memory, then skewing, scaling and translating that rectangle into the video buffer (all 2D operations, but probably using your computer's 3D capable video card). They get depth by sequencing operations - not because they're using a full 3D geometry. As I recall, polyplanes do stuff like mapping a checkerboard unto a cylinder. That keeps it from looking stretched and off but it doesn't make sense for any work on a flat surface. I could be massively wrong - been a long time since I studied computer animation. Edited September 7, 2013 by realitymeltdown Link to comment Share on other sites More sharing options...
simplex Posted September 7, 2013 Share Posted September 7, 2013 (edited) The build files are written as a series of 2 triangles, and each and every file I checked makes a square out of 6 vertices. They're tightly clustered around the build image where possible - I assume so they can pack more symbols into a single texture file. So if you wanted to draw over the original image using an existing build you can get cut off due to the boxes the build file uses even when the total texture file has miles of space. By series do you mean a sequence or are you implying a "sum" operation (justaposition, topological sum, etc.)? And by "series of 2 triangles" do you mean triangles of dimension 2 or are you counting them? Do you know what's the operation mapping the vertices (the 0-skeleton of the simplicial complex, if you will) to the triangles? They get depth by sequencing operations - not because they're using a full 3D geometry. Yes, within an animation depth is simulated by an ordering sequence. The world itself is 3D, though, and the anims are treated as slices of planes in it for the sake of depth testing (that's why depth testing got completely screwed over when I was trying to offset an anim at the Lua level, for the Snail King mod). As I recall, polyplanes do stuff like mapping a checkerboard unto a cylinder. That keeps it from looking stretched and off but it doesn't make sense for any work on a flat surface. I could be massively wrong - been a long time since I studied computer animation. The concept is the same, whether we are talking about plane regions or 2-surfaces. In math terms, what matters is that they're locally diffeomorphic to the plane (and that normal vectors are well defined and don't vanish, except possibly in a set of null measure, such as 1-dimensional boundaries). Things like mapping a checkerboard onto a cylinder are just a consequence of the existence of such triangulation, by the simplicial approximation theorem. Edited September 7, 2013 by simplex Link to comment Share on other sites More sharing options...
realitymeltdown Posted September 7, 2013 Share Posted September 7, 2013 I've tried running the sampleprefab for the preview and it didn't seem to work.The individual image files got errors like:ERROR: Could not run 'C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\compilers\..\buildtools\windows\Python27\python.exe C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\compilers\compiler_scripts/image_build.py "C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\..\..\dont_starve\mods\sampleprefab/images\inventoryimages\myprefab.png"'!Might be due to the mix and match forward and back slashes. The animation didn't appear to get compiled either - when I removed the myprefab_build.zip it breaks on startup (missing asset) and removing all the files inside didn't work either.I tried manually compiling it, but got ERROR: Invalid number of arguments! As for the rest, this thread's got way too much math already - not stuff that'll help anyone use these tools! We could discuss elsewhere if you're still intent on digging into it... as far as I can help anyway. Link to comment Share on other sites More sharing options...
simplex Posted September 7, 2013 Share Posted September 7, 2013 As for the rest, this thread's got way too much math already - not stuff that'll help anyone use these tools! We could discuss elsewhere if you're still intent on digging into it... as far as I can help anyway. Yes, the topic did diverge from "animation tools" to "a survey on the mathematical underpinnings of Don't Starve's animation subsystem". That would fit better elsewhere. But I don't see it as that off-topic, since it's a discussion that comes from the anim tool not being cross-platform and from its inability to edit existing animations. 1 Link to comment Share on other sites More sharing options...
realitymeltdown Posted September 7, 2013 Share Posted September 7, 2013 (edited) Here's some handy, free options to make images and get them into Spriter:Install GIMP http://www.gimp.org/Install a plugin to export each layer as a PNG: http://registry.gimp.org/node/28268Unzip it to "C:\Users\<username>\.gimp-<version>\plug-ins\export_layers.py" Open GIMP, and hit new.Make an image whatever size you want to work with (512x512 is plenty of space)Put each part on a unique layer. Since they're each on a layer, you can line everything up and be sure everything fits togetherTrim each layer using "Layer->Autocrop Layer"Go to "File->Export Layers...."Type "png" into the "File Format" boxChose "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\<your_mod>\anim_source\<prefab_name>"Hit "Export Layers"Use the defaults, hit "Export"Open Spriter.Use "New Project"Select your "anim_source/<prefab_name>"Animate in spriter! If you want to put your files in various places, I recommend making some .bat scripts to copy them from one space to the next so you can just click your way between each checkpointxcopy /s "C:\<path>\<your_mod>" "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\<your_mod>\anim_source\<prefab>"You can also use command-line utilities; including halting if there's an error so you can read the problem. This script uses my (now unneeded) animation binary converter, takes the output (if there's no error) and zips the result (using the free 7z) and puts it into DontStarve's mod directory:cd C:\DontStarve\BinaryConverterDontStarveBinaryConverter.exe outputIF %ERRORLEVEL% NEQ 0 PAUSE7z a -tzip "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\binaryconverter_sample\anim\sampleanim.zip" "C:\DontStarve\BinaryConverter\output\*"IF %ERRORLEVEL% NEQ 0 PAUSEAnyway; hopefully all that comes in handy for anyone who wants to iterate quickly on all this, even though i can't test animations in the game itself. Yet Edited September 7, 2013 by realitymeltdown 1 Link to comment Share on other sites More sharing options...
Malacath Posted September 7, 2013 Share Posted September 7, 2013 I thought I was dreaming when I saw this thread :') I'm so happy those tools have finally made their way to us modders, Thanks a lot!I was immediately trying it and downloaded spriter, created some animations. I did everything the way it's described in the first post, but I always get the same error: "ERROR: Invalid number of arguments!"I hope it's just me being stupid... Link to comment Share on other sites More sharing options...
debugman18 Posted September 7, 2013 Share Posted September 7, 2013 (edited) I thought I was dreaming when I saw this thread :') I'm so happy those tools have finally made their way to us modders, Thanks a lot!I was immediately trying it and downloaded spriter, created some animations. I did everything the way it's described in the first post, but I always get the same error: "ERROR: Invalid number of arguments!"I hope it's just me being stupid...Make a folder inside of your mod folder called 'exported' and make folders inside of it for each Spriter project. This should probably be cleared up in the main post. When you run the game, everything should automatically be exported as the proper name.zip, atlas-0.tex and all. Also, there seems to be an issue with resolution. Edited September 7, 2013 by debugman18 Link to comment Share on other sites More sharing options...
Malacath Posted September 7, 2013 Share Posted September 7, 2013 (edited) Make a folder inside of your mod folder called 'exported' and make folders inside of it for each Spriter project. When you run the game, everything should automatically be exported as the proper name.zip, atlas-0.tex and all.Sorry I wasn't clear, I would like to convert my stuff without running the game. That's not working. EDIT: And are you sure that your image actually has a better resolution than that? Or did you maybe scale up the images in Spriter? Edited September 7, 2013 by Malacath Link to comment Share on other sites More sharing options...
debugman18 Posted September 7, 2013 Share Posted September 7, 2013 (edited) Sorry I wasn't clear, I would like to convert my stuff without running the game. That's not working.If you'd like to do it without running the game, do everything above, except instead of running the game, go to the mods tools folder, and run autocompile.exe and it will convert everything. Edit: Yeah, the resolution of the images themselves is fantastic. And in actuality, I slightly shrunk the images in Spriter. Edit 2: Actually, I'm not sure anymore. The textures used replaced the spider queen perfectly, but when I put them into Spriter, everything is very small. Edited September 7, 2013 by debugman18 Link to comment Share on other sites More sharing options...
simplex Posted September 8, 2013 Share Posted September 8, 2013 If you'd like to do it without running the game, do everything above, except instead of running the game, go to the mods tools folder, and run autocompile.exe and it will convert everything. Edit: Yeah, the resolution of the images themselves is fantastic. And in actuality, I slightly shrunk the images in Spriter. Edit 2: Actually, I'm not sure anymore. The textures used replaced the spider queen perfectly, but when I put them into Spriter, everything is very small. That's quite awful. Not only were they downscaled, but the resizing filter adopted was quite poor. This looks like linear interpolation. Link to comment Share on other sites More sharing options...
realitymeltdown Posted September 8, 2013 Share Posted September 8, 2013 (edited) So the small size looks like the texture mapper. I made my images up to 256 by 256, but it's packing them into 128 by 64. It then comes out to half size... It's hard to tell if the animation widths look right - I notice many of the old parameters are left off (which means I fiddled with them for no reason) Edited September 8, 2013 by realitymeltdown Link to comment Share on other sites More sharing options...
debugman18 Posted September 8, 2013 Share Posted September 8, 2013 So the small size looks like the texture mapper. I made my images up to 256 by 256, but it's packing them into 128 by 64. It then comes out to half size... It's hard to tell if the animation widths look right - I notice many of the old parameters are left off (which means I fiddled with them for no reason)So the converter is resizing everything when it makes the atlas? Link to comment Share on other sites More sharing options...
ScienceMachine Posted September 8, 2013 Share Posted September 8, 2013 I really need some help with making clean sprites ... Link to comment Share on other sites More sharing options...
realitymeltdown Posted September 8, 2013 Share Posted September 8, 2013 So my original png file is 512x512 (in case it's a power 2 thing).The actual content area is roughly 180x140. The build xml file produced says 512x512. When I open the resulting texture file, and save it to a png using the tex converter - I get a file 512x 256, with my image roughly 67x48. Since there's two images, I they're spaced really far apart - makes me think the power 2 was a bad idea and I'll go back to autocroping layers. Link to comment Share on other sites More sharing options...
Developer Cheerio Posted September 10, 2013 Developer Share Posted September 10, 2013 The pipeline currently half sizes all textures and internally all art is made at double resolution. I'll look into disabling that for you guys . Though I'm not quite sure why it's using such a poor filter. 1 Link to comment Share on other sites More sharing options...
TheDanaAddams Posted September 10, 2013 Share Posted September 10, 2013 This is good to know - I usually work at double-resolution, and half-size it when I'm done.Will have to remember not to shrink my things before I save them, hehe. Link to comment Share on other sites More sharing options...
Developer Cheerio Posted September 10, 2013 Developer Share Posted September 10, 2013 I thought I'd share some comparison images with you guys. I took Wilson's original hair image and I pushed it through Spriter with scaling turned on and off. When scaling is turned off, the image looks much closer to the original source hair image but with scaling turned on, the image looks like the regular in game hair. We scale the images to save memory. Right now I'm inclined to keep the pipelines consistent but I'd love to hear people's feedback. Here is the original image: Here it is without scaling: Here is is with scaling:And in regards to what looks like your point filtered sprites, I'm not sure what's going on there but if you're willing to post your spriter project along with the accompanying images, I'd be more than happy to take a look. Sorry about the trouble. Link to comment Share on other sites More sharing options...
simplex Posted September 10, 2013 Share Posted September 10, 2013 @Cheerio I think leaving scaling off would be best. That way a modder has the option to choose their own program and filter to do the resizing, knowing that the game will preserve the end result. Link to comment Share on other sites More sharing options...
TheDanaAddams Posted September 11, 2013 Share Posted September 11, 2013 I think the three things I want most right now for the animation pipeline are:1 - a resize filter that doesn't make everything look... awful.2 - support for Spriter's bones.3 - a Mac (and Linux) version. I really hope that at least 1 and 2 can be implemented soon. Strange, though... when Cheerio converted the Snowmonster files, they seemed to compress nicely...Is there something you're doing that others aren't?Because the poor Beanlet came out like this:http://forums.kleientertainment.com/index.php?/topic/26501-up-and-away-mod-collaboration-thread/page-77#entry318695 1 Link to comment Share on other sites More sharing options...
Developer Cheerio Posted September 12, 2013 Developer Share Posted September 12, 2013 I converted it at home by downloading the mod tools and starting the game so it shouldn't be any different. Is the beanlet posted somewhere for me to try? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now