Direct realism (or naïve realism) as a theory of perception claims that what we perceive are real objects and their properties, and that these objects exist without even minds to perceive them. This often seems the commonsense approach to perception, after all, evolutionary theory tells us that objects were around long before we had minds to perceive them with. For realists in general, objects exist independently of our mind and our perceptions of them; for direct realism in particular, the immidiate object of perception is the object itself. The main challenge to this view is that some objects appear differently than they are, such as a stick seemingly being bent when viewed through the water. This is commonly called the argument from illusion, and is usually countered by arguing that looking bent when submerged in water is merely another property of the object itself.
Idealism on the other hand, argues that physical objects described as independent of our minds, do not exist at all. Berkeley explains this by pointing out that all sensible things consist of sensible properties alone, in that, if we remove these properties, there would be no object left. He then goes on to point out that if all we can know as belonging to an object are sensible qualities, then without anything to perceive these qualities, the object cannot exist. Thus all objects are mind-dependent. In the idealist view therefore, as opposed to the realist view, objects do not exist outside of a perceiving mind. What we perceive are to Berkeley not the objects themselves, but ideas, and since ideas do not cause anything, i.e. they are passive, the cause of our perceptions must be a mind, not matter. Interestingly enough, idealism also tends to struggle when having to explain illusions like the one mentioned above, though its answer tends to lean towards arguing that this is not an illusion, but simply another idea where the stick looks bent. The function of an illusion thus becomes that of misleading us regarding what ideas we might associate with what we perceive. As we can see, the two theories of perception have somewhat similar solutions to the argument from illusion, in that they both admit this to merely be another aspect of the reality we perceive. They do, however, differ in how they describe what this reality consists of.