Radiation of an object with a temperature gradient Case 1: Suppose I have an infinite slab of thickness $D$ connected on one end to a heat bath at temperature $T_B.$ The other end of the slab is exposed to a vacuum, and is at temperature $T_E.$ The material is not necessarily a perfect Black Body.
Case 2: The situation is the same, except now the entire slab is at a uniform temperature $T_E.$
Question: would the total emitted electromagnetic radiation, $\varepsilon_{\rm eff}(T) \sigma A T^4,$ be different in these two cases? In other words, does the presence of a temperature gradient affect the radiation which is emitted, or is the surface temperature only what is important?
For a less contrived example, the sun has a much different temperature at the core than it does at the surface. Would the sun "seem" the same if its temperature throughout the entirety of it were just the surface temperature?
 A: You haven't given sufficient information. What we need to know is the opacity as a function of wavelength, or more specifically, at what temperature the optical depth becomes unity as a function of wavelength.
For the case of the temperature gradient, let us assume that the physical thickness of the slab is big enough to not allow any radiation through it. Further, assume that the opacity is wavelength-independent. In which case the spectrum will be roughly a Planck function at the temperature where the optical depth into the slab is around 2/3. The surface brightness would be higher than $\sigma T_E^4$.
If the opacity depends on wavelength then you get a pseudo-blackbody spectrum with absorption features - much like the solar spectrum.
The slab at uniform temperature is a physical impossibility if it is emitting radiation. Assuming you could approximate to that, then the temperature at which the optical depth reaches 2/3 would be lower than in the steeper temperature gradient case - the surface brightness would be closer to $\sigma T_E^4$.
If the Sun had the same (or similar) temperature to its effective temperature all the way through then the spectrum would be that of a blackbody at that temperature. There would be no absorption features in the spectrum.
A: The answer is a complicated integral. first assuming you have the temperature of a slab of length L which is a function of variable $x$ and $T(0) = T_e$ and $T(L) = T_b$.
In linear case to simplify we have: $$T = T_e + x/L (T_b-T_e)$$
Then if you want to know the radiation from the surface of the slab $A_s$ to another surface $A_o$ then the heat transfer in W/m2 should be given by the hard definition of the view factor:
$$ \Phi = - \frac{ \epsilon_s \sigma}{A_s} \int_{A_s} \int_{A_o} T(x_s)^4 (\mathbf{r_{s,o}} . \mathbf{d A_o}) (\mathbf{r_{s,o}} . \mathbf{d A_s})  $$
with $\mathbf{r_{s,o}} = \mathbf{r_s} - \mathbf{r_o}$, and $\mathbf{r_s} = x_s \mathbf{e_x} + y_s \mathbf{e_y} + z_s \mathbf{e_z}$. It is quite difficult but not impossible to integrate if $T$ is just a linear function. But keep in mind that is a double surface integral, you can compute manually for easy geometry like plate slab and plate target surface, but it can be awful and can required numerical computation for hard geometry or temperature dependence.
