In "Spherical coordinates", r is the radial distance from the center, as though you were measuring height from the center of the earth, and 0 latitude is at the south pole, with 90° latitude at the equator and 180° latitude at the north pole. Here is the map from spherical to rectangular coordinates, followed by the jacobian.
x ← r×cos(θ)×sin(φ)
y ← r×sin(θ)×sin(φ)
z ← -r×cos(φ)
cos(θ)×sin(φ) | sin(θ)×sin(φ) | -cos(φ) |
-r×sin(θ)×sin(φ) | r×cos(θ)×sin(φ) | 0 |
r×cos(θ)×cos(φ) | r×sin(θ)×cos(φ) | r×sin(φ) |
Run down the third column to compute the determinant. The 0 term goes away, leaving the determinant of the upper left square times r×sin(φ) plus the determinant of the lower left square times -cos(φ). This simplifies to r2×sin(φ).
So what is the volume of a sphere? Integrate r2×sin(φ) over r θ and φ, in that order. The answer is 4π/3.
How heavy would the unit sphere be if its density was given by the function f(r)? In a planet or star, the density is determined by depth, without regard to latitude or longitude, so this is a "real world" problem. The answer is 4π times the integral of r2f(r). If the density increases linearly with depth, e.g. f(r) = 1-r, the mass is 4π/12.
The same integral gives the amount of heat in a solid sphere whose temperature is a function of r. Additional heat is liberated when liquids freeze etc, but that's another story.