I am looking for a two variable function (a surface), $g(x,b)$, with the following properties:
$$g:\ [0,\pi] \times (0,\pi) \to[0,\pi] $$
$$g(0,b)=0$$ $$g(\pi,b)=\pi$$ $$g(b,b)=\frac{\pi}{2}$$ $$g\left( x,\frac{\pi}{2}\right)=x$$
Where $x\in[0,\pi]$ and $b\in(0,\pi)$.
Can you define such a $g$? I have been looking for a while and am unable to find one. If you cannot define one, does such a $g$ even exist?
Something like $$ g(x,b) = \begin{cases} 0 & x=0\\ \arctan\bigl(\tan(x-\tfrac\pi2)-\tan(b-\tfrac\pi2)\bigr)+\tfrac\pi2 & 0<x<\pi \\ \pi & x=\pi \end{cases} $$ ought to work relatively smoothly, but this version with hyperbolic functions behaves nicer in some respects: $$ g(x,b) = \begin{cases} 0 & x=0\\ \tfrac\pi2 \Bigl(\tanh\bigl(\operatorname{arctanh}(2x/\pi -1)-\operatorname{arctanh}(2b/\pi-1)\bigr)+1\Bigr) & 0<x<\pi \\ \pi & x=\pi \end{cases} $$
"Nicer" is in the eye of the beholder, of course. These proposals both have the general form $$ g(x,b) = \begin{cases} 0 & x=0\\ h^{-1}\bigl(h(x)-h(b)\bigr) & 0<x<\pi \\ \pi & x=\pi \end{cases} $$ where $h$ is an increasing bijection $(0,\pi)\to\mathbb R$ with $h(\pi/2)=0$. This immediately guarantees the properties you specify, as well as continuity in your domain. Furthermore the function is increasing in $x$ and $b$ for fixed $b$ and $x$.
The $\tan$ version has the property that at each fixed $b$ we have $g(\varepsilon, b)\approx\varepsilon$ for small enough $\varepsilon$ (and similarly at the other three edges of the domain, mutatis mutandis). This probably is not what you want, but since I don't know what you want it for it could be exactly what you need.
On the other hand $\operatorname{arctanh}$ gives the nice property that if you graph $g$ for constant $x$ or $b$, there are no inflection points. One would probably usually find that desirable.
For a purely algebraic option you might try $h(x)=\frac{1}{\pi-x}-\frac{1}{x} $, which ought to behave more or less like the tangent option.