RenEdit - A WIP Image Editor

Discussion in 'Work in Progress' started by renex, Jan 2, 2017.

  1. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    [​IMG]

    Hi. I'm making a clone of the GM image editor in Studio, with some more features. I liked using it but Studio has had a persistent off-by-one bug that just makes it unusable to me. I also don't like opening an entire project just to draw something.

    I will keep this thread updated with the latest binary (once one exists) and use it to collect feedback too.

    Planned feature list:
    • Basic drawing functions + additional geometry tools
    • Better selection system
    • Primitive layering and blending support
    • File-backed infinite undo
    • Primitive animation editing
    • Palette tools
    • iunno lol
    Currently working on:
    • Getting the interface layout and design sorted out
    • Rectangle tool has a bug and needs a different method
    Completed features so far:
    • Pencil smoothing
    • Drawing precision
    • Blend (premultiplied) and Replace drawing modes
    • Color picker
    • Panning
    • Resize handles
    • Export and import from gif / ico / jpg / png / bmp / tga / psd / dds using ImageMagick
    • Rectangle tool
    • Line tool
    I just got pencil smoothing working. Here's a test drawing:

    upload_2017-1-2_16-30-7.png

    It will draw straight lines (blue) when you're moving slowly, for precision, and use cubic splines on fast lines to make them smooth. Here's mspaint for comparison:

    upload_2017-1-2_16-31-6.png

    Here's a rough mockup of the general interface.
    mockup.PNG
     
    Last edited: Apr 20, 2017
  2. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Update 2

    upload_2017-1-10_17-26-42.png

    I worked a bit more on the underlying engine, got smooth layered blending working and also a replace mode.

    Also added some button art and a placeholder layout. Smooth zoom is working, resize handles aren't.

    Color picker. Magenta slider is alpha.

    GIF.gif
     
    Gamerev147 and Lycanphoenix like this.
  3. Yanevski

    Yanevski Member

    Joined:
    Dec 18, 2016
    Posts:
    9
    Wow that's pretty amazing! The color picker movement is so smooth.

    Keep it up! ;)
     
    renex likes this.
  4. John Andrews

    John Andrews Living Enigma

    Joined:
    Oct 28, 2016
    Posts:
    277
    Gonna look it up... looks cool

     
    renex likes this.
  5. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Update 3

    Took me a few days and a shader, and I got resize handles working.

    The shader draws the dotted rectangle.

    GIF.gif
     
  6. RichHopefulComposer

    RichHopefulComposer Member

    Joined:
    Jun 20, 2016
    Posts:
    1,372
    I want to make my own image editor in a few months, and was thinking of maybe using GM to do it, so this is very cool to me. Good work! =D
     
    renex likes this.
  7. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    I got several new features in. Spent a few hours creating precision-fixed versions of GM's shape drawing functions and now I've got a really smooth line tool going.

    I also stress tested the program and it didn't die at 6000*3500. Nothing particularly worrisome concerning performance based on just sheet size. Haven't got panning yet, as dumb as it is, so I was unable to test bigger sheet sizes.

    [​IMG]

    Added a size picker for sizes 1-32, with an option to input your own size for a basic circle shape.

    upload_2017-1-17_0-42-47.png
    I reworked internals to use a texture as brush to allow better control over them for upcoming functions. It did make things a tad bit slower but I could optimize that later if performance became pressing matter. This also made possible a shader that draws an inverted outline of the current drawing brush. This gives extra precision on pixel works.

    GIF.gif

    I'm really happy with how this thing is turning out. It's almost functional enough for a test build.

    Next up:
    • Loading images
    • Eyedropper
    • Figure out infinite undo
     
  8. Rusty

    Rusty Member

    Joined:
    Jun 21, 2016
    Posts:
    198
    I know that .gif is just an example of what your editor can do but you missed a pixel on the right hand side and now that I've seen it it's driving me crazy.
     
    hippyman, Rivo, Lukan and 1 other person like this.
  9. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    upload_2017-1-18_1-18-36.png

    Today I made a lot of progress.
    • New graphics and things behave more nicely to clicks.
    • I drew a logo for it.
    • Can save and load to 8 formats - PNG, GIF, BMP, JPG, ICO, TGA, DDS and PSD, using ImageMagick through Samuel Venable's ExecuteShell.
    • Proprietary file format .REN used to store additional information in the future (setup will add required registry information).
    • The transparent checkerboard will now automatically guess a good color scheme. Will have an option in the future.
    • Replace drawing mode now uses a shader to allow for the new bitmap brushes.
    • Zoom is now locked to powers of two to prevent horrible blockiness until I figure out a good way to AA-out the jags.
    • I still haven't figured out the goddamn pan function.
    upload_2017-1-18_1-32-13.png
     
    Last edited: Feb 9, 2017
    Lukan likes this.
  10. Lycanphoenix

    Lycanphoenix Guest

    Yeah, I wanna keep up with this development. There are quite a few features I'd like to see, but they'll have to wait for the time being. I wanna see where this goes first~

    I'd suggest taking a look at Paint.NET when you get the chance, that might give you some inspiration.
     
    renex likes this.
  11. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Last time I got panning working properly, but the zoom still isn't working how I want it to be - centered on the cursor, and not on the screen.

    I also got started on undo - I already have a backup system to make sure the surface is not lost, and the undo functionality extends on that. I'll be adding trim checks aswell to make sure only the necessary data is saved.

    I got rectangles working too, using a modified version of the selection rectangle shader. However, since it's a shader, it's suboptimal. I'll be converting the rectangle tool to use a dynamic mesh instead.

    I use paintnet ;) I'll be pulling selection features from that.
     
  12. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    I haven't been doing much in any of my projects, but today I had a nice breakthrough here.

    I got tired of the imprecision of gm's line drawing and just decided to write low level line drawing in gml. I converted some pseudocode of the Bresenham algo and optimized it for game maker, then modified it to use the brush system already in place. This solves all issues with line drawing forever, and lines are as precise as those from mspaint.

    I also removed catmull-rom. If it's always enabled, drawing small segments causes slight imprecision. If I only enable it during sharp strokes, visible seams appear where the engine transitions from linear to catmull-rom. So I decided to switch to a simpler method of taking averages:

    upload_2017-3-24_5-54-47.png

    Since this isn't a quadratic spline, it doesn't overshoot the original line, avoiding imprecision on short lines while also providing a small level of smoothing for longer/quicker lines.
     
  13. Lycanphoenix

    Lycanphoenix Guest

    Will this tool use its own rescaler, instead of the crappy one built-in to GameMaker Studio?

    Look up xBRZ, RotSprite and Amortized Super Sampling, you might be able to create a good manual rescaling tool by combining those. It would also help a lot with the "Animation -> Rotation" function, because that one just kinda sucks (terrible resulting image quality, as well as a bumpy offset). The Amortized Super Sampling component itself wouldn't improve visuals over regular Super Sampling, but it would improve performance and memory usage over regular Super Sampling (which is a component of the RotSprite).

    Also, there is a website called GML Scripts. You should check it out; they have a ton of useful things pertaining to graphics. They're all free to use, so not only could you use them as part of your image editor's code (giving appropriate credit), but even bundle the scripts themselves alongside your editor so that they can be used in-game.
     
    renex likes this.
  14. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Yes. I have already performed research on this and have achieved similar effects to Rotsprite in tests. I call it RotKeks. I will be researching an iterative statistical model for downsampling which doesn't create new colors, but even with nearest neighbor it is already creating rather satisfactory results.

    rotkeks test.png

    Oh yes I know them. The drawing engine went through many iterations using components from there, but over time I replaced these scripts with completely custom code optimized for my specific use case.

    upload_2017-3-24_14-39-3.png

    Right now I'm not using anything from them, not even in design. Besides, my editor is going to be a standalone tool, not a merge component.
     
    Last edited: Mar 24, 2017
    Lycanphoenix likes this.
  15. Lycanphoenix

    Lycanphoenix Guest

    RotKeks, that's a funny name ^.^
    I'm guessing that it already uses a half-pixel offset. Can RotKeks be used in Real-time as well (like in an emulator), or just when editing a sprite beforehand?

    I'm going to keep my fingers crossed for a standalone RotKeks GML/C++ package.
     
    renex likes this.
  16. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    It's a three pass process right now so that'd be a little bit on the heavy side for realtime.

    I'm not skilled enough in shaders to concatenate two passes of AdvMAME2x into a single shader, but that would allow it to be done in only two passes. If I could then add the supersampler into it, it would become a single pass.
    Not exactly. Considering the distortion from the two passes of upsampling, the only way to preserve the original shape without rotation is to use a slightly smaller offset. I've experimentally determined that (0, 0.5) gives the best results with rotation.
    I guess I could put it on the marketplace! Even if it's not possible to do in realtime, an extension can easily manage textures for baking the first two passes.
     
  17. Lycanphoenix

    Lycanphoenix Guest

    Been quite a while. Still looking forward to seeing this image editor (especially RotKeks) in action.

    I often wonder if RotKeks could be used in Texture Filtering for a 3D engine as well (I'm tired of low resolution textures in old games becoming a complete blurfest on newer hardware)... The memory requirements would likely be insane, though, as would the computational requirements. Like you said previously, it would probably be much better suited as an offline utility.

    However, while it probably wouldn't save on memory all that much, one possible way to save on computational resources for use in real-time sprite rotation might be to store the initial upscaled image (before calculation) and all the final sprite rotations (as they are calculated) in a cache, and reusing them by calling upon that cache as demanded.

    Be sure to read up on both Attentive Transmission and Array Set Addressing when you get the chance as well.

    In a nutshell;
    Attentive Transmission can potentially save on storage space of both high resolution images and animated sprites by generating what are essentially Mipmaps, and then storing the lowest-sized Mipmap of a single frame along with the differences in Laplacean between each larger image and between each frame of animation. Reconstruction is Lossless, but does have some computational overhead (however, it does claim it can also reduce computational costs when combined with other algorithms, but that would require further experimentation).
    http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.33.2933&rep=rep1&type=pdf

    Array Set Addressing on the other hand is handy for hexagonally sampled images. While that wouldn't improve performance in this particular field, it could probably see more benefit from rotation algorithms than the rectangularly sampled images that we are used to.
    http://ufdcimages.uflib.ufl.edu/UF/E0/04/23/19/00001/rummelt_n.pdf

    With regards;
    - Amaroq.

    P.S.: I hope I haven't come off as too pushy or demanding. Sometimes I just need to let what is on my mind be heard by others.
     
    Last edited by a moderator: Jul 27, 2017
    renex likes this.
  18. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Those are interesting things. I haven't had time to read them fully but I appreciate the interest.

    I haven't been working on this since I ran into some pretty major issues with my shader pipeline. I'll have to restructure most of the internals because the way I had it working I couldn't chain shaders and I kinda need that if I want my line drawing to be precise and still support advanced blending. I wrote a shader that draws rectangle borders, and was working on another that drew circle borders.

    Rotkeks is currently a multipass method, because I use two stages of upsampling and then one of downsampling. This makes it impossible to do in realtime since a combined shader would end up being too complex. So I was going to include it as a static image tool. I do have a working demo program that caches the supersampled image, as you suggested, and I was going to use that to preview the result as you use the tool.

    With my classes restarting monday and a new job taking up my schedule, I just don't think i'll have any time left to work on it. Interest is also very low... I'll probably never get used to the gms2 image editor so i'll definitely come back to this though. I've been a bit too invested into the fangame on my signature aswell since it has somewhat of a community around it. Haven't really had the energy to invest into more projects in a long time.
     
  19. sitebender

    sitebender Member

    Joined:
    Sep 13, 2016
    Posts:
    780
    Does it have layers? Make it have layers.
     
  20. renex

    renex Member

    Joined:
    Jun 23, 2016
    Posts:
    506
    Yeah, layers will occupy the space under colors.
     
  21. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    320
    Well, fukume! I can't even grasp how one start building software in GM:S. My mind was blown when I saw Pixelated Pope software for making Look Up Table for palette swapping and now this...
    I haven't seen any tutorials how to even start software building. Closest thing I'm getting is by making my own in-game room editor.
    Mad skills, bro!
     
    renex likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice