Adding Fake Shadows to My Puzzle Game

LandenLove1 pts0 comments

Alpha Version 8 - Fake Shadows - Let's Learn! by LandenView all by LandenLanden<br>Follow LandenFollowFollowing LandenFollowing<br>Add To CollectionCollection<br>Comments<br>Devlog<br>Alpha Version 8 - Fake Shadows<br>Let's Learn! » Devlog

3 minutes ago by LandenShare this post: Share on BlueskyShare on TwitterShare on Facebook

Making Fake Shadows

In early versions of 'Let's Learn!', the sun was pointing directly downwards.

This allowed for the object's shadow to perfectly communicate to the player where it would fall. Additionally, it makes it clear to the player where and how a complex shape would fall onto another object below.

I loved the functionality that this setup provided, but it resulted in ugly dark shadows on the bottom of every object in the scene.

To make all the objects in the scene look better, I added proper lighting and replaced the 'drop shadow' from the sun with a simple 3D arrow to indicate where the held object would fall. It was important that we had SOME kind of indicator, because there is no depth information provided by the orthographic camera.

Although the 3D arrow worked OK, it did a poor job of communicating clearly HOW the object would fall. I decided to use this 3D arrow until I could come up with a solution that mirrored the functionality of the original sun-only design.

The solution came in the form of a SubViewport node used in combination with a Decal node.

Compatibility Decals

Because my export target is the web, I am forced to use Godot's compatibility renderer. This means that I am unable to use decals nodes. Thankfully, there is a community plugin created by antzGames that adds a DecalCompatibility node. There is a pull request to get decals working in the compatibility renderer.

The Solution

The setup is quite simple. When the player picks up an object, we create a duplicate of that object and turn it's material black. We also synchronize the 'shadow object' position and rotation with the 'held object' every physics frame.

We disable the shadow object's collision, and set it's visible layer mask to only layer 2. We have to make sure that layer 2 is disabled on the player's camera.

The SubViewport camera can only see meshes on layer 2. This means that it will only see our black shadow meshes.

The Final Result

Dynamic Camera Height

Objects have had dynamic height for awhile now. The camera, however, would never follow objects up slopes and other surfaces. I never really considered this to be an issue, because the camera is orthographic. If you want to see the top of something, just rotate the camera until it is looking directly downwards:

The problem is, players would never do this in playtesting. Quite often, they wouldn't even rotate the camera at all! Instead of trying to re-enforce the idea of rotating the camera, I decided to proceed with adding dynamic camera height.

Cleanup

Previously, all of the physics objects were individual scenes that I copy-and-pasted when I needed to create a new one. This resulted in lots of unnecessary busy work when I needed to add and remove features. Now, all physics objects are instanced from a single parent base_phys_object scene.

While I was re-making all the physics objects, I took the time to re-import all the 3D meshes as OBJ files instead of GLB files. I will be using OBJs for all future work in Godot. The way that Godot imports GLB files makes them super difficult to work with. OBJ files import 3D models as a simple mesh that you can use any way you would like to.

Finally, I removed some unused textures. One of which was the old background image that was used before the 3D scene was added. I didn't realize it, but that unused image was still using about 5mb of vram, despite the texture node being marked as invisible. I was able to see the vram usage in Godot's debugger under the 'Video RAM' tab.

That's all for now. Thanks for reading!

Let's Learn!<br>Learn English or Japanese while solving puzzles.

Add Game To Collection<br>StatusIn developmentAuthorLandenGenreEducational, PuzzleTags3D, Cute, Isometric, PhysicsLanguagesEnglish, Japanese

More posts<br>Alpha Version 7 - Let's Refactor! 6 days ago

Alpha Version 6 - Sounds and Visuals 26 days ago

Alpha Version 5 - Let's Break the 4th Wall! 33 days ago

Let's Learn... Japanese?! 35 days ago

Alpha Version 3 - A New Font! 38 days ago

Alpha Version 2 - More Sounds! 41 days ago

Alpha Version 1 Announcement! 44 days ago

Public Concept Version 10 - Refining Puzzles 57 days ago

Public Concept Version 9 - 2 New Levels! 59 days ago

See all posts

Leave a comment<br>Log in with itch.io to leave a comment.

itch.io·View all by Landen·ReportLet's Learn! › Blog

version object camera days alpha learn

Related Articles