The lag you get when an object comes into view for the first is definitely shader compilation, that happens the first time that shader is requested by a material/mesh instance coming into view.
Related post: Asynchronous loading of game assets - #10 by Leonidas
There isn’t a straightforward to precompile all those shaders, what usually developers do is force all materials/models into view for a single frame, at application start time. One way to do that is to have your camera render the full scene with frustum culling disabled and all entities enabled, for a single frame.