JSFiddle - React, Tailwind, and code Playground
HTML
<svg width="512" height="512" viewBox="0 0 1 1"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>An attempt to create a perfect sphere in SVG</desc>
<defs>
<!-- First we want to create a bump map to feed it into feDiffuseLighting -->
<!-- We want to reproduce the function sqrt(1-r^2) -->
<!-- The function r is a simple radial gradient -->
<radialGradient id="myGrad" cx=".5" cy=".5" r=".5">
<stop offset="0%" stop-color="black" />
<stop offset="100%" stop-color="white" />
</radialGradient>
<filter id="spherebump" filterUnits="objectBoundingBox"
x="0%" y="0%" width="100%" height="100%">
<!-- We reproduce the sqrt(1-r^2) function by applying subsequenct component transfers -->
<!-- r^2 -->
<feComponentTransfer>
<feFuncR type="gamma" amplitude="1" exponent="2" offset="0"/>
<feFuncG type="gamma" amplitude="1" exponent="2" offset="0"/>
<feFuncB type="gamma" amplitude="1" exponent="2" offset="0"/>
</feComponentTransfer>
<!-- 1-r^2 -->
<feComponentTransfer>
<feFuncR type="linear" intercept="1" slope="-1"/>
<feFuncG type="linear" intercept="1" slope="-1"/>
<feFuncB type="linear" intercept="1" slope="-1"/>
</feComponentTransfer>
<!-- sqrt(1-r^2) -->
<feComponentTransfer>
<feFuncR type="gamma" amplitude="1" exponent=".5" offset="0"/>
<feFuncG type="gamma" amplitude="1" exponent=".5" offset="0"/>
<feFuncB type="gamma" amplitude="1" exponent=".5" offset="0"/>
</feComponentTransfer>
<!-- Convert this to the alpha channel (feDiffuseLighting expects it there) -->
<feColorMatrix type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0" />
<!-- Create the Phong shading, sufaceScale sets the height of the sphere -->
<feDiffuseLighting surfaceScale="256">
...