Point-Based Ambient Occlusion

Maya154 字

今天尝试了下3delight使用point cloud来实现OCC的效果,速度非常快,图像也非常平滑。
首先需要准备 ptc_write shader,3delight已经提供,在$DELIGHT/examples/ptc_occlusion/ 目录中。
将场景中所有的几何体选择中赋予 ptc_write,同时为它们添加属性:

Attribute “cull” “hidden” [0]
Attribute “cull” “backfacing [0]
Attribute “dice” “rasterorient” [0]

这样可以把摄像机背面的也烘焙出来。
输出文件后,再选择所有几何体,为其赋予 ptc_occlusion shader,在3DELIGHT目录中有提供,但是这里给出另外一个优化版本:

surface ptc_occlusion(
string ptc_file = "default.ptc";
float biasValue = 0.1;
float clampValue = 0;
string hitsidesValue = "both";
float samplebaseValue = 1;
float maxdistValue = 0;
float maxsolidangleValue = 0.5; )
{
normal Nf = faceforward( normalize(N), I );
Ci = 1 - occlusion( P, Nf, 
"filename", ptc_file, "pointbased", 1,
"bias", biasValue, "clamp", clampValue, "hitsides", "both", "samplebase", 1 , "maxdist", maxdistValue, "maxsolidangle", maxsolidangleValue  );

现在就可以直接渲染,得到OCC效果,通过调小maxsolidanglevalue属性,可以得到更加平滑的效果。maxdistvalue可以控制衰减。

admin
博学之,审问之,慎思之,明辨之,笃行之。
OωO
开启隐私评论,您的评论仅作者和评论双方可见