don't click here

Reverse-engineering raster effects

Discussion in 'Technical Discussion' started by Sonic 65, Jun 26, 2018.

  1. Sonic 65

    Sonic 65

    Tech Member
    (I made this topic to ask about an effect in a specific game, but if anyone else wants they can piggyback and use this thread to ask about others.)

    Does anyone know exactly how Dracula X on SNES gets that awesome fire effect on the first stage? Badly upscaled image:


    It seems to be applying raster animation to a static "fire image" (basically, selectively repeating or omitting vertical strips), in addition to additive blending. But how, exactly?

    I'm trying to replicate the effect for a level in my game (on PC, but sprite-based at 240p). This is the closest I've got so far (background of the stage removed):


    Not nearly as smooth or cool-looking!

    And the code for how I'm producing the above:

    Code (Text):
    2. double stripY = 0;
    4. for (int i = 0; i < flameHeight; i++) {
    5.     double pct = i / (double)flameHeight;
    6.     double time = counter / 8.0;
    8.     double inc = Math.Cos(pct * 3.14159 * 8 + time * 0.5);
    9.     inc = (1.0 + inc);
    11.     stripY += inc;
    13.     // render horizontal strip at stripY, advance one line down
    14. }
    ...where the counter increments every frame.

    I could step through an emulator and figure out the effect myself, but it's been years (going on half a decade??) since I've looked at any assembly, and I have zero experience with the SNES hardware. So I was wondering if anyone here knew about this.

    Thanks for your time!
  2. Overlord


    Now playable in Smash Bros Ultimate Moderator
    Long-term happiness
    Silly question, but are you sure it's not just a form of Mode 7 sprite manipulation?
  3. Sonic 65

    Sonic 65

    Tech Member
    I asked over at SNESdev: -- a guy gave me a tip and it looks great now.


    No Mode 7, just good old fashioned raster effects. It could've been done on the MD (in fact, I wonder if it was somewhere...)

    (The guy inside the robot suit is, of course, Dustin Wyatt. Or at least you can pretend he is.)
  4. 360


    Light Vision Overdrive Oldbie
    United Kingdom
    Sonic Neon
    The new fire effect looks visually stunning - even beyond the assumed capability of the hardware as it looks that good - and your game looks amazing. Excellent work.
  5. Sonic 65

    Sonic 65

    Tech Member
    Thanks man!! You can follow the game here:

    We released a video about this time last year, but development's been slower since then (mostly focusing on assets). But as you can see, it's finally picking up again!
  6. Ritz


    Subhedgehog Member
    That's... Actually one of the coolest games I've ever seen? Holy shit. That's like 2½ stars on How many artists are working on this?

    Glad to see you're still around too, it's been a while!
  7. Sonic 65

    Sonic 65

    Tech Member
    One consistent sprite artist, and a revolving door of background artists -- 2 artists at any given time, and 4 overall. (5 if you count the original artist, when it was still an 8-bit game. His work has since found a home in Cyber Shadow, and I have to say, that game puts his assets to much better use than I ever did.) Surprisingly, it hasn't been too bad keeping things cohesive; you can 100% notice the stylistic differences if you place the art for different areas side by side, but when playing the game it'll feel seamless.

    We also recently hired a composer. I was originally handling all the music myself, but it got overwhelming (the OST is over 20 tracks) and I wasn't satisfied enough with some songs. The DC theme in the above video has since been replaced with a collaborative track I like way more, for example.

    And yeah, it feels like an entire age ago when I was really active on these boards! I have a lot of nostalgia for the old Sonic games, and this forum was a key part of my early teen years, but I don't have much interest in the franchise anymore (barring a complete reinvention with hand-drawn HD 2D art, or someone finally finding a Sonic 1 beta after 20 years of this community searching). It's hard to believe I was 15 when I made DWEA...
  8. Felik


    The steel rope gimmick is pretty sweet. Glad you upgraded graphics.
    Character seems to run really slow though
  9. Hukos


    It reminds me of the Gorgon background from Thunder Force III.

    Obviously not as detailed as yours, but it looks like a raster effect to me.
  10. Cooljerk


    NotEqual Tech, Inc - VR & Game Dev Oldbie
    I see this was never fully explained, but the way the fire trick works in Dracula X is by changing the vertical scroll value per scanline. If you, for example, set multiple scanlines to have the same vertical scroll offset, it will stretch and morph the fire in that way. It is in essence the same trick as the horizontal sine wave pattern of the background, only instead of changing the HScroll settings per scanline, you are changing the VScroll setting.

    A modern equivalent of the effect can be had by messing with UV coordinates on a texture in GPU memory. Such a thing can be done pretty trivially in a shader, taking the Y position of the resultant pixel on screen and using it for a seed to index into a table of sinwave values, with those values mapping to different V-axis texels in the texture in memory. Similarly, the conventional sinewave scrolling effect and be recreated using the X position of the pixel on screen, mapped to an index into a table of sinewave values, mapped to different U-axis texels in the texture memory.

    Regarding if it was ever done on the genesis -- this is how title screen "scaling" works in Gunstar Heroes. The difference between the SNES and Genesis in this regard is that the SNES can change vscroll per 1pixel column in certain screen modes, while the genesis can only ever change vscroll per 8-pixel columns.
    • Informative Informative x 2
    • List