These are all spotlights, I am using URP.
All road pieces are static
This headlight crosses 2 planes. On one plane the headlights show and on the other they don’t
These headlights are across 2 planes. They don’t show at all until they reach the second plane (plane has X/Z scale of 3.0 and material tiling of 1.0). At this point they show on the first plane but not on the second The green car to the left has headlights that are on the same plane, and they show all of the time.
This car has headlights that never show.
The cars are all instances of the same prefab, with the same modeling and settings.
Mesh settings for central roadpiece (left) and side road piece (right)
The URP only supports up to 8 lights per object. If part of the road is and you have more than 8 lights affecting it, some of them are going to be skipped.
@bgolus thanks for the information. Do you know of any workarounds for this limitation? When I look at other games like GTA, they have numerous headlights and taillights affecting the road.
One approach I could apply is splitting the road into more sections. Then the leftmost and rightmost vehicles will be lighting up different road meshes.
I should also change some of my street lights from mixed to baked, and add probes to the scene. I’m not sure how many lights a probe is considered to be and if they need to be factored in?
GTA and most big games are using deferred rendering, the major feature of which is easier and faster support for a lot more lights. URP has a deferred rendering option they’re working on, but it’s only available for Unity 2020.1, and I think still a work in progress. The alternatives would be to use the built in deferred pipeline instead of the URP, or use HDRP. However if you’re using the URP because you intend this to be a mobile game, then deferred isn’t really a good option for most mobile devices.
In which case, cutting your road into strips would be the only work around I can think of. However be aware that the URP has a hard limit of 8 lights total on some mobile devices. There is no work around for this. A lot of older games (pre 2010) used cheats like using a single light with a texture to fake the head lights of a car. Or various other hacks that would likely require writing custom shaders.
Zero, a light probe isn’t a light. It’s an approximation of incoming light encoded as a spherical harmonic. That sounds complicated, but they’re super cheap. You can effectively support an infinite number of static lights via light probes, though you’ll loose specular lighting or really any sense of individual lights in a light probe as it can only really represent hemispherical lighting data. Should work well for street lights though to give a sense of the cars passing under them.
Thanks @bgolus
I switched to URP because I needed to use Shader graph to create a shader for my racers, that allowed me to recolour one model differently for each racer (there are many other collections of racers using the same method, not just the cars you see). I can’t write shaders, so Shader graph is my only option.
I think that limits me to URP, unless there is another way to solve my Shader Graph and lighting requirements. This is a PC-based app, no mobile involved.
You can use Shader Graph with HDRP, which doesn’t have the same light limits due to using a much more modern lighting system (including using deferred rendering).
Or you can buy Amplify Shader Editor, which works with the built in rendering paths, as well as the SRPs.