DTO 2.0 Devblog 1 - A change of hands
No! Down To One is not changing hands as you might be thinking, but this devblog details some of the changes I've been making to the various systems in DTO for its biggest overhaul yet, including graphics, viewmodel (including your hands!), and new main gamemode.
Viewmodels in Unity
One of the biggest issues with Down To One 1.0 is the characters hands. In DTO v1, I used a multi-camera setup, with a second camera that only renders the characters hands and weapon. The disadvantages of this:
After experimenting with command buffers and tweaking the multi-camera setup, I ended up with DTO V2's solution to this problem: A 'simple' shader edit. Now, whenever a renderer needs to be rendered in front of anything else, a few things happen:
An issue popped up with this: The characters feet would render on top of everything as well. This was fixed by the addition of a script that can be added to any renderer+material to tell the material never to get "first-person'ed".
Also, the custom projection matrix was not as easy as calling GL.GetGPUProjectionMatrix in Unity, as for whatever reason, it does not return the actual values that the shader uses. So, a C#-side conversion from OpenGL into DirectX Viewmodel has to be made to un-flip it and correct it:
public void SetCustomProjMatrix(Camera fromThisCamera)
{
var projectionMatrix = GL.GetGPUProjectionMatrix(fromThisCamera.projectionMatrix,false);// fromThisCamera.projectionMatrix;
if(isDirectX)
{
for (int i = 0; i < 4; i++) {
projectionMatrix[2, i] = projectionMatrix[2, i] * 0.5f + projectionMatrix[3, i] * 0.5f;
}
}
Shader.SetGlobalMatrix("_CustomProjMatrix", projectionMatrix);
}
Now, let's look at the benefits of this approach:
So, it's definitely a win. Also, something that could've technically been done in DTO v1 was the FoV of the first-person camera changed to be smaller, which really makes it look like a proper FPS:
New
Old
Stay up to date on Twitter for more devblogs @DownToOneGame.
:dtoDanger: