oxine

Forum Replies Created

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • in reply to: 作业7 代码框架问题 急!! #7030 Score: 0
    oxine
    Participant
    9 pts

    试试在triangle.hpp最前面加一行
    #pragma once

    in reply to: 纹理映射 #7023 Score: 0
    oxine
    Participant
    9 pts

    如果指加载,拿个图像库,比如stb,查查api,然后调用一下,开个指针,加载到内存里。

    如果指叠在渲染结果上,你自己写shader控制法则

    in reply to: 关于投影矩阵的疑惑 #7021 Score: 0
    oxine
    Participant
    9 pts

    d3d gl矩阵不一样的,人家左右手系都不一样

    in reply to: 作业2:三角形底边上出现了圆角 #7020 Score: 1
    oxine
    Participant
    9 pts

    哈哈哈真可爱,你矩阵贴出来看看

    This post has received 1 vote up.
    in reply to: 作业2:关于 SSAA #7019 Score: 0
    oxine
    Participant
    9 pts

    你这样理解,ssaa就是个暴力法,4xssaa就是像素x4,其他流程不变,最后做个平均

    in reply to: 作业2:关于 SSAA #7018 Score: 0
    oxine
    Participant
    9 pts

    是这样的,你一个像素拆四个像素,这四个像素的深度值不一定一样啊,三角形又不是永远正对着你,你要做下差值再运算的

    in reply to: 关于透视变换的问题 #7017 Score: 0
    oxine
    Participant
    9 pts

    正负应该是在面的一侧还是另一侧,正负号相同说明两个点同侧。
    我猜的。

    in reply to: 光栅化如何具体实现SSAA #7016 Score: 0
    oxine
    Participant
    9 pts

    MSAA在极端情况下等于SSAA,具体可以知乎搜搜,然后看看rtr4里面关于抗锯齿那块

    in reply to: 关于作业5castRay的一些疑问 #7015 Score: 0
    oxine
    Participant
    9 pts

    不是,他问的作业5,作业5是whitted style,是发射射线来做阴影的

    oxine
    Participant
    9 pts

    我猜测你想问的是为什么要保留摄像机后面的部分,是这样,-1到0这段我们不用的。
    另外ndc是把frustum压成一个cube,然后再加个平移到原点,你想象一下这个压缩的过程,这样画有歧义。然后压缩完了,你其实不用太在意camera现在的坐标(0,0),因为其实已经没摄像机什么事了,下一步就是开始进管线做着色了
    对着矩阵推一边,肯定就清楚了。gl和dx对ndc的处理好像不太一样。记不太清了。

    in reply to: 作业2和作业3中奇怪问题 #6531 Score: 0
    oxine
    Participant
    9 pts

    投影矩阵错了呗

    in reply to: 关于作业5castRay的一些疑问 #6530 Score: 0
    oxine
    Participant
    9 pts

    那个是shadow ray

    in reply to: 作业7 简单抗锯齿出现毛边 #6497 Score: 0
    oxine
    Participant
    9 pts

    修改起来很方便,把xy以及射线的生成挪到spp循环内部就行了,这样可以节省一次循环

    for (int k = 0; k < spp; k++){
    	//generate primary ray direction
    	float x = (2 * (i + get_random_float()) / (float)scene.width - 1) * imageAspectRatio * scale;
    	float y = (1 - 2 * (j + get_random_float()) / (float)scene.height) * scale;
    	Vector3f dir = normalize(Vector3f(-x, y, 1));
    	auto index = j*scene.width + i;
            framebuffer[index] += scene.castRay(Ray(eye_pos, dir), 0) / spp;
    }

    在低spp情况下也能获取不错的效果

    Attachments:
    You must be logged in to view attached files.
    in reply to: 作业7 简单抗锯齿出现毛边 #6495 Score: 0
    oxine
    Participant
    9 pts

    对哦,有道理!我的xy在spp的循环内都是不变的,我太蠢了先前没想到,谢谢大佬解答!

    • This reply was modified 4 years, 7 months ago by oxine.
    in reply to: 作业7 简单抗锯齿出现毛边 #6485 Score: 0
    oxine
    Participant
    9 pts

    有条件的同学试着跑跑看吧,我想不明白了…

    oxine
    Participant
    9 pts

    说的没错,我是这样的
    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.
    in reply to: 正确计算作业3的TBN #6427 Score: 1
    oxine
    Participant
    9 pts

    原来的代码不是这样的嘛
    // Vector t = (x*y/sqrt(x*x+z*z),sqrt(x*x+z*z),z*y/sqrt(x*x+z*z))
    其实把y分量取minus就行了,
    // Vector t = (x*y/sqrt(x*x+z*z),-sqrt(x*x+z*z),z*y/sqrt(x*x+z*z))
    你再和normal dot一下看看垂不垂直

    This post has received 1 vote up.
    in reply to: 作业3换模型—crate出大问题 #6280 Score: 3
    oxine
    Participant
    9 pts

    不是ztest的问题。
    这是由obj文件格式所导致的,在这个文件中每4个顶点表示一个quad,一个cube一共是6个面

    
    f 5/1 6/2 2/3 1/4
    f 6/1 7/2 3/3 2/4
    f 7/1 8/2 4/3 3/4
    f 8/1 5/2 1/3 4/4
    f 1/1 2/2 3/3 4/4
    f 8/1 7/2 6/3 5/4
    

    而我们的程序在main函数中读入的时候,把每三个顶点装配成一个三角形,所以上面用24个点表示的24/4个quad会被表示成24/3个三角形,也就是8个三角形。

    所以要么修改程序使其支持quad的装配,要么修改obj文件如下:

    
    f 5/1 2/3 6/2
    f 5/1 1/4 2/3 
    f 6/1 3/3 7/2
    f 6/1 2/4 3/3 
    f 7/1 4/3 8/2
    f 7/1 3/4 4/3
    f 8/1 1/3 5/2
    f 8/1 4/4 1/3
    f 1/1 3/3 2/2
    f 1/1 4/4 3/3
    f 8/1 6/3 7/2
    f 8/1 5/4 6/3
    
    This post has received 3 votes up.
    Attachments:
    You must be logged in to view attached files.
Viewing 18 posts - 1 through 18 (of 18 total)