how to get differ forword rendering from differred rendering in shader

as i want shader work the same between forward rendering and differred rendering…

Thats not reasonably possible. Already the fact that shadows aside of a single directional light don’t exist in forward and that dual lightmapping is a deferred only feature make it rather obvious that this will not happen unless you drop both features among others naturally.

Thats why surface shaders basically were introduced, to get a shader that leads to the same surface behavior independent of the renderpath.
But to do so the shaders will need to differ.

Also people won’t accept the performance hit from deferred if you take away the benefits (and it makes no sense to do so, just don’t allow deferred if you don’t want to use it anyway)

not all card support differred rendering…

the fatal thing is that the layer of light can’t work in defferred rendering,that fatal…as my artist want the character in the scene can be affect by more than one directional light from different direction to act as more color full