Merging New Renderer With Main Project

Hey Folks! Started work today on merging the experimental renderer with the main project, and so far making steady progress.

There was a fair bit of blind work as I started copying over the necessary code and assets, and figuring out where the new stuff should live. I had some old procedurally-generated shadow mesh code that I could replace with the new square light-blockers I'm using. And the old Unity light prefab could be replaced with the new line-of-sight light component.

I even managed to delete a few old classes and assets that were either never used or redundant now with this renderer. And I can see a fair number of additional ones that are worth looking into.

But the main thing was to get something rendering, just to see where we are. And today's screenshot shows two views into that progress.

The right side is literally the first thing I saw once the project was compiling again. It's the starting area without any lighting or shading. Just pure sprites. It was actually quite shocking to see after all these months of moody lights. And it also reveals one of the first major concerns: z-sorting.

If you look closely, you'll notice some floor and wall squares are missing. And my hunch here is that the sprites render in random order, similar to the crew in the sample scene I was using before I fixed it. In theory, I think I can adjust each of these items to render at a time based on their height above the floor, and that should fix it. (Basically, what I did for the crew sprite in the test case.) If that doesn't work, though, this could be a problem.

The left side of the image is what I'm seeing in the ship editor, now that I've fixed a few things. We have normal-mapped, lit floor tiles behaving as they should with a light where the white box is. UI and tile overlay sprites are all rendering and in the correct place. There was an alignment issue between them at one point, but it was solved when I adjusted the game's resolution to match the camera render textures. (Which I think I can fix permanently if I generate the render textures by code once the app launches.)

What's more, I was able to place and delete items in the scene without adjusting the input/mouse handling code. So it seems that position info isn't going to be a problem. Yay!

However, as soon as I placed that white wall in the scene, everything went dark. Or more specifically, dark until I moved the light far enough away when the floor once again appeared with dim, distant highlights.

I think what I'm seeing here is a scaling issue. The shadow blocks I added to the items might be off by some scaling factor, and adjusting the data accordingly might be all that's needed.

Overall, though, not bad! I have yet to test out the actual gameplay mode, so there's always potential for surprises. But this is more progress than I expected by this stage. Looking forward to tomorrow!

Tags: Ostranauts