Currently, I am attempting to envelop a SphereBufferGeometry with a ShaderMaterial that incorporates noise to mimic the surface of Jupiter. However, the wrapping on the sphere geometry is turning out peculiarly. Instead of wrapping around the 'planet' in a normal texture manner, all the animated texture seems to be concentrated in a narrow band around one specific line of latitude. Images illustrating this issue have been provided below.
The shader works flawlessly on a plane, but my assumption that it would wrap like a standard texture was likely naive. Since I am relatively new to Shader programming, I find myself at a bit of an impasse.
Here is the plane with correct wrapping
This image shows the incorrect wrapping
I suspect that moving the noise equations to the fragmentShader might offer a solution, but my current knowledge is insufficient as my attempts resulted in failure. I also tried transforming the plane targets into a sphere; however, ShaderMaterial does not inherently support morphTargets and despite numerous efforts using
#include <morphtarget_pars_vertex>
within onBeforeCompile
, I couldn't get it to function correctly. Additionally, using THREE's wrapping equations on the uniform texture yielded similar outcomes.
Below is all of my code, where the shaderMaterial implementation can be found in addPlanet()
:
[Code example here]