Speed up UE4 lightmap build times by 500%

For medium sized scenes, where you may have more render threads than objects in the scene, the trick to fast lightmap renders is to keep the lightmap resolutions even. But I’ve recently discovered the missing elements in my scenes that speed up my renders by 500%!

Let’s say for example you have a total of 24 cores to render your lightmap with and your scene is only 24 objects, as 23 of your objects are finished, the remaning cores are unfortunately not going to help out your remaining 1 objects, they will do absolutely nothing. Thus whether you have 4 cores or a million cores is not going to matter, if your entire build is stuck waiting around for this one remaining object.

One solution to the above problem is to break up your scenes into more objects, then as threads are completing their job they can pick up new objects to work on. However there are some cases where you just don’t want to break up your scene too much (for example for batching performance reasons). In that case one solution (or so I thought) was to cap lightmap resolutions.

If the entire scene is made up off 64 pixel lightmaps except for 1 object that has a huge 4096, then the entire lightmap render will have to wait around for that 1 map, since lightmap resolution is the main indication of how long an objects lightmap will take to render. With that said however, there was one problem.

Despite having capped all my lightmap resolutions to 1024, my lightmap built had to wait 20 minutes because of this one object: the floor of my scene. But why? The floor had a 1024 lightmap just as the other objects, what I didn’t take into consideration was unmapped texels!

Unmapped Texels: The Secret to Even Lightmap Build Times

As it turns out, as something like a floor is easy to UV map, the lightmap UV for the floor covered pretty much the entire 1024 lightmap (with it’s padding, only 3% was so called unmapped texels). The other objects however was significally more difficult to UV map due to the complexity of their shape (let’s say a sofa with cushions, for example), despite a carefully laid out UV, a whopping half of the pixels of that 1024 lightmap UV was actually empty space inbetween objects (to avoid mip map bleeding). Therefore all thought the resulting lightmap size was the same, there was significally more actual pixels rendered for the floor due to it’s lack of wasted gaps in the UV layout.

Therefore the floor took 3 times longer to build the lightmap for.

Since the “wasted” UV space of the complicated models are desired, the solution is simply to take the unmapped texels procentage into consideration when assigning lightmap budgets. So if you want the floors lightmap build to render as fast as that of the sofa, you could set the sofa to twice the resolution, or split the floor up into smaller peices.

Lightmaps for LOD’s in UE4

One of the confusing and undocumented parts of UE4 is how it handles lightmaps on items with LOD’s. Many ‘Answers’ has been that they don’t (that each LOD simply assumes similar UV layout and thus re-uses the lightmaps) but that’s simply not true. Just check your baked lightmaps yourself and you will see that UE4 generated a lightmap for each of your LOD’s.

Unfortunately there is no custom lightmap settings for each LOD. In my quick test it appeared that LOD1 was 66% size and LOD2 was 33% size, but is that perhaps depending on other factors, such as the distance values you set for each LOD transition? Who knows!

This confusion is highly annoying, because a lot of studios have a fixed asset pipeline where the artist needs to create a couple of LOD’s even if they feel the difference is small. For example imagine that you modelled a mint-condition carboard box, you find that the difference between the polycount in LOD0, LOD1 & LOD2 is negetable, then the extra lightmap space required for these might be way more expensive than what little performance you gain from saving a few polygons.

It’s funny how in modern games we can be so relaxed with polycounts since our graphics cards are getting so good with handling polygons, yet your lighting artist still have to make enourmous quality sacrifices to keep his lightmap resolutions down. Yet Epic doesn’t care about documenting or explaning much of what’s going on with the lightmaps, let alone add features such as custom LOD light map resolutions or the option to re-use lightmaps across LOD-levels.

For now my recommendation is probably to keep using LOD’s but only to a reasonable level. (If you’re using baked lighting) Don’t go thinking you’re making huge savings making 4 LOD’s for your hard-surface assets, because you may actually be adding performance cost than saving.

Why I Love Working at RocketWerkz

Surprised that I already spent a year working at RocketWerkz I thought I’d slow down for a second to reflect on my time here. Normally I’d consider it too formal to write about an employer on my crazy blog, but unlike a conventional studio, you’ll see why my experience working for RocketWerkz is well blog-worthy.

An evil manager pouring up drinks at a Skyscraper looking over in Bangkok

The RocketWerkz office celebrating my 1 year with fireworks! Or wait.. maybe those were for 4th of July.

Over the years I’ve come across my fair share of studios who think they are special. Rather than bragging (or even mentioning) salary-ranges they emphasize what an honor it is to work for their one-of-a-kind studio. Problem is, the company culture bragged about is usually neither special or advantageous.

My favorite example of pretentious meaningless company perks must surely be the infamous beanbag chair. All though I could think of a hundred potential perks that could improve my life, beanbag chairs is not one of them! It seems that every CEO thinks they can turn a stale corporate environment into a never-ending party  with the right beanbags. Of course my issue isn’t the beanbags themselves, but the lack of good answers when I ask “what else you got that makes you special?”.

An evil manager pouring up drinks at a Skyscraper looking over in Bangkok

I love making fun of pretentious beanbag offices, so it’s ironic that a previous employer asked ME to pose for their obligatory beanbag-shot on their career-page.

So imagine my surprise when I arrived to RocketWerkz. Not only are we blessed with a beanbag-free office space, our perks goes way beyond mere buzzwords.

We are so incredibly lucky with our perks that I’ve stopped keeping an eye on other career opportunities. Because of my somewhat rare experience working in China my LinkedIn is bombarded with offers from Chinese studios looking for western experience. Sometimes these offers comes with salary ranges that makes coffee spray out of my mouth! But regardless how lucrative I just can’t take any offer seriously. After getting spoiled with the creative freedom working for RocketWerkz it’s hard to imagine ever going back to work for a conventional studio again! Allow me to show you why…

Bake Normal Maps 3ds Max to UE4 with XNormal

A lot of game developers gets frustrated because UE4’s documentation regarding making normal map just doesn’t work! Following their steps kind of works, but faces that should be flat just becomes weird when the lighting hits certain angles.

Here is the missing important step that Epic forgets to mention in the documentation: ‘Computer Binormals in the Pixel Shader’.

  1. Open up the oh-so wonderful XNormal.
  2. Click the strangely hidden settings button that looks like a plug.
  3. Click the ‘Tangent Basis Calculator’-tab.
  4. Select Mikk-Tspace in the white area.
  5. Click configure.
  6. Check the checkbox for ‘Computer Binormals in the Pixel Shader’.
  7. Re-render your normal maps.

RocketWerkz New Game Living Dark Trailer

For a whole year working at Dean Hall’s new company RocketWerkz I’ve had to have my lips completely sealed about what I’m working on. While everyone’s been assuming I make VR games (because of our Out of Ammo releases) I’ve hardly even touched a Vive! Most of my time and energy has all gone into this one secretive game revealed today!

After my adventures making games in China, I had a difficult dilemma. On the one hand I wanted to move to New Zealand but on the other hand I really wanted to use Unreal Engine 4. With NZ’s games industry being tiny, it didn’t give me the luxury of being able to pick and choose jobs based on engine choice. Imagine my surprise when I finally received a job offer in my favorite place in the world using my favorite engine in the world!

 

At this stage I was so excited I gladly accepted the job knowing little about the secretive game I would be working on. Frankly I was so happy to move to NZ to use UE4 that I would gladly accept any project no matter how silly (I once even interviewed for ‘My Little Pony’ just because their studio was located in Auckland). But my luck was just about to begin…

At RocketWerkz they believe in letting developers work on what they want to work on. Al though I wasn’t officially introduced to Living Dark, I once saw their early prototype on someones monitor and immediately said “I wanna work on THAT!”

An evil manager pouring up drinks at a Skyscraper looking over in Bangkok

The game is being developed by a small indie team here in New Zealand. That’s me furthest to the right!

Having released over 20 children’s games, I’d gotten a little bit tired of their upbeat style. Especially when you consider that there’s nothing “casual” about the games I like to play as a gamer. Seeing the dark rainy neon-clad streets of Living Dark made me realize I wanted to join the project before even having any idea what the game was about!

What I really like about the game is its procedural aspects. When I played RPG’s in my younger years I truly felt like I was escaping into a another worlds, not so much these days! Perhaps because I’m a developer or perhaps I’m just too old, I tend to see through the smoke & mirrors of modern games which makes the worlds feel flat. Making the world procedural in a convincing (not ‘No Man’s Sky’ style) way is the best solution I can imagine to this problem.

I had finally found the game I wanted to spend my next year or years working on, only downside was that I couldn’t say a word about it! But finally the secrecy is slowly getting revealed!  Click to check out all 5 trailers!

3ds Max Camera Coordinates & Rotation to UE4

Today I wanted to match a camera between my 3ds Max scene and UE4, I found some plug-ins and stuff but really I just wanted to copy-paste the values rather. In case anyone wants to do something similar, I’ll save you 10 mins by posting my findings.

UE4 Camera Location:

X = 3ds Max X
Y = – 3ds Max Y
Z = 3ds Max Z

UE4 Camera Rotation:
X = 3ds Max Y
Y = 3ds Max X – 90
Z =  (3ds Max Z – 270) * -1

Enjoy!

My New Job at RocketWerkz

In my previous post I announced my sad decision to leave my life in China, but it turned out it wasn’t so sad after all. Al thought it seemed there were no good jobs out there I somehow caught one that seems too good to be true. 

My desk at RocketWerkz, with beautiful ocean view

4k 27″ monitor, 6 core @ 3.60 GHz CPU, 1070 GTX graphics… I think I’m in love with my new work machine!

During my job hunt I had two primary wishes; I wanted to use my favorite development tool Unreal Engine 4 and to live someplace nice. These requirements initially seemed reasonable until my job searching gave me a grim view of the market.

My favorite development tool has started gradually fading from the job portals, although Unreal is the vanguard of cutting edge of technology, many game companies are switching to Unity to save cost. Although the choice of tool doesn’t affect conventional rewards such as salary, using the best technology is what makes the every day process of making games interesting.

Similarly my living requirements wasn’t easily met. Although I’ve matured past my adventurous phase of living in places like China, I also didn’t love the idea of returning to Sweden or UK. A few years ago I’d decided New Zealand would be my ideal place to live, but after discovering how tiny its game industry is I realized it wasn’t likely to happen.

It seemed impossible to find a job that meets my needs, but then right out of the blue the perfect offer popped up!  Click to find out where!

Amazing UE4 VFX from China (with Tutorial!)

During a recent binge-watching of Youtube I found a VFX reel that absolutely blew my mind. Far from anything I’ve ever seen in realtime VFX’s I was worried my brain might have short-circuited a fuse in amazement. With the unnamed Chinese artist shrouded in mystery I decided I must look deeper, to my surprise found an amazingly detailed 3 hour video-tutorial, available only for those with a little Chinese know-how.

Since my days of working with Unreal Engine 3, I was blown away when I discovered what an amazing improvement Unreal Engine 4 is. Everything from blueprints, constructor scripts, deferred lighting to PBR workflow made me feel like it was a brand new engine, until I opened up Unreal’s particle editor, Cascade…

Unlike my previous amazement, Cascade was the exact same mess I remembered doing my first Unreal VFX 10 years ago! The new black color-scheme did little to hide the fact that it’s the exact same tool with the same bugs still present. I was considering buying stocks in Apple, until I realized I’ve not traveled back in time, I’m still actually in 2016. Epic just hasn’t made much improvement to their particle editor.

What HAS happened however in the last 10 years is the vast improvement from the artists using the tool. I could show no better example of this than this VFX reel I found on Youtube, demonstrating some of the best realtime VFX’s I’ve ever seen.

Although I can pause this video at any time and reverse-engineer how a particular element was most likely made, if I attempt to do so at full-speed my mind just explodes of over-stimulation. I realized I MUST know more about these effects and its genius artist. With the uploader silent and anonymous I didn’t have my hopes high, but to my surprise my Chinese friend managed to dig up a 3 hour video-tutorial! It’s ridiculously difficult to find and requires a bit of knowledge how to log into Chinese services, hence I decided to share this knowledge for all to enjoy. Click to check it out!

3ds Max vs Maya: Which 3d Package Should I Learn

Since the dawn of human times the topic of 3ds Max vs Maya has repetitively shown up around the web. Althought a great question, I the answers are less great and often misleading. Today I want to share a very simple answer to which 3d software is the best.

The answers found around the web (that I myself once believed in) usually falls into the following categories. Discarding the question as a duplicate, referring to an ancient 6 year old thread. Claiming that the question is as pointless as “My religion is holier than yours!”. And finally, attempting to answer the question with an incredibly specific comparison about a tiny portion of the software, completely overlooking any bigger picture.

I strongly believe all these answers are wrong and would like to share the rule which I go by. 3ds Max vs Maya, which one is best?

Is UE4 Distributed Rendering Worth It?

There are countless tutorials how to set up UE4 (Unreal Engine 4) to distrubute lightmaps tasks across a network, but I wasn’t interested in the ‘how’. I wanted to know if it’s even worth all the hassles associated with DR (Distributed Rendering). My curiosity got the best of me so I dove in to find out!

After a life of experiments with buggy DR’s my question was “should I even bother?”. The time I’ve previously spent troubleshooting mysteriously idle render machines has by a hundred-fold exceeded the time I’ve gained from its marginally faster renders.

My results have been disappointing regardless of software (primarily I’ve used Mental Ray and V-Ray) yet one little fact made me wish to give UE4’s DR a try. Despite having frequently complained about poor documentation for the Unreal Engine, I must admit I’ve never once been disappointing with the software. Despite DR probably being a low priority feature, I had a feeling Epic might leave me jaw-dropped impressed as usual. I was not wrong.  Click to see the results of my Swarm/Lightmass Distributed Rendering.