Curious, Cylinder-like Room?

Neoclod

Member
I remember years ago there was an example in this forum where someone looped a room on itself like a cylinder.
I was wondering since that example is not here anymore would anyone have any idea how that effect is made?
Like would it be using a Surface? I can't seem to figure it out so, hopefully someone can point me in the right direction. I apologize if this is not in the correct subthread.smallroom.png
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
I remember @TheSnidr made two versions of this effect called "Outside Tower" and "Inside Tower" respectively (depending on if you were inside the cylinder or not). This was back in the GM7 days (2009-2010), so I'm not sure if the source code would work today (and having a shader for it would be much more efficient). Not sure if there's still an official upload of the files, but I might be able to dig up my old TheSnidrCollection zip file if they're lost to the ravages of time. (But see if you can find an official upload first - knowing the names should make it a lot easier).
 

Yal

šŸ§ *penguin noises*
GMC Elder
A tower effect with a shader wouldn't be too hard...
  • start with the default shader you get when you create a new shader
  • see that line that sets up gl_Position ? That's a 3-element vector (x, y, z) (or potentially 4-element, where the fourth element is a boolean determining if it's a direction or position).
  • It's obtained using a multiplication the GM WORLD_VIEW_PROJECTION matrix, which means it's in screen coordinates. (WORLD goes from object to world coordinates, WORLD_VIEW from object to camera coordinates, and WORLD_VIEW_PROJECTION from object to screen coordinates)
  • You want to map this value to a cylinder, so just apply some trigonometry and overwrite the position value with a new cylinder'd value, using the old gl_Position coordinates as input. You'd want a "current rotation" uniform, and probably also a "how many degrees per room pixel" uniform to affect how tightly things are wrapped.
Set the shader before drawing stuff (Draw Begin, perhaps?) and unset it at the end of the draw event and it should affect the entire room, draw GUI elements in the Draw GUI event so they don't get contorted.

I'm not well versed enough in how screen coordinates work to offer any good advice on HOW to do the triogonometry, sorry x3
 
Top