I have thought about this for a long time, but unfortunately still do not manage to understand how exactly the thing in itself differs from substance. I am aware that the thing in itself is something that is not accessible to the senses. However, this somehow also applies to the substance as soon as we think away the accidences. What exactly is the "substance" then ? How does it differ exactly from the thing in itself?
I will try to illustrate the distinction from a modern perspective.
Let's assume that the Universe exists and would continue to exist even if all human life was snuffed out overnight- so things such as chairs, cups, planets and everything else are definitely there and not the product of our imagination or a simulation.
That last paragraph might seem reasonable to you, but on reflection what are chairs, cups etc if not products of human thought? In reality, the Universe consists of countless fundamental particles in an unimaginably complicated configuration that is in continuous evolution. If I contemplate the white cup on my desk, what is 'really' there are billions of billions of billions of atoms held together by electromagnetic interactions. The 'cup' is a subset of those countless particles. It seems smooth and white to me but that is an illusion. There is no such thing as white in nature- all colour is a mental construction. The apparent smoothness is an arbitrary product of the relative size of my eye- if I were to zoom in closely the surface of the cup would appear anything but smooth, and if I were to zoom in closer still I would no longer see a surface at all, but a gradual shift from a region sparsely populated by zooming molecules of nitrogen, oxygen etc to a region more densely populated by other atoms in a more fixed relationship to each other, with mainly empty space between the nuclei. The 'cup' is just a subset of the countless particles that exist in my room, a subset that is defined only in the minds of humans.
And then let's zoom in further- in imagination at least- so that we are now 'inside' an individual nucleus in the sub-set I call my cup. I am not really sure what inside means in this context, and certainly I have no idea how we might properly conceive of what exists there. The mathematics of particle physics is esoteric and abstract. We tend to think of the fundamental particles as either little points, or waves or vibrating strings, but they are just analogies with familiar macroscopic objects- what quarks etc are 'really' like is anyone's guess, and it is possible they are like nothing we are capable of imagining.
Our understanding of the 'cup', therefore, is limited in two main ways. Firstly, it is limited by the fact that our senses are macroscopic, and tuned for survival (you don't see the infrared or ultraviolet light coming from the cup, you don't see that it is mainly empty space etc) and secondly our mental image of the cup is just that- a mental image, subject no doubt to all kinds of limitations owning to the fact that our brains have evolved in a particular way. So even if you gain as much knowledge as you, a human, can have about the substance of the cup, you still can never know what 'really' exists.