ray

Cesium中级教程3

[亡魂溺海] 提交于 2020-03-01 00:26:47
Cesium中文网: http://cesiumcn.org/ | 国内快速访问: http://cesium.coinidea.com/ Camera CesiumJS中的Camera控制场景的视图。有很多方法可以操作Camera,如旋转(rotate)、缩放(zoom)、平移(pan)和飞到目的地(flyTo)。CesiumJS有鼠标和触摸事件用来处理与Camrea的交互,还有API来以编程方式操作摄像机。了解如何使用Camera API和自定义相机控制(Camera controls)。 默认Camera行为 打开Sandcastle中的 Hello World 样例用来体验默认的相机控制。默认操作方式如下: 鼠标操作 3D 2D Columbus视角 Left click + drag Rotate around the globe Translate over the map Translate over the map Right click + drag Zoom in and out Zoom in and out Zoom in and out Middle wheel scrolling Zoom in and out Zoom in and out Zoom in and out Middle click + drag Tilt the globe No

【译】光线跟踪:理论与实现(二)Phong模型,镜面反射及阴影

非 Y 不嫁゛ 提交于 2020-02-28 21:03:47
译注 个人先对 第一篇 的流程做个总结,从一个固定的光源点向一定范围发射出一些主要的光线,想象光线前方有一个巨大的虚拟平面,那么我们要做的就是决定这个虚拟平面上每个像素点的颜色是什么。如何决定呢?很简单,我们跟踪光线前进,看光线会最先与前面场景中哪个几何体发生相交,那么就根据相交点来决定虚拟平面上对应的点的颜色值(比如 上一篇 中就利用了相交点处几何体的材质颜色与灯光颜色,还加上了散射因子来决定对应的像素点的颜色)。 Introduction 在 第一 篇 中介绍了光线跟踪的基础知识:从一个照相机发射出光线,让这些光线穿过一个屏幕平面进入到场景中,跟踪光线从而寻找出其与几何体最近的相交点,并简单地使用一个点积值来计算散射度,最终完成对像素点颜色值的计算。 下图所示的是 第一篇 中那个简单的光线跟踪发射到场景中的光线,它们可以击中光源,或者一个几何体,也可以啥也没打中。这里没有反射,也没有折射。我们称之为 ” primary rays”. 当然与之对应的光线称之为 ”secondary rays”, 如下图所示: 图中的蓝线是反射光线,绿线是折射光线。后者比前者要难计算,但也是可以做的。它的计算主要涉及到折射因子和折射定律。 红线是用来探测光源的。一般来说,如果你想计算散射光,那么若对于相交点来说光源是可见的,就对点积乘以 1 ,否则就乘以 0 ,将其排除出去

unity raycasthit讲解

血红的双手。 提交于 2020-02-26 14:48:22
新建一个场景加三个方块,如图 在随便一个物体上加上脚本 using System . Collections ; using System . Collections . Generic ; using UnityEngine ; public class Test : MonoBehaviour { public Transform cube1 , cube2 ; // Start is called before the first frame update void Start ( ) { Debug . Log ( LayerMask . GetMask ( "Shootable" ) ) ; } // Update is called once per frame void Update ( ) { Ray ray = Camera . main . ScreenPointToRay ( Input . mousePosition ) ; // Ray ray = new Ray(Camera.main.transform.position, Input.mousePosition); RaycastHit hit ; if ( Physics . Raycast ( ray , out hit , 100 , LayerMask . GetMask (

如何确定2D点是否在多边形内?

我与影子孤独终老i 提交于 2020-02-25 16:08:21
我正在尝试在多边形算法内部创建一个 快速的 2D点,以用于命中测试(例如 Polygon.contains(p:Point) )。 对于有效技术的建议将不胜感激。 #1楼 nirg的答案的C#版本在这里:我只分享代码。 这样可以节省一些时间。 public static bool IsPointInPolygon(IList<Point> polygon, Point testPoint) { bool result = false; int j = polygon.Count() - 1; for (int i = 0; i < polygon.Count(); i++) { if (polygon[i].Y < testPoint.Y && polygon[j].Y >= testPoint.Y || polygon[j].Y < testPoint.Y && polygon[i].Y >= testPoint.Y) { if (polygon[i].X + (testPoint.Y - polygon[i].Y) / (polygon[j].Y - polygon[i].Y) * (polygon[j].X - polygon[i].X) < testPoint.X) { result = !result; } } j = i; } return result; } #2楼

Annotated Realtime Raytracing翻译

﹥>﹥吖頭↗ 提交于 2020-02-04 00:10:16
Ever wonder how a raytracer works? No really, a line-by-line explanation, and not some academic paper filled with technical jargon? Want to see a GPU raytracer running in realtime, in your browser window? Well here you go: if you’re impatient, click here to go straight to the demo , or read on for the more detailed walkthrough. So what exactly is ray tracing? Consider a lamp hanging from the ceiling. Light is constantly being emitted from the lamp in the form of light rays, which bounce around the room until they hit your eye. Ray tracing follows a similar concept by simulating the path of

Linux-常用基础命令(持续更新)

家住魔仙堡 提交于 2020-01-21 02:32:46
自己写的一些命令的汇总,适合小白 1、查看服务器时间 date 2、查看现在日期(日历格式) cal cal 2016 --查看2016全年日历 cal 1 2016 --查看2016年1月份 3、目录操作 pwd 查看当前目录 cd / 跳到总目录 cd .. 退回上一层文件夹 ls 显示当前目录下所有文件 ls -l 显示目录下所有文件详细信息,打开后首字母如果为d,如drwxr-xr-x,则该条文件为文件夹,否则为文件, 如下图片,第一条为文件夹,后三条为文件 4、创建/删除文件夹 mkdir 当前目录下创建文件夹 rmdir 移除文件夹 5、复制文件,判断异同 cp ray.txt file.txt 复制一份ray文件,文件名为file diff ray.txt file.txt 判断两份文件是否一致,一致的话无输出结果,有差异则输出两者差异的地方 6、查看文件内容 cat 查看目标文件里面有哪些文件,不用进入文件 head ray.txt -n 5 查看ray前五行内容 tail ray.txt -n 5 查看最后五行内容 wc wordcount的缩写,查看文件的内容总概,格式为 【行 单词数 字符数】 wc -w 查看多少单词 wc -l 查看有多少行 wc -c 查看大小 来源: CSDN 作者: 一只小小小小菜 链接: https://blog.csdn.net

射线检测

做~自己de王妃 提交于 2020-01-17 19:24:53
射线检测单个游戏对象 //射线检测一个游戏对象 Ray ray = Camera . main . ScreenPointToRay ( Input . mousePosition ) ; RaycastHit hit ; bool isRaycast = Physics . Raycast ( ray , out hit ) ; if ( isRaycast ) { Debug . DrawLine ( ray . origin , hit . point , Color . green ) ; print ( "坐标" + hit . transform . position ) ; print ( "碰撞到点的坐标" + hit . point ) ; print ( "重心坐标" + hit . barycentricCoordinate ) ; print ( "碰撞盒" + hit . collider ) ; print ( "距离" + hit . distance ) ; print ( "光线地图坐标" + hit . lightmapCoord ) ; print ( "法线" + hit . normal ) ; print ( "刚体" + hit . rigidbody ) ; print ( "纹理坐标" + hit . textureCoord )

Ray Marching and Signed Distance Functions

谁都会走 提交于 2020-01-15 07:10:20
http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/ Signed Distance Functions Signed Distance Functions, or SDFs for short, when passed the coordinates of a point in space, return the shortest disance between that point and some surface. the sign of the return value indicates whether point is inside that surface or outside (hence signed distance function). let us look at an example. consider a sphere centered at the origin. Points inside the sphere will have a distance from the origin less than the radius, points on the sphere will have distance equal to the radius, and

【译】光线跟踪:理论与实现(一) 简介

让人想犯罪 __ 提交于 2020-01-15 07:07:33
光线跟踪的目的是为了模拟自然现象:你能见到各种颜色是因为太阳发射出来的光线,经过各种自然物体的反射或折射后,最终进入你的眼睛。若我们暂时不去计较其他因素,所有的这些光线都应该是直线。 如图所示,黄色的光直接从太阳射入照相机中;红色的光线在跟场景发生发射后到达照相机,而蓝色的光线被玻璃球折射后命中照相机。图中没有画出的是那些无法到达观察者的光线,这些光线也是我们不从光源往照相机进行跟踪的原因,而是采用想反的路径。上图标识的是一种理想情形,因为光线的方向没有影响。 从上面我们得到一个启示:与其等待光源发射一条光线穿过一个目前颜色还是黑色的像素,不如我们自己从照相机发射光线去穿过平面的每个像素,去观察这些光线能击中几何体上的哪些像素。 // ----------------------------------------------------------- // Ray class definition // ----------------------------------------------------------- class Ray { public : Ray() : m_Origin( vector3( 0 , 0 , 0 ) ), m_Direction( vector3( 0 , 0 , 0 ) ) {} ; Ray( vector3 & a_Origin,

Worker node-status on a Ray EC2 cluster: update-failed

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 06:54:18
问题 I now have a Ray cluster working on EC2 (Ubuntu 16.04) with a c4.8xlarge master node and one identical worker. I wanted to check whether multi-threading was being used, so I ran tests to time increasing numbers (n) of the same 9-second task. Since the instance has 18 CPUs, I expected to see the job taking about 9s for up to n<=35 (assuming one CPU for the cluster management) and then either a fault, or an increase to about 18 sec when switching to 36 vCPUs per node. Instead, the cluster