I'm trying to leave the second dimension and finally make a 3d game, but I'm having a hard time coming up with a way to implement a certain concept. I am trying to make a flat object which would "stick to walls." It's a bit difficult to explain, so I'll just add a picture here. enter image description here The way I see it, there are a few parts to this problem. Firstly, how would I specify which edge on one polygon leads to an edge on another? Secondly, how would I make sure that the object never gets excessively deformed when on a corner of 3 or more edges? (As in, how do I assure the gaussian curvature always stays as 0) And thirdly, how would I split the object along the two surfdaces it's on without having a ton of polygons?

I'm not sure what engine I'll be programming this in yet, because as I said, it's my first foray into 3d, so if responses could either just explain concepts or use pseudocode, that would be optimal, but if you want to use examples from a specific language it'll work.

Thanks in advance for anyone who wants to respond!

  • \$\begingroup\$ You should start with something simpler if you start 3d \$\endgroup\$
    – Bálint
    Dec 5, 2016 at 12:49
  • \$\begingroup\$ Most games don't actually do this, take Portal 2 as an example. They had gel physics in that game, but it wouldn't wrap around corners. \$\endgroup\$
    – Krythic
    Dec 6, 2016 at 0:47

1 Answer 1


A popular technique to handle this is called projection. Shadow mapping and decal placement are popular use cases of this.

A few good tutorials are on http://rastertek.com/tutdx11.html (see shadow mapping and projective texturing)
How do I create a decal system? for more info

  • \$\begingroup\$ The projections warp shapes as they're projected onto objects, allowing for distortion, but I'm looking for something more like a sheet of paper or some other thin material sliding over an object. \$\endgroup\$ Dec 5, 2016 at 17:42
  • \$\begingroup\$ ah you mean more a physics sim. So you could definitely use this technique to create a moving object that simply follows a path along the stairs (or whatever you want) and project it on there. You can do some more math to keep it from shrinking/growing (reverse/ignore depth). Another option is to create a primitive fluid sim where you have a bunch of voxels/blobs following a path and just hug the surface under them \$\endgroup\$
    – CobaltHex
    Dec 6, 2016 at 2:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .