zoukankan      html  css  js  c++  java
  • 3delight and useBackground

    为什么3delight使用maya的useBackground材质渲出来的阴影怪的不行,后来发现它使用的阴影计算方法有点不一样。

    原因就在shading_utils.h文件里头定义的computeShadowValue函数,把这个函数修改成下边的方法才好使一点。

    float computeShadowValue(normal i_N)
    {
       float shadowValue = 0;
       varying float totalLightIntensity = 0;
     
       normal unitN=normalize(i_N);
       normal Nn= ShadingNormal(unitN);
       extern varying point P;
       illuminance(P,Nn,PI/2)
          {
               float Cl_shd=0;
              color Cl_noshd=0;
              float k = Nn.normalize(L);
       
              lightsource("__3dfm_shadowing", Cl_shd);
              lightsource("__3dfm_unshadowed_cl", Cl_noshd);
         
              float unshadowed_intensity = luminance(Cl_noshd); 
         
              shadowValue += k * Cl_shd * unshadowed_intensity;
              totalLightIntensity += k *unshadowed_intensity;
          }
         
          shadowValue /= totalLightIntensity;
          return shadowValue;
     }

  • 相关阅读:
    jquery tmpl 详解
    freemarker 类型转换
    关于JQuery的绑定方法
    Jquery的extend方法
    Java高级特性之枚举
    runtime.getruntime.availableprocessors
    Log4J的使用
    JAVA关于一些变量的技巧
    Idea  调试代码
    java设计模式-State(状态)模式
  • 原文地址:https://www.cnblogs.com/jerrykon/p/2615022.html
Copyright © 2011-2022 走看看