Hi,
I’m working with procedurally generated meshes which are instantiated and destroyed during run-time. It’s all worked fine and dandy - performance and all - until I’ve come to the problem of lighting: I’m working on the mobile platform, so obviously I can’t be using pixel lighting on every light. However, the Vertex lighting just doesn’t cut it.
The lighting on the procedural meshes never changes, and so I’m wondering if there is some sort of middle ground I can work with. Is there a way to temporarily bake down a pixel light’s information after the mesh is generated to avoid these performance issues?
I’m confident in the language, but I’m still learning the functionality of Unity. If you have any other suggestions for how to do lights for a procedural setup like mine, I’d greatly appreciate them!
There is no middleground unless you write your own lightmapper.
baking light data is only possible against static data present at creation time as the process takes hours normally, on an iOS device days to weeks.
You have a better change getting anywhere by using a material lod system that allows pixel lights in the close up and has vertex color (baked manually at runtime in code basing on the lights) further away for example or by using more geometry and using vertex lights
I’m trying the method of switching between Vertex and Pixel lights. To solve the problem where it “pops” from one light setting to the next, I integrated a second light that has identical settings, but is a vertex light. The script tweens between the two using their intensity, and disables the respective light if the player is too far away. There is a range where both of them are turned on, but I think this is a decent cost to have my pixel lights be smooth and efficient.
However, I am running into a problem. Even when the intensity of the pixel light is set to 0, it is lighting the surrounding environment somehow. With the setting at 0, when I flick the Light component on and off there is a visible difference in the lighting.
The problem does not seem to be caused by the color value, and I can’t find any other settings in the script reference which could help this. Is there a setting I can animate which can have the light fade from zero light to full brightness?
In that same light (har), is there a way to define the priority of pixel lights? I have one pixel that that must be turned on, while the other ones should be bias by their distance to the player. I know how to do it manually with lists, but is there a faster or more efficient way to do it?