0 Favourites

Faux 3d

  • Saw this post on Reddit for a voxelish method to simulate 3d:

    Its fairly easy to do, however there's a lot of overdraw, and I remembered Ashley had a go at an optimization to help with that:

    But it was a no go.

    So I was wondering if it's time to have another go at it, or perhaps we should look for a shader method to help?

  • That is really cool. Would be interesting to see this done in c2.

  • Someone did it in c2 allready

  • It really needs its own object type to pull it off.

    In theory, you could just draw it in Paster, but object management would be a nightmare, not that a bunch of sprites pinned together is terribly manageable to begin with.

    Of course Canvas can't do webgl so it's pretty much off the table.

    On the other hand, Paster can only do rectangles.

    No collision detection in Paster, or Canvas either.

  • might be doable in a shader if you can access some data that represents the voxels/etc, then interpret that to draw the pixels, but you would need to also draw them at the correct angle, so you'd have to rotate the data around, etc(because you can't rotate it after it gets drawn since it has illusion of another perspective).. seems kind of tricky, and I'm not sure how complex a shader can be.

    edit: also another issue is how to keep the illusion that objects can intersect each other (layers sliding between layers of other objects)

    at some point you essentially are trying to build a 3d simulation, so you might want to just work with 3d methods.

  • Someone's made a slicer for MagicVoxel:

  • pretty neat!

  • Someone's made a slicer for MagicVoxel:

    nice.

    Too bad that this is pure hell to import/manage in c2. Imagine importing an animated model. c2's sprite/animation system isn't cut out for this sort of thing.

  • Add frame> Import frames > From sprite stip

    I haven't checked, but C2 should automatically replace duplicate frames in its spritesheet export, per object.

    So animating it that way should be doable.

    Then you should be able to animate via events, but yeah it would take some extra effort.

  • I think the matrix transforms will be a bigger issue if anyone plans on doing some type of game using objects like this for scenery.

    Here we go with the trig again......

  • It doesn't look too bad. Generating the graphics would be the hardest to do. Drawing layer by layer or using a voxel editor are a couple options. Personally I think It would be cool to just slice up textured 3D objects, but I haven't seen a workflow to do that yet.

    The graphics would probably need to be lower resolution to keep the video ram usage low.

    Rendering using multiple instances for every frame isn't so bad. Probably just a matter of zordering everything by frame. The rotation may take a bit of math, but it's not bad either. Animation is just more images and isn't bad, maybe a couple more events.

    Now the paster plugin could be used to cut down on the number of instances needed and the amount of things to be drawn. The static scenery could all be drawn to a paster per layer that way you only have draw those and the moving objects per frame.

    Another plus of using the paster object is all the rotation math isn't needed.

    Besides that the vertical squish can't be done with vanilla C2.

    Collisions would be done in the same way as isometric. Everything is done from a top view.

    I'm not very proficient with shaders but I don't think they would be helpful here because for one you can't access more than one source image in C2.

    A plugin may work, but internally it would be much more complicated to make than with events imo. Not to mention it would be less flexible.

    Reenabling the "front to back" may give some rendering improvement but at the same time the paster plugin wouldn't work with it, but that may be a small loss.

  • I'm currently using this trick to make a 3D dungeon - it's working very well so far. I can render about 5-600 of these 'slices' before the CPU usage starts climbing, around 1300-1500 before it goes through the roof. Work within the constraints and it's a pretty usable little trick for 3D fun Right now I've got a three-storey dungeon averaging ~20 rooms, made out of just 36 slices. Plenty of room left for enemies and particles. I'm even handling some collisions in 3D, to allow the player to clamber around the level - I've been amazed at how little these have added in terms of performance concerns. As Rojo points out, static scenery is comprised of single objects, which makes for a huge optimisation, and no limit on draw distances. I just use canvassnapshot to build my slices (not sure what Paster is!) with little to no problem.

  • I’ve got a tech demo up on the arcade for a 3-D platformer made with vanilla C2 (with license). It uses values for position and size in 3-D space to calculate collisions. Rendering is based on animation frames, Z sorting, and calculations that transform the 3-D coordinates to positions in 2-D space. A .capx is included.

    Click to play Blue Sky.

  • mrtumbles

    I'm curious, how did you make your assets, and did you go for a low resolution look?

    Also "paster" is a plugin that allows you to draw to it's texture.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • That's a cute trick!

    There is a lot to explore here with regards to rotating and displacing tricks to create perspectives.

    I have found that adjusting the luminosity of the parts helps distinguish it from other objects and conveying that 3d look.

    This is without the luminosity shading

    This is with

    I simply adjust the parts from bottom to top with gradually increasing luminosity..

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