"Realistic" Shadows tutorial (Baked AO Maps)
Aug 23, 2024 21:30:06 GMT -8
auroral, 𝙫𝙞𝙨𝙞𝙩𝙤𝙧, and 4 more like this
Post by bitteneite on Aug 23, 2024 21:30:06 GMT -8
Do you hate it when the cars in a car game look terrible? Well, say hello to baked Ambient Occlusion maps!
(Your cars will still look terrible)
With baked Ambient Occlusion maps, you're essentially painting "fake" shadows onto your car.
It's a common technique used by many games to simulate nicer graphics at no performance cost, like Assetto Corsa!
Before | After |
To better visualize the difference, take a look at the textures themselves!
Before | After |
So yeah, cool stuff! Limme show ya how it's done
1) Requirements
This technique can be achieved with some easy-to-find tools around your house, such as:
● CarX with Kino installed
● Photoshop (Or any alternatives)
● Blender
● A working brain and lots of patience!
But before we get ahead of ourselves, I need to mention that this is a very challenging technique to pull off right. You'll probably spend a good while just tweaking the parameters on your first attempt, so don't be surprised if you end up with dozens of .knliv files!
You're also expected to be somewhat familiar with the whole process of making liveries, as I won't go over the basics.
If this is your first time making png liveries, I highly recommend you visit Noisy's guide for making liveries here!
2) Dumping your model
To begin with, we need a 𝒻𝓇𝑒𝓈𝒽 dump of our car's 3D model.
Oh, you've already done this before? Well listen up, cuz now you gotta check a few things!
First, double check is that you don't have any hidden body parts inside your “Custom Objects” tab.
● Any parts hidden here will NOT show up in your dumped model.
Second, if you're using custom objects for body parts, choose an in-game body part that best resembles the shape of your object.
● Every part affects how the AO is generated on other panels, so we just want a "good enough" substitute for the Custom Objects we can't dump.
● Be sure to not use the “Empty” parts!
Once everything checks out, just dump the model in Kino by going into Tools > Car dumper > Dump model
Next, we'll prep our 3D model for some baking!
3) Preparing your 3D model
To begin, remove everything in your Blender scene and import your dumped car.
● You should be able to just drag the .obj file into Blender.
Next, we’re gonna add some objects into our scene.
Those objects will affect how the Ambient Occlusion is generated, so you wanna be extra careful with their size/placements.
Floor
● This one’s the most important! It will give your panels a nice gray gradient towards the bottom.
● Get it somewhat close to the bottom of your body. Just don't make it clip through the body!
License Plates (Optional)
● The dimensions I use are 0.33m x 0.01m x 0.165m.
Wheels (Optional)
● This one will darken up the inner sides of your bumper and side skirts, but it can be somewhat negligible on certain builds.
● If you'll run an aggressive fitment with mad camber, match it here as well!
Lastly, Blender needs a "target" to store the AO map in.
Create a new image, and use it as your body's material. Blender will automatically target it on the default settings.
● When creating the image, be sure to pick the correct resolution you'll work in.
● I like to work in 4K, but you can use 2K resolution if that’s what your Photoshop liveries are on.
● The rendering time gets wayyyyy longer for higher resolutions, so don't do 8K on a slowass PC ¯\_(ツ)_/¯
● Name doesn't matter, but give it something you'll recognize. (I just named mine "AO MAP")
4) Testing the Ambient Occlusion map
Wait, hold your horses! Baking anything in Blender takes ages, even with a beefy computer. That’s why you should do a small “test” render before committing a few minutes of your life to what could be a faulty AO map.
For now, use the following settings and bake!
● Use the "Cycles" renderer.
● Why is CPU the default? Use ya goddamn GPU.
● Untick the "Noise threshold".
● We’ll be using a stupidly low number of samples to make our renders faster (Only 8), but we’ll bump this up later.
● Use your GPU as well for the compositor.
● In the "Bake" tab, select "Ambient Occlusion".
● Select your body and hit that fat bake button!
Get REAL CLOSE and PERSONAL!
● Ignore the noise, that’s normal given that we're only using 8 samples.
● You just wanna be on the lookout for any weird artifacts/glitches.
● In the case of this 86, everything looks good, but it can be an entirely different story with some KNPPs. (Depending on how their backfaces were made)
If you do stumble into artifacts, you'll have to figure out what's causing it. This part relies entirely on your knowledge in Blender.
With KNPP kits, it's usually the backfaces that need to be deleted, but be on the lookout for any other symptoms! (ex. Overlapping UV maps)
As you might've figured out, you'll be re-running this test a bunch of times if you had to fix a glitched KNPP.
So anyways, next we'll be bumping up our settings to create a silky smooth AO map!
5) Generating the 𝒸𝓇𝒾𝓈𝓅𝓎 Ambient Occlusion map
Everything lookin' good? Great!
Now go ahead and bump the rendering samples to a much higher value, such as 256 or 512.
● Your AO map texture should now be much less noisy, but it’s gonna take a while!
● I'm running an RTX 3080, and doing 512 samples on a 4K texture took around 3 minutes.
● We'll denoise our texture later, but we still need a nice clean texture to begin with.
Once it’s rendered, go ahead and save the AO map as a png file.
● In the pane to your left, load up the image you've created earlier. (In my case, I had to select "AO MAP")
● If you've done everything correctly, it should be the crispy AO map you just spent minutes baking.
● To save it, press Image > Save.
Next, we’ll create a denoised version of this texture!
6) Denoising
Go into your “Compositing” tab, and set it up like how I did here:
● Tick on the "Use Nodes" button on the top-left.
● Under the Color Management tab in your Render settings, change the "View Transform" to Standard.
● Now create an Image node, a Denoise node, and a Viewer node. Hook 'em up like so!
Once you've set up your composition, you should be ready to export a denoised version of your AO map!
● Go back into your "UV Editing" tab
● Instead of loading up the image you created, load up the “Viewer Node”.
● Save it as a new file!
Congratulations! You now have an AO map that’s ready to be baked onto your livery!
Next, we'll be slapping this clean azz texture onto our livery in Photoshop!
7) Applying the Ambient Occlusion map
Finally, it’s time to bake that silky AO map onto your livery!
NOTE: You can leave the materials alone! AO maps work well on matte, chrome, and everything in between! (Usually)
Arrange the following layers and folders at the top of your layers.
NOTE: If you were to add a new sticker/decal layer, make sure that you put it underneath the AO Map folder!
Essentially, I’ve created a whole folder with a Levels Adjustment layer applied to it.
If you've followed the video above, then anything you add in this folder will automatically match to the correct shade of gray. (ex. You may later come back here to manually draw some shadows for badges)
Speaking of, use the following values for starters in your Levels adjustment layer.
REMINDER: You may copy these values, but every car will need to be adjusted accordingly!
Use your eyes and your best judgement. You'll be adjusting the livery back-and-forth.
And that's pretty much it! I've added a few finishing touches and I was left with this texture!
And here's a little comparison!
Before | After |
And that's it for the basics!
Questions & Answers
● Can I bake AO maps into my ingame liveries?
You’ll need to dump and port them to Photoshop first!
For a quick and dirty method, just press the "Dump livery" button in Kino and use the .png file as your background.
● Will AO maps have any effect on a dark paint?
Not much, but you can turn up the levels adjustment layer to make the AO map more noticeable.
It can have a nice effect on bright decals though!
● My spoiler is casting a weird shadow, what gives?
The reason for this will vary depending on the shape of your spoiler. Usually though, it's the Levels Adjustment layer that's just exaggerating their shadows.
For an easy fix, just manually mask out the problematic areas on the AO map in Photoshop.● The UV map for my kit (likely KNPP) is overlapping, what should I do?
Woops, you’re shit outta luck. Either use a different kit, or mask out the AO-map in the overlapping areas. (If you’re lucky, it might be an area that's not very noticeable)
● How can I get Photoshop for free?
This is not the place to ask. If you want some free alternatives, look into GIMP or Photopea.
● Blender is hard, can I use another program to generate my AO maps?
You can use any program you like. I first got my AO maps in Adobe Substance Painter, but I later found that Blender does a more accurate job at generating AO maps.
Alright that was a lot to go through! If there's any part that wasn't very clear or well-explained, please either leave a comment below or reach out to me directly! (I have the same username on discord)