Baking lighting on vertices

Hi guys,

I’m currently working on a very large scale map, with tons of rocks and foliage. The issue I have is with lighting baking, I’m not able to bake the lighting on the mesh’s vertices. I can’t set lightmap resolution to 0 it is limited to 4.
The problem is that I would need very hi-res lightmaps to get the same resolution I would have on the vertices (especially for trees and rocks, and I have thousand of those). Moreover the memory it takes to store all the lightmaps (even with very low res) is just insane.

How can I specify that I want the light to be baked per vertex ?

Thanks !

Hey Sebvhe,

Lighting is calculated per vertex as it is now. I assume you’re using a dynamic light for your exterior level with all your foliage from the description of your problem. The more meshes with more verts that you have will decrease performance because of the shadows that are having to be calculated. The best way to alleviate some of this is by using multiple LODs for your meshes, cull distances, and level streaming.

to me it sounds like he wants to bake the lighting into the vertices like you could in previous unreal engines.
no idea if that is possible anymore, but could possibly be interesting to have that with assets having more triangles than ever before

Yes that’s exactly what I want, bake the lighting information into the mesh vertices instead of a lightmap.
It makes sense when you have a lot of foliage, especially trees where you will need a fairly hi-res lightmap to get the same resolution you would have in the vertices. And it also takes much more memory.
In my map I believe 99% of my meshes could have their lighting info baked on the vertices instead of a lightmap, which would save me a lot of time and memory.
In UE3 you could specifiy the lightmap resolution to 0 to switch to vertex lighting. How can I enable this in UE4 ?

That is not available anymore in UE4. I’m sure they had their reasons to remove it, but I agree that that there are use-cases where it would be nice to have the option back.

Are you sure this feature is gone ? I don’t see any reason for removing it, it is actually super useful. Why bothering creating a lightmap if it works per vertex ?

I believe this is still present in UE4, in the Static Mesh Lighting Info window, there is a column for vertex LightMap

536fc1ed317c6c200c987541ef1c357e294d472d.jpeg

Interesting, I remember reading an Epic dev state that it was gone somewhere on this forum, so I assumed he/she knew what they were talking about.

Maybe that column is left over from UE3?

Maybe it could be enabled angain by modifiying an .ini file or something …
Anyway, I would really like to know whether or not I will be able to bake lighting on vertices. It would indeed be very problematic if I could not.
I wonder what would be the best way to have a proper static lighting on a huge natural landscape with tons of foliage ?

If your use case is large amounts of foliage you should be instancing them, which would be fundamentally incompatible with vertex lighting. which is why UE3 did not support vertex lighting on instanced geometry either.

UE3 did support vertex lighting on instanced geometry and foliage mode.
I don’t really see why vertex lighting would be more incompatible than lightmaps when it comes to instancing. I mean if you don’t store vertex color for each instance you still have to store unique UVs for the lightmap right ?

Are you sure? I just tested it and it surely does not work in our UE3 based game. That would require some mighty fine trickery to get working.

With lightmapping you do not need unique UVs at all, you only need a single offset value. If you look at the Unrealscript source for InstancedStaticMeshes in UE3 you’ll only find this in the per instance data:

InstancedStaticMeshInstanceData

Object.Matrix Transform
Object.Vector2D LightmapUVBias
Object.Vector2D ShadowmapUVBias

Yes you were right, I just launched UE3 and tried vertex color on foliage, it does not work. I was so sure I used it :stuck_out_tongue:
And your explaination about the offset value makes total sense then.

Anyway since I can not rely on vertex lighting, I wonder what would be best between fully dynamic lighting and mid-sized lightmaps, both performance and visually-wise. I guess I’ll have to try.

It’s an old thread, but…

Can we use store lighting via vertex?

No. Not possible.