Door Segment Animation

Decided to take a look at the door segment scaling issue. The way I hide away the door segments into the frame of the door is by scaling it in the direction of movement.

Here’s what it looks like slowed down:


Here it is without scaling:


I could just leave it this way without scaling and simply hide the door segments in the surround walls, but the problem is sometimes the surrounding walls are orthogonal to the door, like this:


Not to mention the floor…

Anyway, I looked into seeing if I could resolve this by using a shader that makes the parts of the door that protrude transparent.

However, this ended up being much more complicated because of the edge detection shader.

If the object is rendered in the transparent queue, it’s rendered after post-processing, but this means you can see the edges of other objects through parts of the object that are opaque:


In the above image, it’s supposed to be stripes of transparency – the white parts should be opaque and you shouldn’t be able to see black edges through it.

But if I render the object not as part of the transparent queue, but before post-processing, the outline of the object itself gets drawn. Notice that an edge is drawn along the part that is supposed to be transparent:

Obviously, I don’t want to see the outline of the door segment that’s protruding.

Another approach that I thought would work would be the replace the door segment with a single box with a texture applied on top, and then offset the texture based on how much scaling was done.

However, that had the same issue with the edges. The door segment with the texture (float in front) looks very different than the actual door:


Some people on twitter suggested simply modeling and animating the door in a 3D software, and have parts that nest into each other as the door goes into the frame. This would work.

However, I thought about it some more, and I don’t think it’s really an issue I need to worry about. The scaling seemed very obvious in the gifs I posted mostly because time was slowed down quite a bit. In the game, the door opening happens in 0.3 seconds. It’s literally a fraction of a second, and given that players are usually standing some distance away when the door opens (because they’re pressing a button or putting a box on a switch), the scaling effect would be hardly noticeable.

You can see the door in action in the gif below, in which I demonstrate cubefruit regrow and destruction (that happens behind the camera), working with the traveling light path and the door switch in a perfect loop:


The door opening is so quick I don’t think it’s anything to worry about at least for now. If it really proves to be a problem later on, I’ll just get a 3D artist to animate it with the suggestion above.




  • Facebook
  • Twitter
  • Tumblr
  • LinkedIn
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • RSS

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>