Game
Project Luna
7 years ago

Camera update, transparency functionality


Hey, here comes a small update about our game camera.
As our game is 3D top-down and has a camera with a fixed pov, it’s more or less inevitable that the player character sooner or later will get obstructed by some other object in the world. The player might wander behind a wall, tree or whatever other thing that exists in the level, hiding the player character and creating frustration and less fun.

One solution for this is to do what many games do and move the camera past, or in front if you will, the obstructing object, moving it closer to the player. Obviously a bad solution for a top down game as the cameras distance to the obstructing object is so much further than the distance between the object and the player, making the correction of the camera very drastic and abrupt.

So the solution we use is the one most 3D top-down games use, which of course is to make the obstructing mesh transparent, in our case just adjusting the alpha channel of the relevant object. Below is an example of the effect in use.

5d0a824e91838.gif

The above result is achieved by sending out an raycast from the camera, which at hit tells the relevant object to adjust its alpha channel. Simple enough, and I think this works pretty well for a fast implementation, although it has a few drawbacks. If you notice in the GIF above, manipulating the alpha channel of an object also adjusts the shadow strength, which makes no sense from the player’s perspective. This is fixable by doing transparency with shader code instead, among other solutions I’m sure.
Another problem is my use of the raycast. It stops at the first object it hits, and only “sees” that first object, potentially ignoring other layers. So if two or more objects are obstructing the player character from the player’s view, only the first object will get told to get transparent, resulting in not making anything better for the player. One fix for this is to always send out a follow up raycast as long as some valid object is hit with the first raycast, and keep doing it to no objects is found by the outgoing ray.
But as time is scarce with this project, as always, I’m not sure what I’ll have time to fix, but at least I know what to look out for in the future.

Next up for me is to keep working on AI and also to implement the player character. That’s it for this time, see you later.



0 comments

Loading...

Next up

Emanuel Holm - Level designer (Blog 2#)

The final days of working with the project

My thoughts of being a level designer

Emanuel Holm – Level Designer(blog 1#)

Smile! Here, take some happy pills! ✨💊 #Blender #3DModelling #3DArt Buy me a Ko-fi: https://ko-fi.com/barbarafb_

Been working lately on lots of 'behind-the-scenes' boring stuff that no one really cares about, so here’s a guy playing the sax for some reason.

#screenshotsaturday

Successful landing

#screenshotsaturday

Heya! I wanted to show some gameplay progress i made so far. I hope you like it ^^

The whole squad is here!

Interested? Follow me!

Hi everyone! I started to create some environment props for my new video game, here is a cozy house in the forest. I'm planning to switch from Unity to Unreal... Let's see what new challenges I have to face. Made in Blender and Substance Painter.