注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

oxeyeball杂谈

CG技术,动慢等个人喜欢的一切

 
 
 

日志

 
 
关于我

不要穿着拖鞋去扔垃圾哦

网易考拉推荐

Occlusion_OXE   

2008-01-21 18:27:57|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

//根据自己需要做了一些改动的光线跟踪Occ,只是在面板加入了falloff等,能更好的做反射Occ

slim 1 extensions OxeTools {
    extensions OxeTools pxsl {
   templateV float Occlusion_OXE 1 {
 description {
     Calculates the occlusion function using ray tracing.  This
     template can be used to get soft shadowing effects associated with
     nearby objects.  To accelerate your renderings we recommend
     judicious selection of the number of samples, Max Distance and
     Trace Subset.  The occlusion function is accelerated through
     the use of the irradiance cache and is governed by the per-object
     Max Error attribute (found in Slim's Ensemble as well as
     RenderMan Globals).
 }
 parameter float Invert {
     description {
  Occlusion returns the percentage of hemispherical samples that
  hit local geometry.  Something largely occluded appears white
  while something mostly "open" appears black.  Sometimes the
  inverse sense of this coloration is useful.  This parameter
  inverts occlusion.
     }
     subtype switch
     default 1
 }
 parameter float Samples {
     description {
  The number of times to sample the hemisphere. This value
  directly (dramatically) influences render times and is
  the best quality vs. speed tradeoff knob.
     }
     subtype slider
     range {0 2048 2}
     default 64
 }
 parameter float coneangle {
     subtype slider
     range {0 1}
     default 0.9
 }
 parameter string subset {
     label "Trace Subset"
     description {
  The name of a set of objects which are visible to
  indirectdiffuse rays.
     }
     default {}
 }
 parameter float maxdist {
     label "Max Distance"
     description {
  The maximum distance to consider when calculating ray
  intersections.  Setting this parameter to a negative
  number is effectively equivalent to setting the distance
  to infinity.  (And a lot easier).
     }
     default -1
     subtype vslider
     range {0 1000 100}
 }
 parameter float maxvar {
     label "Max Variation"
     description {
  The maximum variation (expressed as a percentage)
  tolerable for occlusion and indirect calculations.
  A larger tolerable variation will decrease
  rendering time at the expense of quality.
     }
     default 0.15
     subtype slider
     range {0 0.5 .01}
}    
  parameter string hitmode {
       subtype selector
     range {
           default "default"
           primitive "primitive"
           shader "shader"
           }
     default "default"
 }
  parameter float falloffmode {
       subtype selector
     range {
           0 0
           1 1
           }
     default 0
 }
  parameter float falloff {
       subtype vslider
     range {0 1}
     default 1
 }
 collection manifold manifold {
     state locked
     detail mustvary "pixar,CurrentPoint"
     parameter point Q {
      detail mustvary
     }
     parameter vector dQu {
      detail mustvary
     }
     parameter vector dQv {
      detail mustvary
     }
 }
 parameter normal normal {
     detail mustvary "pixar,ShadingNormal"
 }
 parameter float result {
     access output
     display hidden
 }
 RSLInclude {
     pxslRayUtil.h
 }
 RSLFunction {
     void
     pxslOcclusion_OXE(
  uniform float invert;
  uniform float samples;
  uniform float coneangle;
  uniform string subset;
  uniform float maxdist;
  uniform float maxvar;
  uniform string hitmode;
  uniform float falloffmode;
  uniform float falloff;
  point Q;
  vector dQu;
  vector dQv;
  normal n;
  output float result;
     )
     {
  uniform float xsamples = pxslGetRaySamples(samples);
  if( xsamples > 0 )
  {
      result = occlusion(Q, n, xsamples,
    "maxdist", maxdist,
    "maxvariation", maxvar,
    "subset", subset,
    "coneangle",coneangle,
    "hitmode",hitmode,
    "falloffmode",falloffmode,
    "falloff",falloff
    );
  }
  else
      result = 0;
  if(invert != 0)
      result = 1 - result;
     }
 }
    }

   
      
   
   
 }
}

  评论这张
 
阅读(327)| 评论(1)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017