Can Construct do this yet? (Car mirror in 3d) how?

0 favourites
  • 4 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi guys as you can probably tell this is just a 2D overlay UI on top of a 3D environment. I was wondering if Canvas could project a second camera to give off this effect.

    This is from a game called Carmaggedon released in 97.

  • Canvas doesn’t seem suitable for that. Try pasting 3d stuff onto it and see that it has no zbuffer so it looks wrong.

    Anyways I’ve seen people do mirrored floors by duplicating the 3d stuff below.

    Another guy did portals by using a mask and duplicating the 3d stuff behind the mask. He didn’t post an example though so you’d have to experiment in that area. It doesn’t seem like it would work but I admittedly don’t understand some subtleties of constructs renderer

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Fiddled with it a bit and here are my findings.

    There isn't a way to render a scene from a different camera angle in the same frame. If we could there is probably a way to calculate where we'd position the camera from the mirror. The second issue is the drawingCanvas doesn't work with 3d meshes since they have no zbuffer and it doesn't seem to transform 3d relative to itself. We could render one frame from the mirror, save that with canvasSnapshot, and render the next from the game camera, but that is slow and would flicker annoyingly.

    What we can do is duplicate the objects and position them in mirrored locations behind the mirror. We'd want the duplicate objects to only be visible in the mirror so one idea is to have the duplicate objects on a layer with force own texture and have a mask sprite over the shape of the mirror to limit drawing to that area. If all the duplicate objects are behind the mirror this should work fairly well. It will be a problem if any part of the objects are in front of the mirror since the masking will fail then. We can improve that by not duplicating objects that aren't in front of the mirror or culling by a view frustum through the mirror. Still to better fix it we'll need to clip the individual polygons by the mirror, but this requires all your meshes to be done with a distorted sprite per polygon.

    The masking sounds like it should work, and does in the simple mirrored floor case, but I'm curious if we may run into issues with wall mirrors or something.

    Anyways here's a semi-simple floor mirroring test by duplicating things.

    dropbox.com/scl/fi/tg6b00a8oeaiuwaaw7i5u/floor_mirror.c3p

  • The masking sounds like it should work, and does in the simple mirrored floor case, but I'm curious if we may run into issues with wall mirrors or something.

    Anyways here's a semi-simple floor mirroring test by duplicating things.

    https://www.dropbox.com/scl/fi/tg6b00a8oeaiuwaaw7i5u/floor_mirror.c3p?rlkey=h70lqijh99j88m5i92unydzta

    Yeah something like this was my theoretical solution as well but if I had to theoretically duplicate the entire level for a mirror effect I imagine that wouldn't be a very efficient use of memory.

    I'll consider doing it with a smaller draw distance. Thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)