Home › Forums › GAMES在线课程(现代计算机图形学入门)讨论区 › 作业7判断直接光照是否被其他物体遮挡的疑问
- This topic has 7 replies, 6 voices, and was last updated 5 years ago by
kwshh.
-
AuthorPosts
-
-
coords是位置,distance才是距离
-
非常感谢,改成(intersect(Ray(hitPoint, ws)).distance – lightInter.distance) > EPSILON;有画面了,但是我有点不理解,bool block = (intersect(Ray(hitPoint, ws)).coords – lightInter.coords).norm() > EPSILON;我理解这个指两个交点有距离,为啥这个不能代表光线被其他物体挡住了呢?
另外画面变成了这样,能帮忙分析一下可能是啥问题么?
This post has received 1 vote down.Attachments:
You must be logged in to view attached files.-
看别的帖子解决了,是因为IntersectP里面应该用t_enter <= t_exit
-
有时间吗
Participant请问一下这里为什么使用的是(intersect(Ray(hitPoint, ws)).distance – lightInter.distance) > EPSILON呢?判断直接光源是否被物体遮挡,那么不应该是intersect(Ray(hitPoint, ws)).distance 比 lightInter.distance 小才是遮挡吗?
-
说的没错,我是这样的
if ((insec_light.distance - Scene::intersect(Ray(hitPoint, ws)).distance)<EPSILON) {// if not blocked
能得到正确的结果,注意insec_light.distance需要手动赋值
insec_light.distance = (insec_light.coords - hitPoint).norm();This post has received 1 vote up.
-
-
-
-
你的 nolight_reflectInter 那个不应该是判断 没有 emission 才反弹下一个光线吗
-
个人开始也是全屏黑的问题,仔细核查代码发现是因为cosx部分应该用-ws而不是ws,
个人判断直接光阻挡的三个思路,我同步跑了一下,应该是1,3效果是一样的(2可能我写的定义有问题吧)// 尝试判断x与交点之间的距离( //if(dotProduct(te_intersection.coords - x, te_intersection.coords - x) < EPSILON) // 尝试判断p到x距离与p到交点距离的差( //if(abs(te_intersection.distance - (p - x).norm()) < EPSILON) // 尝试判断相交物体是否是自发光物体 if (te_intersection.obj && te_intersection.obj->hasEmit())
-
AuthorPosts
- You must be logged in to reply to this topic.