User Tag List

Results 1 to 5 of 5

Thread: Reflecting everything on top of a surface

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reflecting everything on top of a surface

    Hello forum. I have bounced between different posts now, looking for a good shader for reflection. I found PixelThief's reflection effect, but as far as I can see, it works best with platform games, as it only reflects on a line.

    Since I am making a game with 8-direction movement, I need a way to reflect all objects on a certain type of floor. With PixelThief's reflection effect, you will end up walking closer and closer to the reflection, and eventually pass through it. I need it so that all objects in a certain area will always have the reflection below them, wherever they move on that type of floor. I didn't find any shaders/effects that did this, so I was wondering if anyone knew something that could help me? Maybe some sort of displacement shader or anything useful?

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What sort of viewing angle are you looking for? With an 8 direction movement it could be quite a few. If you have a "birds eye view", that is, directly from above the player stairing down, with no side view, for example in Legend of Zelda - Link to the Past, then 'reflections' wouldn't be very visible- the objects would be covering up the reflections entirely.

    Now if you have an isometric or 45 degree view, like most 2d jrpg games, for example Chrono Trigger, then having a *reflection* on the ground, so that you see a person reflected underneath themselves, is something you can't really accomplish through 2d pixel shaders directly. Its simple enough to offset each object if you've got a more or less standard height for all characters, so you could just shift the image down 32 pixels or something- but what makes it very difficult would be flipping this image upside down. To have the reflection, you'd need to invert the vertical part of each image. And objects standing in different places would need this texture to start at each of those places- you can't just take the texture of all "above" objects, and flip it upside down and move it a few pixels- only the object in the center would be in the right place, and all the other positions would be uncentered

    A much easier (and less GPU costly) way to accomplish this effect much more simply would be to create "false" or "pseudo" objects which are clones of all your main characters and whatnot, and have these positioned on the reflective ground right underneath each of their corresponding objects- you can even do clever things with layers to make these objects cut off at the edges. This won't help you with advanced particle effects and dynamic backgrounds and so on, but for just characters and enemies with a limited roster, its often the way its done in games.

    For example, in Castlevania on the GBA, I think harmony of dissonance or one of those, there were mirrors in the background in a few places- they'd simply have a second copy of the player sprite, set it at the proper animation and put it behind this mirror, instead of directly copying the texture (and then change this sprite to an enemy sprite who would jump out of the mirror and attack you)

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yes, I forgot to mention that the angle is about 45 degrees, and not straight-down bird view.

    I see. I didn't know it was that complicated, but I did think of making copies of each object and flipping them around (making a fake mirror effect). I figured there had to be a better way that was less CPU-demanding, so I asked here. Well, thanks for the reply. I will see what I can come up with

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, the alternative that sacrifices GPU for CPU, would be to apply a pixel shader to *each object* on the surface in order to create its reflection- especially if your shader included X/Y bounds to cut off the reflection at edges. But this is even more difficult because each object would have to have 'blank' space in every animation below its base/feet- the pixel shader can only modify the texture, not its size, so you can't place a reflection underneath any object any further than the bottom of its sprite. So you'd need to have that blank space, the boundary parameters, and either a preset ratio for every object's "real::blank" ratios to know where to start it, or a parameter for that, and then you'd need to program the entire thing as a pixel shader in HLSL, which isn't too intuitive if you don't know it already or aren't very familiar with C, and even once you've done it, the GPU constraints of doing so many different pixel shaders might wind up too slow to use for all you know

    So, possible maybe, but you'd probably be best off doing the 'fake mirror effect' Good luck

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Someone should make a reflection extension, where you can pick actives to reflect, and it then makes a copy of the active, flips it around, adds semi-transparancy, and positions the new object below the original object (with Y offset if the user wants it). Also, it would have to have an option to duplicate animations of the original object. If you could choose which objects to make reflections from (and making new objects instead of altering the original sprites), it would be doable I think. I know for sure that with reflective floors, MMF games would look much better. Think of firing rockets over a blank floor, watching the reflection as it goes from one side of the screen to the other

Similar Threads

  1. Surface Object
    By Looki in forum Extension Development
    Replies: 571
    Last Post: 8th November 2019, 07:19 AM
  2. Surface Extension
    By drnebula in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th January 2011, 02:02 PM
  3. Surface Object
    By imothep85 in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 2nd October 2010, 06:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •