https://docs.unity3d.com/ScriptReference/Texture2D.SetPixels.html

显示mipmaplevel 需要贴图可读写不压缩

using UnityEngine;
using System.Collections; public class ExampleClass : MonoBehaviour
{
void Start()
{
Renderer rend = GetComponent<Renderer>(); // duplicate the original texture and assign to the material
Texture2D texture = Instantiate(rend.material.mainTexture) as Texture2D;
rend.material.mainTexture = texture; // colors used to tint the first 3 mip levels
Color[] colors = new Color[3];
colors[0] = Color.red;
colors[1] = Color.green;
colors[2] = Color.blue;
int mipCount = Mathf.Min(3, texture.mipmapCount); // tint each mip level
for (int mip = 0; mip < mipCount; ++mip)
{
Color[] cols = texture.GetPixels(mip);
for (int i = 0; i < cols.Length; ++i)
{
cols[i] = Color.Lerp(cols[i], colors[mip], 0.33f);
}
texture.SetPixels(cols, mip);
}
// actually apply all SetPixels, don't recalculate mip levels
texture.Apply(false);
}
}

unity 显示mipmaplevel的更多相关文章

  1. Android开发实例 Unity显示Toast

    Android中的Toast是一种简易的消息提示框. 当视图显示给用户,在应用程序中显示为浮动.和Dialog不一样的是,它永远不会获得焦点,无法被点击.用户将可能是在中间键入别的东西.Toast类的 ...

  2. Unity 显示FPS(C#语言)

    直接上脚本了: using UnityEngine; using System.Collections; public class ShowFPS : MonoBehaviour { //设置帧率 A ...

  3. unity 显示帧率

    Game视图右上角Stats按钮按下即可显示统计信息.

  4. unity 显示、隐藏Android导航栏

    1.下面的返回.home栏可用Screen.fullScreen控制 2.导航栏的显示和隐藏用下面代码控制 private AndroidJavaObject currentActivity { ge ...

  5. unity, 显示像素图,以及iOS下像素图变模糊解决办法

    在PS里画了个16x16像素的图: 在webplayer下Filter Mode选为Point,显示效果为: 在ios下显示效果为: 是由于iOS下会将图片压缩为pvr所致,想得到清晰的效果,需将Fo ...

  6. Unity游戏开发图片纹理压缩方案

    Unity3D引擎对纹理的处理是智能的:不论你放入的是PNG,PSD还是TGA,它们都会被自动转换成Unity自己的Texture2D格式. 在Texture2D的设置选项中,你可以针对不同的平台,设 ...

  7. Unity --- 纹理压缩基本知识点

    1.Unity支持的压缩格式的分类,这里主要指Android平台和IOS平台: DXT格式 --- Nvidia Tegra(图睿)提供ETC  --- 安卓原生支持的,OPNEGL2.0都支持,ET ...

  8. 【Unity】8.5 扩展编辑器

    分类:Unity.C#.VS2015 创建日期:2016-04-27 一.简介 可以通过编辑器窗口 (Editor Windows) 创建自己在 Unity 中的自定义设计工具.来自EditorWin ...

  9. Ubuntu:如何显示系统托盘图标(systray)

    1. 问题说明 Ubuntu 11版本开始,默认关闭了托盘图标的显示,需要手动执行命令或额外工具配置,添加到白名单.Ubuntu 13.04更彻底,默认配置根本没有托盘图标,除了java和wine等几 ...

随机推荐

  1. Word截图PNG,并压缩图片大小

    static void Main(string[] args) { var iso = new ImageSaveOptions(SaveFormat.Png); iso.PrettyFormat = ...

  2. Android与html5交互 -- WebView使用(一)

    Android中使用WebView可加载html5,具体步骤如下: (前提:本地Html5存放到assets文件夹下) 一:使用WebView加载Html5,简单显示 1:清单文件中添加访问权限:an ...

  3. 【JBPM4】创建流程实例

    示例代码: ProcessEngine processEngine = Configuration.getProcessEngine(); ExecutionService executionServ ...

  4. AC日记——魔法森林 洛谷 P2387

    魔法森林 思路: spfa水过(正解lct); 代码: #include <bits/stdc++.h> using namespace std; #define maxn 50005 # ...

  5. C#读取RSS源,并利用Solr索引

    折磨我几天的问题今天终于解决了,分享一下近期solr使用的一些经验. 本来是用nutch在爬取页面,可是客户需要爬取RSS,而且可以识别那些页面是通过RSS源抓取出来的.nutch虽然自带解析RSS的 ...

  6. jquery&javascript 跨域jsonp

    $(function(){ $.ajax({ type: "get", async: false, url: "http://flightQuery.com/jsonp/ ...

  7. 8种json数据查询方式

    你有没有对“在复杂的JSON数据结构中查找匹配内容”而烦恼.这里有8种不同的方式可以做到: JsonSQL JsonSQL实现了使用SQL select语句在json数据结构中查询的功能. 例子: ? ...

  8. CentOS7安装和配置rsync+inotify

    (1)rsync介绍 1.rsync介绍 开源,实现全量及增量的本地或远程数据同步备份工具 2.工作场景: 存储实时备份:rsync+inotify 定时备份:rsync+crond 3.rsync工 ...

  9. centos 时间日期设置

    date  时间窗口 date -s '2015-02-02 10:10:00'  更改年月日小时分秒 date -s 10:00:02  只更改时间 不更改年月 clock -w 写入系统时间 hw ...

  10. nodejs安装sharp出错的问题

    PS D:\report\source\lpd-planning-allocation> yarn yarn install v1.3.2 [/] Resolving packages... [ ...