![](/img/trans.png)
[英]Why is my GameObject traveling along the ray I am casting when I set transform.position = hit.point? Unity 3D
[英][UNITY 3D VR]Why does my image look like it has weird noise when I set it as texture on runtime, but not when set as default?
我尝试了六个小时,但我不知道。 我使用 jpg 文件作为素材。 当我将它设置为我的项目中的材质时,一切都很好,但是如果我通过 http 下载相同的文件并将其设置为材质的主要纹理,它就会有奇怪的噪音。 如果我站得很近,噪音就消失了。 当我将文件转换为 png 格式时,我看到了相同的结果。 当我改变纵横比和使用不同的着色器时,结果也是一样的。 您是否知道导致差异的原因,以及我可以做些什么来获得一致的结果而没有噪音?
MeshRenderer textileBoxRender = textileImageShowBox.GetComponent<MeshRenderer>();
Texture myTexture = ((DownloadHandlerTexture)www.downloadHandler).texture;
Debug.Log("Downloag Texture Suceeful!!!");
textileBoxRender.material.SetTexture("_MainTex", myTexture);
这需要我 20 多个小时,这是 mipmap 问题,当你导入统一时,它会自动检查 mipmap 选项,但如果你从 http 下载,它不会生成 mipmap
Texture2D tx1 = ((DownloadHandlerTexture)www.downloadHandler).texture;
var tx2 = new Texture2D(tx1.width, tx1.height);
tx2.SetPixels(tx1.GetPixels());
tx2.Apply(true);
HeroObject.GetComponent<Renderer>().material.mainTexture = tx2;
问题解决了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.