How to Prevent Light Culling in HDRP

I am working on a research project using HDRP, and I need all lights to remain unculled during the deferred shading. How can I achieve this?

How many lights do you have active at the same time? Are they real-time or baked?

Did you check fade distance?

I aim to create a scene under rasterization that is as physically accurate as possible, so I set the Range and FadeDistances to large values 1000 or larger.

However, I noticed that in HDRenderPipeline.cs, the PrepareAndCullCamera function separates lights into cullingResults.visibleLights and cullingResults.visibleOffscreenVertexLights.

I don’t want this kind of culling—I need all lights to be included in cullingResults.visibleLights because I require depth buffers and other information for all lights. Later, I may customize buffers, such as a Reflective Shadow Map Buffer, to implement global illumination.

Could you advise on how to achieve this?

This seems like a very particular use case, where you would need to fork the HDRP source code and modify it to your needs.
The easy way is to move the HDRP package from Project/Library/PackageCache to Project/Packages.
The files will then no more be readonly and you can edit them.

In fact, I have already taken steps in this direction but encountered some obstacles due to certain closed-source methods.

The workaround I can think of now is a hack: adding the entries from cullingResults.visibleOffscreenVertexLights to cullingResults.visibleLights to use ComputeShadowMatricesAndCullingPrimitives to obtain the view and projection of visibleLights. I hope this approach works.

Following this, I plan to use MRT to capture the RSMBuffer. And I have another post on this topic that has been puzzling me for quite a while: Failed to Create a Custom Render Pass in HDRP: MRT Not Working. I would appreciate it if you can provide some suggestions. The formatting might be a bit messy, but it shows all the source code changes I’ve made regarding this issue.