自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

思玉

码农

  • 博客(83)
  • 资源 (1)
  • 收藏
  • 关注

原创 unity 圆形障碍,避障算法,动态避障,静态避障,屎壳郎推屎回娘家

1:根据,屎和娘家的位置做计算,不管屎在哪里,获取朝向娘家,屎后面一定距离的位置。3:在推屎过程中出现不可抗拒因素,即时使用Update计算获取新的推屎路线,2:屎壳郎需要跑到屎后面,推屎回娘家,需要进行避障算法。Unity3d圆形障碍避障算法,动态避障,静态避障。

2023-10-25 17:25:54 544

原创 unity shader 幽灵材质

【代码】unity shader 幽灵材质。

2022-08-29 17:44:53 1074 1

原创 unity shader 从RGB到HSV的互转(HSVToRGB)(RGBToHSV)

1.RGB RGB是从颜色发光的原理来设计定的,通俗点说它的颜色混合方式就好像有红、绿、蓝三盏灯,当它们的光相互叠合的时候,色彩相混,而亮度却等于两者亮度之总和,越混合亮度越高,即加法混合。 红、绿、蓝三个颜色通道每种色各分为256阶亮度,在0时“灯”最弱——是关掉的,而在255时“灯”最亮。当三色灰度数值相同时,产生不同灰度值的灰色调,即三色灰度都为0时,是最暗的黑色调;三色灰度都为255时,是最亮的白色调。 在电脑中,RGB的所谓“多少”就是指亮度,并使用整数来表示。通常情况下

2022-01-14 15:04:48 1594

原创 3dmax 去除顶点色去除alpha去除2U ,模型优化,一键处理

上区别图上工具图上码function ColorAlphaClear = ( sel = getCurrentSelection() for a =1 to sel.count do ( if sel[a].modifiers[#skin] != undefined then ( channelInfo.ClearChannel sel[a] 0 --去顶点色 modPanel.setCu

2021-08-31 17:05:02 3111

原创 3dmax 修改顶点色工具(一键修改)

先上图使用方法简述一下:放代码在3dmax安装路径 如:D:\Program Files\Autodesk\3ds Max 2014\scripts 下3dmax种选择 maxscript/运行脚本 选择此脚本上脚本function ClearVertColor = ( undo on --"--"为注释符号 --切换到modify模式(模型修改模式) if (getCommandPanelTaskMode() != #modify) do setCom

2021-08-31 16:53:03 2282

原创 unity ui 扫光shader

_LightTex 1:扫光贴图_Color 2:扫光颜色_Intensity 3:强度_Speed 4:运动速度_Angle 5:扫光贴图uv中心点旋转Shader "Unlit/UIWalklight"{ Properties { _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {} _LightTex ("Light", 2D) = "black" {} _Color ("Color",.

2021-07-28 16:20:20 2188

原创 unity 卡通动物 shader 包含边缘光,ramp,描边

unity 卡通动物 shader 包含边缘光,ramp,描边上shaderShader "Unlit/TestShader"{ Properties { _Diff ("Diff", 2D) = "white" {} _MainColor ("MainColor", Color) = (0,0,0,1) //模型主颜色 _RAMP ("RAMP", 2D) = "white" {} _Light ("Light", Vector) =

2021-06-25 15:40:47 728 2

原创 unity 水晶 石头 shader

unity 水晶 石头 shader上shaderShader "Unlit/CrystalTest"{ Properties { _LayerTex ("Layer Texture", 2D) = "white" {} _LayerTint("Layer Tint", COLOR) = (1,1,1,1) _LayerHeightBias("Layer Height Start Bias", Range(0.0, 0.2)) = 0.1 _HeightTex ("Height

2021-06-25 15:35:59 1791

原创 unity 眼球效果 eyes shader

上图注意:为了避免虹膜在莫个光照角度产生平板光,需要把模型虹膜部分微微往下凹上shader 眼睛部分和眼睛前面晶体部分是分开2个shader眼睛部分Shader "Hero/Eye" { Properties{ //cornea角膜 //Iris虹膜 黑眼球 //sclera巩膜 眼白 _Lum("Luminance", Range(0, 10)) = 4 _MainTex("Base (RGB)", 2D) = "white" {} _IrisColor("cornea

2021-05-19 17:06:31 2356 7

原创 unity 为自己脚本增加材质编辑面板 MaterialEditor

unity 为自己脚本增加材质编辑面板 MaterialEditor如图上代码using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;[CustomEditor(typeof(AraTrail))]public class TrailInspector : Editor{ AraTrail araTrail; void OnEnab

2021-05-18 20:00:56 1771 7

原创 unity 特效制作快捷辅助工具

unity 特效制作快捷辅助工具通过选中节点,鼠标中间点击,弹出配置好的快捷粒子,快速创建模块化粒子上码(注意effectFastList 集合里面的数据需要自己填充)using System.Collections;using System.Collections.Generic;using System.IO;using System.Xml;using UnityEditor;using UnityEngine;public class EffectHelpQuick{ [

2021-03-24 15:13:56 475 3

原创 unity Animation Legacy快捷设置工具

unity Animation Legacy快捷设置工具上码(注意:上面有2张资源图片,需要放在Editor Default Resources文件夹下)using System.Collections;using System.Collections.Generic;using UnityEditor;using UnityEngine;public class AnimationLegacy{ static Texture2D AnimationLegacy_A;//按钮图片1

2021-03-24 15:06:26 446

原创 unity 摄像机导入 3dmax 带fov

unity 摄像机导入 3dmax 带fov先看效果图编写unity 工具1,先把导出的模型拉到摄像机节点下,需要在hierarchy选中摄像机为根节点,然后导出 ,2,导出文件路径在工程Assets同目录下的ExportedObj文件夹里面,这里使用的导出obj插件工具代码主要用要保存摄像机位置,旋转,fov ,等一系列参数, 用与在3dmax 进行还原 Transform[] selection = Selection.GetTransforms(SelectionMod

2021-01-12 15:21:54 2475 1

原创 unity shader 阴影强度颜色和自定义画阴影

有图有真相:上图的操作需求1: 头发部分不受阴影影响2:面部阴影强度调节3:面部阴影强度渐变调节4:面部阴影颜色调节5:其他地方阴影效果不变(衣领部分)上码:Shader "Unlit/阴影强度"{ Properties { _MainTex ("_MainTex", 2D) = "white" {} _Shadows_mask ("Shadows_mask", 2D) = "white" {} _Shadows_mask_pw ("Shadows_mask_pw", 2

2020-12-04 19:21:09 1830

原创 unity shader 溶解,上下左右,cutoff

unity shader 溶解,上下左右,cutoffShader "cutoff" { Properties { _Cutoff ("Cutoff", Float ) = 0 _Mask ("Mask", 2D) = "white" {} _Diffues ("Diffues", 2D) = "white" {} } SubShader { Tags { "Queue"="Al

2020-11-18 19:40:21 1028

原创 unity shader 阴影强度控制 增加mask通道图

阴影强度控制可以修改灯光参数 strength 来进行控制同样也可以来shader 上进行控制下面还增加了mask通道图 用来控制模型不同部位的阴影强度不一样上图 上码Shader "Unlit/阴影强度"{ Properties { _MainTex ("_MainTex", 2D) = "white" {} _Shadows_mask ("Shadows_mask", 2D) = "white" {} //阴影mask _Shadows_R_PW ("Shadows_R_

2020-11-18 17:18:38 965

原创 unity 陀螺仪 物体旋转和移动效果

unity 陀螺仪 物体旋转和移动效果直接上码 带注释public class SDKGyroController : MonoBehaviour {//陀螺仪是否存在 class GyroGameObject { public GameObject go = null; public bool m_IsRotate = false; public bool m_IsBack = false; public Vector3 m_

2020-11-04 16:56:53 2005

原创 unity shader 闪烁+流光

unity shader 闪烁+流光 上图上码Shader "Unlit/流光闪烁"{ Properties { _MainTex ("_MainTex", 2D) = "white" {} _TwinkleSpeed ("TwinkleSpeed", Float ) = 1 //闪烁速度 _TwinkleColor ("TwinkleColor", Color) = (0.5,0.5,0.5,1) //闪烁颜色 _TimeTex("TimeTexture",2D)="whi

2020-11-04 16:22:51 3477

原创 unity shader 华为畅玩7,联发科CPU兼容记录

先来看下 问题的表现shader 里面用到了lightDirectionnormalDirection 但是因为没用规范化,在华为畅玩7,机器上出现表现不一**所以紧记 时刻做规范化,这里修改成saturate(lightDirectionnormalDirection) 即可**...

2020-10-28 15:12:46 319

原创 通过bytes文件头判断图片格式

图片文件可以完全根据前面的两个字节的二进制数字进行判断。比如说bmp类型的,相对应的就是0x42 0x4d,0x42=416+2=66, 0x4d=416+13=77我们就可以在代码中这样写: if (www.bytes[0] == 66 && www.bytes[1] == 77) { BitMap g =newBitMap(); var tex = g.ParseBmp(www.bytes); }几种常见图

2020-10-14 20:44:46 1750

原创 开源解决方案,随笔记录

Unity + Winform 实现窗口置顶、全屏和边框设置、任务栏操作:https://github.com/U3DC/Unity-Winform-Solution支持运行时导入、导出OBJ文件https://github.com/U3DC/Unity_OBJ-file_Import_And_Export文件浏览,类似windows的文件选择窗口https://github.com/U3DC/UnitySimpleFileBrowser(Unity热门插件UnWebView作者)的自动打包方案

2020-10-13 17:48:13 454 1

转载 unity shader 优化变体以及使用IPreprocessShaders剥离

当 shader 使用:#pragma multi_compile _ A1 A2 A3#pragma multi_compile _ B1 B2 B34个multi_compile,2组,一共16个情况3档,2个平台,6个情况,总计16*6=96个变体添加处理:using System.Collections.Generic;using UnityEditor.Build;using UnityEditor.Rendering;using UnityEngine;public cl

2020-09-22 15:27:33 2217

原创 unity shader 边缘光,内发光,外发光,轮廓边缘光,轮廓内边缘光,轮廓外边缘光

先上一张图片,看下实际效果1:黑色为模型主color2:白色为内发光,轮廓内边缘光3:红色为外发光,轮廓外边缘光Shader "Unlit/边缘光"{ Properties { _MainColor ("MainColor", Color) = (0,0,0,1) //模型主颜色 _InSideRimColor ("InSideRimColor", Color) = (1,1,1,1)//内边缘光颜色 _InSideRimPower("InSideRimPower", R

2020-09-10 23:07:06 6846 2

原创 unity google admob ios 接入 聚合激励广告适配器

下面说下躺坑主要是接入google admob 聚合激励广告适配器 ,开启facebook ,unity,admob 广告使用sdk框架接入sdk下载地址:https://developers.google.com/admob/ios/download1:导入主要的库GoogleMobileAds.frameworkGoogleAppMeasurement.frameworkGoogleUtilities.frameworknanopb.framework对应聚合各个平台sdk 地址:h

2020-09-09 21:20:10 1221

原创 unity android ping代码 随笔

这里是使用的android 自己的Exec 执行ping 并且获取到最终结果废话不多,先上java 代码 public static void RuntimeExecAsync(Context context, final String command) { Thread thread = new Thread() { public void run() { StringBuffer stringBuffer = new StringBuffer(); Process p =

2020-08-19 20:02:01 513

原创 GfxDeviceMetal::GetPipeline(GfxDeviceMetal::PipeKey const&) + 8207248 (GfxDeviceMetal.mm:432)

unity ios 加载资源 CrashedHardware Model: iPhone9,2Process: legends [1828]Path: /private/var/containers/Bundle/Application/F18FEE9D-E1BE-4908-B1D7-677DCE781FC9/legends.app/legendsVersion: 1.4.94.5371 (1.4.94)Cod

2020-08-19 19:20:11 945

原创 unity3d 计算Particle Prefab真实生命时间

通过计算的方式,获取一个特效prefab 是真实生命时间,废话不错上代码 public float GetLifeTime(ParticleSystem[] pls) { float lifeTime = 0;//lifeTime如果是-1 那就是一个loop的特效 for (int i = 0; i < pls.Length; i++) { if (pls[i] !

2020-07-23 14:49:17 314

原创 unity3d moba游戏,英雄展示优化浅谈

如图英雄展示模块,性能浅谈1:fps处理这里主要是通过对线上大数据分析和资源制作的实际情况来找到平衡点,我们的数据都是东南亚市场,实际硬件水平比较低,下图,是我们对应的英雄在玩家性能市场的实际表现情况1:包体大小控制2:当前show hero 过程中的平均fps (要求在26以上)3:当前英雄资源加载的耗时 (要求在900ms以下)对应上面2点数据对实际的资源情况进行分析,下图包体大小占比:particle(10-25%) texture(40-70%) mesh(7-20%)

2020-07-23 14:20:48 445

原创 unity3d android 图片插入相册显示 Insert Image To MediaStore

unity3d android 图片插入相册显示废话不多直接上代码 public static void InsertImageToMediaStore(string filePath, string fileName) { if (string.IsNullOrEmpty(filePath) || string.IsNullOrEmpty(fileName)) { return; }#if (UNITY_ANDRO

2020-05-09 18:52:19 276

原创 unity3d android获取app 包名

unity3d android获取app 包名废话不多直接上代码 public static string GetPackageName() { string _strPackageName = "null"; if (string.IsNullOrEmpty(_strPackageName)) { _strPackageName = "null";#if (UNITY_ANDROID && !UN

2020-05-09 18:44:31 1257

原创 unity3d android 获取是否安装app

unity3d android 获取是否安装app废话不多直接上代码 public static bool IsInstallApp(string packageAndroidName) {#if (UNITY_ANDROID && !UNITY_EDITOR) || ANDROID_CODE_VIEW try { using (AndroidJavaClass unityPlayer = n

2020-05-09 18:41:03 337

原创 unity3d 获取内存 android Used PssMemory

unity3d 获取内存 android Used PssMemory废话不多直接上代码 public static int GetUsedPssMemory() { int memory = -1;#if (UNITY_ANDROID && !UNITY_EDITOR) || ANDROID_CODE_VIEW try { using (AndroidJavaClass unityPlayer = ne

2020-05-09 18:32:36 1153

原创 unity3d 获取android 手机所有安装的apk 和包名

unity3d 获取android 手机所有安装的apk 和包名废话不多直接上代码 public static List<string> GetAllApk() { List<string> apks = new List<string>(); #if (UNITY_ANDROID && !UNITY_EDITOR) || ANDROID_CODE_VIEW try

2020-05-09 18:30:23 499

原创 unity3d 获取 Advertising ID

unity3d 获取Advertising ID废话不多直接上代码 public static string GetAdvertisingID() { string _strAdvertisingID = "none"; if (string.IsNullOrEmpty(_strAdvertisingID)) { _strAdvertisingID = "none";#if (UNITY_ANDROID &&

2020-05-09 18:27:36 1616 1

原创 unity3d 获取android id

unity3d 获取android id废话不多直接上代码 public static string GetAndroidID() { string _strAndroidID = "none"; if (string.IsNullOrEmpty(_strAndroidID)) { _strAndroidID = "none";#if (UNITY_ANDROID && !UNITY_EDITOR)

2020-05-09 18:25:17 1704

原创 Sub-emitters must be children of the system that spawns them

关于unity引擎相关错误:Sub-emitters must be children of the system that spawns them解答:在编辑器重现方式Particle System 的Sub Emitters 属性里面,绑定的节点,只能是自己的子节点对象如图:Particle System1 的Sub Emitters 属性绑定children节点,同时Particle System2 也绑定了children节点,就会出现这样错误,特效在制作的时候为了方便, 往往去co

2020-05-09 17:42:15 5049 1

原创 unity3d 加载卡顿,File.Exists 罪魁祸首之天坑

File.Exist 是用来判定文件是否存在,然后进行加载的常用逻辑,但也是造成加载卡顿的 罪魁祸首,这里测试,在华为v10 ,1加手机,会特别明显, 我用moto手机测试感觉没什么问题,也许跟手机装的app数量也有关系,总之对于这方法尽量避免使用,下面说明一下这个方法的测试情况:测试机器:华为v10目录下文件数量:13749判定不存在的文件:消耗30ms-45ms不等判定存在的文件...

2020-01-14 20:05:10 5003

原创 The AssetBundle 'Memory' could not be loaded because it .. Rebuild the AssetBundle to fix this error

关于unity引擎相关错误:a_1)The AssetBundle ‘Memory’ can’t be loaded because it was not built with the right version or build target.a_2)The AssetBundle ‘hero_fanny_skin.unity3d’ can’t be loaded because it wa...

2020-01-14 19:36:17 1386 1

原创 The AssetBundle 'Memory' can't be loaded because it was not built with the right version or build ta

关于unity引擎相关错误:a_1)The AssetBundle ‘Memory’ can’t be loaded because it was not built with the right version or build target.a_2)The AssetBundle ‘hero_fanny_skin.unity3d’ can’t be loaded because it wa...

2020-01-14 19:35:10 2960 7

原创 unity3d The file none is corrupted!Remove it and launch unity again! Position out of bounds!

关于unity引擎错误:The file none is corrupted!Remove it and launch unity again! Position out of bounds!解答:这个错误是unity 一个cache 的bug1,unity引擎 读取缓冲的时候 cachedreader 条件是用缓冲地址加长度判断,如果没这个错误就从缓冲内存返回数据2,unity的Cach...

2020-01-14 19:27:26 4372

水晶.unitypackage

unity shader 水晶

2021-06-25

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除