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#)

Short intro of us 💕✌️

We're an eletro duo based in Seoul 🇰🇷 Heavily influenced by the 90s.

Our new album #Xennials is all about the nostalgia of that era 💽 CD listenin 📟 beeper beepin 💾 floppy disks floppin days 😎

Stream now! 🎧

https://open.spotify.com/album/3YwWhnHWVy5cA8XOpbaGRA?si=8E9awqU…

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

Fan art for Foolish I'm feeling kinda better so I drew this

What do you think guys in my robot?Just a beginner in 3d modeling..

My instagram https://www.instagram.com/rojhonbb/

The Darkside Detective: A Fumble in the Dark is out TODAY! 🖱️Advanced pointing, clicking action 🖨️Very funny words! Loads of them! 👻6 sarcastic, spectral cases to solve

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.