It's much much more like our new AI image generators than a physical simulation of light and volume with mathematical precision. Imagination is a "good enough" fluctuation of seemingly random stimulation of neurons that we're able to judge as being quite approximate to the same stimulation pattern that we get from our physical sensors. Thinking about a scene or music and "hearing it" is like a unit test.