So I did many try and errors in getting my head around light baking (read a few threads and tutorials too).
Main issue for now are blocky shadows. How can I make the shadows look less pixalated without going overboard with the lightmap density?
I prepared the cubes in Blender. They are placeholders for the props in a FPS game. So they are more or less 1x1x1m with LightMap Res set to 128 (256 gets red color).
Are there any other settings than LightMap Res that would sharpen the shadows borders? Or maybe better way of LightMap packing in Blender?
the lightmap density debug view shows you literally the lightmap pixels/texels. if you need more resolution in select areas or on some props you’d have to increase it even further. it comes with texture memory costs for polygons that are in full shadows or light, and don’t require that much detail.
to handle the lightmap resolution assignment even more efficently you’d have to generate the lightmap uvs inside of blender. this way you can effectively tweak the lightmap resolution on a per polygon level. for example the cube with the blue arrow would have like 2 large lightmap polygons for the detailed shadow edges and the rest pretty much smaller lightmaps, to just account for basic gi distribution.
you could get even more advanced and generate specific geometry like loop or knife cuts just for areas where the shadow edges would appear and you need fine grain lightmap resolution. this workflow gotta be excuted entirely in blender tho. you would have to basicly setup your scene lighting in blender and bake an approximate look in there to know, where you’d have to cut geometry for the detail lightmaps.
that would look something like this. the teal polygons being low res. the smooth blending of low and high detail lightmaps is not guaranteed tho. this is extremely efficient lightmap compression, but really hard to manage. (note: source engine used to have a cli switch to compress low detail lightmaps into smaller tiles. unfortunately this is not an unreal engine feature, afaik.)
Generete UVs creates Lightmap but it is not the most efficient way - UE doesn’t know which plogyon will need higer res (casted shadow edges on the given polygon) so I pressume it is based solely one the size of the polygon (but the ones in full light or shadow do not need higher res)
Lightmap Pack in Blender allows me to prepare UV map and adjust the size of islands- also the ones which corresponds to the polygons that have shadow edges casted on them
this pipeline can be taken a little further where, while being aware of where light and shadows are being casted allows us to cut polygons to „separate” higer res island with shadow edges from the lower res islands without shadow edges
This make me think I could make a workflow where i:
prepare assets in Blender
import them into UE with high res lightmaps
bake the light in the scene in Unreal
prepare customised, optimised lightmaps in blender (while knowing already where light and shadows whill be located)
relode the lightmaps in UE
So let me present few more screenshots:
this is my custom Lightmap from Blender with selected edge connecting two most important islands - I made them bigger hoping for better result
this is lightmap created with Generete UVs option turned to false, and Lightmap Res crancked up to 256 - debug already screams red narrower polygons - slightly better outcome
this is lightmap created with Generete UVs option turned to false, and Lightmap Res crancked up to 512 - debug already screams red everywhere - good outcome
and lastly, Generete UVs option turned to false, and Lightmap Res set to 128 but what I did is rotated the cube on the right - shadows are the same quality while islands are two times smaller.
Sorry for such a lengthy post but I really want to understand this once and for all.
Why shadow edges are still bad quality even if i enlarged the more important islands? What alse can I do to not get red color and achive smooth shadow edges?
okay. you understood the concept. the first comparison is just marginal increase, cause you have only like a 1.3x increase in edge length in the uv map. that’s like going from 50 pixels to 64. for the “unused” ones you gone from 40 and 50 to 32 tho.
if you multiply that by 2 you get more pixels for all polygons. means 128 x 128 for your shadow edge polygons and 64x64 for the unused ones. you could make the small ones even smaller in this case if you don’t need this much detail on them.
it’s some crazy lightmap scale and uv management… yes… but worth it if you really wanna bake high details where it matters and crunch the “useless” data.
in the end everything gets merged into one large atlas anyway. so… doesn’t matter if the uv space in the preview is packed efficiently. just to note that.
I see. So what I did now is made crazy disproportion in the lightmap.
Interesting stuff. I set Lightmap Res to 128 and got better quality shadow than before with Res set to 512. Debug screams red though…
Does it make sense?
that’s too extreme. the small ones are too small. you gotta have and may want some coverage for GI. like 8x8 per square meter, or 4x4. depends how much light propagation aka GI you have around.
the red makes kinda sense. but also not. it’s epic default, but you completely override and customize lightmap distribution. so… it’s rather not important.
Got it. When it comes to debugger colors, it is also worth noting that the ideal and maximum lightmap density values can be adjusted, which affects the colors shown in the debugger.
This is probably part of planning a resource budget, which opens many other topics.
Since it depends on many aspects, I don’t want to ask for the solution, but do you know what the do’s and don’ts are, and what are the best ways to control how many resources the lightmaps currently require — apart from the Lightmap Density view mode?