Vertx » thom_cat_

Better KeyCode Property Drawer

Keycode GUI, especially on Windows, where large enum/string fields require tedious scrolling, can be improved. It’s simple to rebind keys in a game, so I used the same theory here to allow for “rebinding” KeyCodes. This current drawer doesn’t support Shift or Shift-modified keys through “rebinding”
Read More ›

Unity – Time PropertyDrawer

I wanted an attribute to display time values so I coded one. It should cull irrelevant larger input fields if your specified maximum is lower than the values required in them. The usage is with floats that represent seconds.
Read More ›

Unity – Draw Better UnityEvents

Draw smaller UnityEvents when they’re empty:
Read More ›

Unity – AnimationCurve.Lerp

If you’re looking for a lerp for AnimationCurve take mine! During the development of some extremely specific animation work in Unity I had the need to write this code. I also made AnimationClip.CopyTo and AnimationClip.Lerp but they’re probably even less useful!
Read More ›

Unity – Projection Mapping

I wrote a curve-based solution for projection mapping inside of a Unity build. The solution can map using custom Arc and Bezier Quads, and is interactively drawn and edited. [work in progress gif] Finding an XY position on curve-based Quads turned out to be remarkably complicated; not as simple as just taking a curve on X, and going up it Y amount. But instead it requires interpolating between the X max and X min curves: Y amount, and the Y max and Y min curves: X amount, then finding the intersection between the two resultant curves. The outcome was a fish-eye camera that could be mapped using arcs and re-mapped to a room using bezier curves whilst projecting onto a dome mirror. If I had more time later on I would tidy up a lot of the remapping process. It already went through one round of streamlining: changing the remapping process from corner-edge-face creation to face-merge; but I would have liked to perfect the transition between mapping screens, add curve serialisation, and remove the manual UV mapping (manually flipping the values until faces are correctly oriented). The tool will not be provided on request (as it is unfinished and extremely context-specific), but I am […]
Read More ›

Unity – Improved SceneView Camera

Overview: The FreeCamera solution comes with two modes for operating the scene-view camera in Unity: Free (Trackball) and 6Axis. Free (Trackball): Inspired by Modo’s trackball camera I took a day to write a Unity solution. The trackball should override Unity’s scene camera rotation when enabled. Describing how it works is a little hard; there’s a cross centred in the middle of the viewport that gets weaker the closer to the corners you go. If you’re in the middle of the vertical part you can rotate over and under by dragging down and up. If you’re in the middle of the horizontal part you can rotate left and right. Dragging around the edges will roll the camera. All these work in tandem, increasing and decreasing based on the distances from the cross lines and edges. 6Axis: Six-axis mode realigns the scene-view’s “up” to an appropriate axis when the camera tilts over 90 degrees. This effectively creates a default scene camera that can view the scene from any direction. Still incapable of rolling the camera in use, but able to roll when you look “too far” up or down. Interestingly when changing axes close to 45degrees you may feel like there’s issues of intention vs reality, this is […]
Read More ›

Unity – Line Rendering Alternative

After admiring the graphics of my Tunnel I wanted to mirror the aesthetics in a ‘real’ world, instead of an abstract visual. I used GL.Lines in the Tunnel, manually positioning them on the CPU; seeing as I had the positional data already from the Tunnel itself, I wasn’t worried about this. But for a large scene this is infeasible. Luckily Unity has different mesh topologies I can use to hold this information. A normal mesh doesn’t purely preserve a silhouette in its geometry; there’s edges of quads and triangles that aren’t what I would like to see. A method to generate silhouette edges that I use for a simpler game I’m making (one who’s only geometry is cubes and tetrahedrons) is to extrude the edges I want to draw towards the origin. Then in script I can just ask which edges don’t share a vertex on the origin, and add them to the indices array. But having to frequently revisit a modelling tool to make edits to wireframes seemed daunting, so I spent a day making a quick tool to bake the right edges to be created before or after runtime. I can now manually allocate edges where a line will be created. […]
Read More ›

CRT Shader

For our game during Tigjam Australia 2015 I created a CRT shader in Shader Forge. It features alterable screen distortion, RGB strips, scanline effects, chromatic aberration and a slider for the overall effect.    
Read More ›