ARinChina-增强现实中国技术论坛

标题: APP ColAR Mix 解析 [打印本页]

作者: 爱生活爱AR    时间: 2014-1-22 10:37
提示: 作者被禁止或删除 内容自动屏蔽
作者: click    时间: 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了
作者: 爱生活爱AR    时间: 2014-1-29 20:17
提示: 作者被禁止或删除 内容自动屏蔽
作者: 777    时间: 2014-2-2 23:12
我想说的是。
呵呵 最近研究粒子特效的时候  突然发现 里面的有些动画  也是粒子做的 。
这样整 既省时又省力呵呵
作者: kvaliu    时间: 2014-3-28 15:10
click 发表于 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了

能说下是怎么知道截图位置和正确的大小的啊,谢谢
作者: 777    时间: 2014-6-18 14:37
  1. using System;
  2. using UnityEngine;
  3. public class BGRenderingBehaviour : MonoBehaviour
  4. {
  5.         //
  6.         // Fields
  7.         //
  8.         private int mScreenWidth;

  9.         private int mScreenHeight;

  10.         private bool mFlipHorizontally;

  11.         public Camera Camera;

  12.         private QCARRenderer.VideoTextureInfo mTextureInfo;

  13.         private ScreenOrientation mScreenOrientation;

  14.         //
  15.         // Methods
  16.         //
  17.         public void CheckAndSetActive (bool isActive)
  18.         {
  19.                 if (this.Camera.gameObject.active != isActive)
  20.                 {
  21.                         this.Camera.gameObject.SetActiveRecursively (isActive);
  22.                 }
  23.         }

  24.         private Mesh CreateVideoMesh ()
  25.         {
  26.                 Mesh mesh = new Mesh ();
  27.                 mesh.vertices = new Vector3[4];
  28.                 Vector3[] vertices = mesh.vertices;
  29.                 for (int i = 0; i < 2; i++)
  30.                 {
  31.                         for (int j = 0; j < 2; j++)
  32.                         {
  33.                                 float num = (float)j / 1f - 0.5f;
  34.                                 float num2 = 1f - (float)i / 1f - 0.5f;
  35.                                 vertices [i * 2 + j].x = num * 2f;
  36.                                 vertices [i * 2 + j].y = 0f;
  37.                                 vertices [i * 2 + j].z = num2 * 2f;
  38.                         }
  39.                 }
  40.                 mesh.vertices = vertices;
  41.                 mesh.triangles = new int[24];
  42.                 int num3 = 0;
  43.                 float num4 = (float)this.mTextureInfo.imageSize.x / (float)this.mTextureInfo.textureSize.x;
  44.                 float num5 = (float)this.mTextureInfo.imageSize.y / (float)this.mTextureInfo.textureSize.y;
  45.                 mesh.uv = new Vector2[4];
  46.                 int[] triangles = mesh.triangles;
  47.                 Vector2[] uv = mesh.uv;
  48.                 for (int k = 0; k < 1; k++)
  49.                 {
  50.                         for (int l = 0; l < 1; l++)
  51.                         {
  52.                                 int num6 = k * 2 + l;
  53.                                 int num7 = k * 2 + l + 2 + 1;
  54.                                 int num8 = k * 2 + l + 2;
  55.                                 int num9 = k * 2 + l + 1;
  56.                                 triangles [num3++] = num6;
  57.                                 triangles [num3++] = num7;
  58.                                 triangles [num3++] = num8;
  59.                                 triangles [num3++] = num7;
  60.                                 triangles [num3++] = num6;
  61.                                 triangles [num3++] = num9;
  62.                                 uv [num6] = new Vector2 ((float)l / 1f * num4, (float)k / 1f * num5);
  63.                                 uv [num7] = new Vector2 ((float)(l + 1) / 1f * num4, (float)(k + 1) / 1f * num5);
  64.                                 uv [num8] = new Vector2 ((float)l / 1f * num4, (float)(k + 1) / 1f * num5);
  65.                                 uv [num9] = new Vector2 ((float)(l + 1) / 1f * num4, (float)k / 1f * num5);
  66.                                 if (this.mFlipHorizontally)
  67.                                 {
  68.                                         uv [num6].x = 1f - uv [num6].x;
  69.                                         uv [num7].x = 1f - uv [num7].x;
  70.                                         uv [num8].x = 1f - uv [num8].x;
  71.                                         uv [num9].x = 1f - uv [num9].x;
  72.                                 }
  73.                         }
  74.                 }
  75.                 mesh.triangles = triangles;
  76.                 mesh.uv = uv;
  77.                 mesh.normals = new Vector3[mesh.vertices.Length];
  78.                 mesh.RecalculateNormals ();
  79.                 return mesh;
  80.         }

  81.         private void PositionVideoMesh ()
  82.         {
  83.                 this.mScreenOrientation = QCARRuntimeUtilities.ScreenOrientation;
  84.                 this.mScreenWidth = Screen.width;
  85.                 this.mScreenHeight = Screen.height;
  86.                 base.gameObject.transform.localRotation = Quaternion.AngleAxis (270f, Vector3.right);
  87.                 if (this.mScreenOrientation == ScreenOrientation.LandscapeLeft)
  88.                 {
  89.                         base.gameObject.transform.localRotation *= Quaternion.identity;
  90.                 }
  91.                 else
  92.                 {
  93.                         if (this.mScreenOrientation == ScreenOrientation.Portrait)
  94.                         {
  95.                                 base.gameObject.transform.localRotation *= Quaternion.AngleAxis (90f, Vector3.up);
  96.                         }
  97.                         else
  98.                         {
  99.                                 if (this.mScreenOrientation == ScreenOrientation.LandscapeRight)
  100.                                 {
  101.                                         base.gameObject.transform.localRotation *= Quaternion.AngleAxis (180f, Vector3.up);
  102.                                 }
  103.                                 else
  104.                                 {
  105.                                         if (this.mScreenOrientation == ScreenOrientation.PortraitUpsideDown)
  106.                                         {
  107.                                                 base.gameObject.transform.localRotation *= Quaternion.AngleAxis (270f, Vector3.up);
  108.                                         }
  109.                                 }
  110.                         }
  111.                 }
  112.                 base.gameObject.transform.localScale = new Vector3 (1f, 1f, 1f * (float)this.mTextureInfo.imageSize.y / (float)this.mTextureInfo.imageSize.x);
  113.                 this.Camera.orthographic = true;
  114.                 float orthographicSize;
  115.                 if (this.ShouldFitWidth ())
  116.                 {
  117.                         if (QCARRuntimeUtilities.IsPortraitOrientation)
  118.                         {
  119.                                 orthographicSize = (float)this.mTextureInfo.imageSize.y / (float)this.mTextureInfo.imageSize.x * ((float)this.mScreenHeight / (float)this.mScreenWidth);
  120.                         }
  121.                         else
  122.                         {
  123.                                 orthographicSize = (float)this.mScreenHeight / (float)this.mScreenWidth;
  124.                         }
  125.                 }
  126.                 else
  127.                 {
  128.                         if (QCARRuntimeUtilities.IsPortraitOrientation)
  129.                         {
  130.                                 orthographicSize = 1f;
  131.                         }
  132.                         else
  133.                         {
  134.                                 orthographicSize = (float)this.mTextureInfo.imageSize.y / (float)this.mTextureInfo.imageSize.x;
  135.                         }
  136.                 }
  137.                 this.Camera.orthographicSize = orthographicSize;
  138.         }

  139.         public void SetFlipHorizontally (bool flip)
  140.         {
  141.                 this.mFlipHorizontally = flip;
  142.         }

  143.         public void SetTexture (Texture texture)
  144.         {
  145.                 base.renderer.material.mainTexture = texture;
  146.         }

  147.         private bool ShouldFitWidth ()
  148.         {
  149.                 float num = (float)this.mScreenWidth / (float)this.mScreenHeight;
  150.                 float num2;
  151.                 if (QCARRuntimeUtilities.IsPortraitOrientation)
  152.                 {
  153.                         num2 = (float)this.mTextureInfo.imageSize.y / (float)this.mTextureInfo.imageSize.x;
  154.                 }
  155.                 else
  156.                 {
  157.                         num2 = (float)this.mTextureInfo.imageSize.x / (float)this.mTextureInfo.imageSize.y;
  158.                 }
  159.                 return num >= num2;
  160.         }

  161.         private void Start ()
  162.         {
  163.                 if (this.Camera == null)
  164.                 {
  165.                         this.Camera = Camera.main;
  166.                 }
  167.         }

  168.         private void Update ()
  169.         {
  170.                 if (QCARRenderer.Instance.IsVideoBackgroundInfoAvailable ())
  171.                 {
  172.                         QCARRenderer.VideoTextureInfo videoTextureInfo = QCARRenderer.Instance.GetVideoTextureInfo ();
  173.                         if (!this.mTextureInfo.imageSize.Equals (videoTextureInfo.imageSize) || !this.mTextureInfo.textureSize.Equals (videoTextureInfo.textureSize))
  174.                         {
  175.                                 this.mTextureInfo = videoTextureInfo;
  176.                                 Debug.Log (string.Concat (new object[]
  177.                                 {
  178.                                         "VideoTextureInfo ",
  179.                                         videoTextureInfo.textureSize.x,
  180.                                         " ",
  181.                                         videoTextureInfo.textureSize.y,
  182.                                         " ",
  183.                                         videoTextureInfo.imageSize.x,
  184.                                         " ",
  185.                                         videoTextureInfo.imageSize.y
  186.                                 }));
  187.                                 MeshFilter meshFilter = base.GetComponent<MeshFilter> ();
  188.                                 if (meshFilter == null)
  189.                                 {
  190.                                         meshFilter = base.gameObject.AddComponent<MeshFilter> ();
  191.                                 }
  192.                                 meshFilter.mesh = this.CreateVideoMesh ();
  193.                                 this.PositionVideoMesh ();
  194.                         }
  195.                         else
  196.                         {
  197.                                 if (this.mScreenOrientation != QCARRuntimeUtilities.ScreenOrientation || this.mScreenWidth != Screen.width || this.mScreenHeight != Screen.height)
  198.                                 {
  199.                                         this.PositionVideoMesh ();
  200.                                 }
  201.                         }
  202.                 }
  203.         }
  204. }
复制代码

作者: 777    时间: 2014-6-18 14:39
抓取 图片设置成贴图 图片。
作者: zeroAR    时间: 2014-7-29 22:32
777 发表于 2014-6-18 14:39
抓取 图片设置成贴图 图片。

那怎么抓取呐?
作者: 大白菜    时间: 2014-7-30 10:06
zeroAR 发表于 2014-7-29 22:32
那怎么抓取呐?

自己看代码
作者: zeroAR    时间: 2014-7-30 14:19
大白菜 发表于 2014-7-30 10:06
自己看代码

这代码我测试过了 只是创建了 对应的MESH ~~

抓图 不在这代码里面吧
作者: 无涯    时间: 2014-8-1 11:33
您好,我之前都没有学过在这些,想问下要在App中做Ar技术,要准备些什么东西,0基础啊
作者: xmastor    时间: 2014-8-7 15:53
这个官方有没有例子?
作者: xmastor    时间: 2014-8-8 10:20
777 发表于 2014-6-18 14:37

请问,高通官网有例子吗
作者: glue    时间: 2014-8-8 17:34
请问一下怎么抓取图片.初学小白,请各位大神指点指点.
作者: a314521063    时间: 2014-11-30 22:50
这个很不错的啊啊
作者: Mec0825    时间: 2014-12-1 10:49
看看去~
作者: a314521063    时间: 2014-12-1 13:42
Mec0825 发表于 2014-12-1 10:49
看看去~

怎么抓取图像的呢?可以留个QQ吗?
作者: xmastor    时间: 2014-12-5 11:08
click 发表于 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了

能告诉下脚本名称吗,用了BGRenderingBehaviour,发现只是单纯创建了一个mesh,没有设置贴图,能指教下吗
作者: oscarlew    时间: 2015-3-13 11:02
777 发表于 2014-6-18 14:39
抓取 图片设置成贴图 图片。

请问这个QCARRenderer类是楼主自己写的还是vuforia的sdk中的 我现在是用最新的sdk 没有找到这个类如果楼主方便能否发给我QCARRenderer类 我想研究一下Ar 最近项研究一下AR技术
作者: zleisure    时间: 2015-3-17 09:46
刚看看这个,怎么像是高通里面有的用于生成mesh供显示摄像机图像的代码啊
作者: cooperfinger    时间: 2015-3-26 16:33
楼主加我qq或者微信吧 想跟你热切讨论
qq 7160710
微信 jjn1q84
作者: allrightzhu    时间: 2015-4-30 09:23
click 发表于 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了

请问一下他这款app用unity3D+vuforia大概实现步骤是怎样的啊,貌似扫描的标识图并不是贴图啊
作者: zleisure    时间: 2015-5-9 14:52
埋头苦干多日,终于攻克
作者: win123k    时间: 2015-5-14 16:15
zleisure 发表于 2015-5-9 14:52
埋头苦干多日,终于攻克

这么厉害!!能加你QQ吗?我的QQ635083446,我这里刚好需要开发类似colAR Mix之类的AR项目,可以的话 可以有商业合作!谢谢
作者: win123k    时间: 2015-5-14 16:16
click 发表于 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了

你一个人就搞定啦!?这么厉害!!能加你QQ吗?我的QQ635083446,我这里刚好需要开发类似colAR Mix之类的AR项目,可以的话 可以有商业合作!谢谢
作者: win123k    时间: 2015-5-14 16:19
777 发表于 2014-2-2 23:12
我想说的是。
呵呵 最近研究粒子特效的时候  突然发现 里面的有些动画  也是粒子做的 。
这样整 既省时又 ...

您好,管理员你很尽责啊!很少有看到对着这行那么有热情和敬业的!点赞!!! 我能加你QQ吗?我的QQ635083446,我这里刚好需要开发类似colAR Mix之类的AR项目,可以的话 可以有商业合作!谢谢
作者: lioyiphy    时间: 2015-10-26 15:48
777 发表于 2014-6-18 14:37

你做成了吗,大哥,好像很难的样子,没思路
作者: lioyiphy    时间: 2015-10-26 16:07
click 发表于 2014-1-26 00:50
貌似我们已经搞定了这个,可以自己做了

可以和我说说怎么整的吗,老大,
作者: x100568    时间: 2015-10-27 12:32
楼主,我想知道,识别图后抓取纹理稍微的有些不对,会把背景图的部分拾取到模型,这个怎么解决,还有就是横屏时就会出问题。
作者: wstam    时间: 2016-3-23 16:56

干兴趣请联系QQ:316176765,大家一起探讨




欢迎光临 ARinChina-增强现实中国技术论坛 (http://dev.arinchina.com/) Powered by Discuz! X3.2