Projection mapping a Construct game

0 favourites
  • 6 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi!

    I would like to do some projection mapping with a Construct game and I'm wondering what might be the best approach.

    The difficulty is that regardless of the angle between the projector and the surface, the game visuals need to be mapped accurately to the target.

    First I researched dedicated projection mapping tools that would allow you to use a browser window as the input. But that doesn't seem a common feature even in the paid programs like Madmapper.

    The I started looking at the possibility of mapping the Construct game output directly using only Construct. I had some success with the browser object's "set css" action, where I target the canvas element and give it a transform:matrix3d() transformation. But the difficulty is making the matrix transformation easily controllable in a corner pin type of fashion (I'm hoping to drag four corner sprites that would control the mapping).

    Any thoughts or possibilities that I might be missing here?

  • Pardon my ignorance but wouldn’t this be something that’s commonly handled by the projector itself? Like when you place the projector you tweak its settings so the image isn’t distorted on the wall?

  • Pardon my ignorance but wouldn’t this be something that’s commonly handled by the projector itself? Like when you place the projector you tweak its settings so the image isn’t distorted on the wall?

    Most projectors do indeed have some keystone correction controls, but they are usually not accurate enough and they don't have a wide enough range to really work well enough. That's why most projection mapping programs have additional corner pin type of controls, to get the content mapped to all kinds of surfaces really accurately.

    I was able to get the images to "almost" line up using just the keystone correction feature of the projector (when the projection angle was very standard) but there was still a big enough discrepancy between the target and the projected graphics which made it not really usable for accurate work.

  • This is definitely usually done by the hardware. If not, it makes more sense to do it on the operating system/graphics driver level.

    If you insist on doing it at the application level, mesh deformation/distortion would probably be able to do what you want. I'd approach it by pasting the entire viewport to a (flat) drawing canvas, then distort the drawing canvas to achieve the desired keystone effect.

    No idea about the details though.

  • Almost every other solution would require at least three software programs running at the same time to handle this. It becomes quite complex to manage.

    For example, in order to get this to work with Madmapper, there would be:

    -Construct

    -Madmapper

    -OBS studio or something else to send a live stream of the game window to Madmapper.

    If we can do it directly in Construct, the whole process becomes so much more simple.

    Here is one of my attempts, which is not super far away from being useful. It demosntrates that the entire game canvas can indeed be transformed using only Construct in-game controls:

    drive.google.com/file/d/1wOeKA8nZKgDd-gfivf33nN7tgOtpdXhp/view

    Just note that in that version the drag and drop stuff is not working, instead you select a corner pin with the mouse and use the up and down arrows to change a parameter, which then transforms the entire canvas.

    Where I have the most difficulty is with mapping the corner pin positions correctly to the matrix3d transforms.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct maps touch and mouse coordinates from the screen into layout coordinates. If you transform the canvas those will be off. In concept you can get the mouse coordinate on the screw and transforming it by the inverse of the matrix and take that and map it to layout coordinates. But that’s more low level so you’d end up only being able to use touches and clicks and get coordinates with your own math. The devil is in the details though.

    My other thought is if dragging changes the distort you may run into the issue of it running away from you as you drag. Could be better to have the dragging done on something that doesn’t get distorted.

    Anyways just some thoughts.

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