g tells you that x^4+y^4+z^4 = 1
Therefore z^2 = +/- sqrt(1 - x.^4 - y.^4)
Substitute into x^2 + y^2 + z^2 to get
fg = x.^2 + y.^2 +/- sqrt(1 - x.^4 - y.^4)
This does not need a 3d mesh, only a 2d mesh. You will, however, have to break it into two pieces for the +/-
You cannot plot f directly as it is unbounded. You can plot isosurfaces of it, one at a time; each of which is a sphere.