Hello
I have a VR project, a sphere object and a camera inside.
The texture on the sphere is loaded using WWW.
code with WWW
[SerializeField] private MeshRenderer SphereMesh;
private Texture2D texture;
void Start()
{
texture = new Texture2D(8192, 4096);
SphereMesh.material.mainTexture = texture;
StartCoroutine(InitializeVR("http://server/im1.jpg"));
}
IEnumerator InitializeVR(string url)
{
WWW www = new WWW(url);
yield return www;
www.LoadImageIntoTexture(texture);
Screen.orientation = ScreenOrientation.LandscapeLeft;
www.Dispose();
}
But Unity writes that WWW is deprecated
So I decided to translate the code to UnityWebRequest
code with UnityWebRequest
void Start()
{
StartCoroutine(setHDR("http://server/im1.jpg"));
}
IEnumerator setHDR(string url)
{
using (UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(url))
{
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.Log(uwr.error);
}
else
{
SphereMesh.material.mainTexture = DownloadHandlerTexture.GetContent(uwr);
Screen.orientation = ScreenOrientation.LandscapeLeft;
Debug.Log("complete");
}
}
}
Everything works, but artifacts appear in the image and when the user turns the camera, this is even more visible.