My gamedev journey is progressing very slowly, but I’m happy to say it is progressing!
Back around two months ago, feeling all shiny and inspired after having built a tiny, insignificant, yet (to my noobly eyes) beautiful little level in Unreal Engine 4, I set out to build an interactive version of the building in my “Exploit Agency” logo. I figured this would be a perfect starter project. In it’s simplest form it’s just a big ol’ cube sitting on a plane. I could use it to learn all the basics: static meshes, coordinates and scale, textures and materials, lighting, player navigation, and so on. Once I had a simple version of the outer building done, I’d start on the interior. The inside of the building would require a great deal more planning and attention to detail, but by then I would have progressed naturally into the required skills.
I hit a snag on day one. It took very little time to set up my building (a rather large cube) and ground plane (a rather large, flat cube). I even made a quick ‘n dirty concrete material for the building. I was starting in on the windows and doors when I noticed something odd: the shadow cast by the building was… wonky. Instead of forming a neat, crisp line, the shadow was blobby, lumpy, and way too small.
I searched through various settings but couldn’t find anything that looked even remotely applicable to the problem. I tweaked this and that, tried rearranging and recreating the static meshes. Nothing worked. I moved on. When I finally came back to the shadow problem, I found things in an even worse state: my shadows weren’t lumpy anymore. They were just gone.
What the heck? This was one of those things that should “just work”, right? I couldn’t imagine which switch I might’ve flipped, what option I might have set that would have broken something so seemingly basic. The shadows looked fine while editing, but as soon as I built and ran the game, they vanished.
It was clear I didn’t understand some very basic, fundamental ideas. I imagined the problem had something to do with the way even simple objects in game engines have multiple layers of data: One for the shape itself, one for detecting collisions, and multiples layers of information in the material. I found an article on lightmaps on Epic’s sight, but then found more ideas I didn’t understand. Some of the terms were vaguely familiar—I remembered the idea of “UV” coordinates from my days tinkering with 3D modeling in AutoCAD—but I couldn’t translate what I was reading into a solution for my shadow problem.
That’s when I took a step back to focus on modeling for a while. I imagined that if I learned to import static meshes into Unreal from another program, I’d pick up the necessary skills and knowledge in the process.
I dove into Blender. It was a lot of fun—too much fun, really, since I got a little distracted learning how to use the Cycles renderer. But I got what I needed. Armed with a better understanding of UV’s and “unwrapping” meshes, I returned to the article on lightmaps and finally understood what I was reading.
The problem turned out to be an issue with lightmap resolution. This post is already running a little long, so I’ll post the details separately.
UV’s and Unwrapping
Modeling has changed a lot since I used AutoCAD back in the 90’s, and I never had any professional training to begin with. Back then, if I wanted to properly align a texture on a model, it would involve a lot of manual, experimental tweaking to get things just right. The idea of “unwrapping” your meshes so you can just lay them out flat on an image for mapping is pretty amazing. I’m sure it’s commonplace and boring for most people these days, but just try going without it.
The biggest lesson for me here isn’t technical. I probably could have worked through all this in half the time or less if I’d just reached out to others: Post a question on Reddit or the Unreal forums or some other community of gamedev folks. By going it alone, I burned up nearly two months. Sure, I picked up some valuable skills and knowledge along the way, but that would have come in its own time either way.
- Ask around for guidance on lightmap size. Is it more art than science? Even so, it can’t all be voodoo, divination, and luck. What factors influence whatever the “appropriate” lightmap size is?
- Build a few samples that show the effect of lightmap size. Maybe make a walkthrough video.
- Move on to game development. Avoid getting wrapped up (no pun intended) in modeling and materials by using geometric primitives like cubes, spheres, and cones with flat shading. Focus efforts on making an interactive experience.
February 10, 2016 at 9:00 am
The Problem you had with the shadows is the lightmap resolution of your ground actor, which is way too low. You need to tick “Overriden Lightmap Res” in the Details Tab > Lighting of your Ground Actor in the scene and set it to a very high value since your ground is stretched extremely far, so maximum would be 2048. ;) cheers!
LikeLiked by 1 person
February 10, 2016 at 11:25 pm
Thanks for the tip!
After reading up on lighting in Unreal, I experimented with different lightmap sizes, dynamic lighting, etc. I eventually figured out the basics, but it took a lot longer than I would have liked.