POV-Ray简单案例

POV-Ray,全名是Persistence of Vision Raytracer,是一个使用光线跟踪绘制三维图像的开放源代码免费软件。

按照3.7版本给的参考,写的代码,以下为部分源码

#version 3.7;
global_settings { assumed_gamma 0.8 } //设置全局亮度

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "metals.inc"
#include "glass.inc"
#include "woods.inc"   
#include "stones.inc" 

//相机坐标

camera {
   location <-3, 5, -6>
   angle 45 // direction <0, 0,  1.7>
   right x*image_width/image_height
   look_at <0,0,0>
}

// Uncomment the area lights only if you've got lots of time.
#declare Dist=80.0;
light_source {< -50, 25, -50> color White
     fade_distance Dist fade_power 2
//   area_light <-40, 0, -40>, <40, 0, 40>, 3, 3
//   adaptive 1
//   jitter
}
light_source {< 50, 10,  -4> color Gray30
     fade_distance Dist fade_power 2
//   area_light <-20, 0, -20>, <20, 0, 20>, 3, 3
//   adaptive 1
//   jitter
}
light_source {< 0, 100,  0> color Gray30
     fade_distance Dist fade_power 2
//   area_light <-30, 0, -30>, <30, 0, 30>, 3, 3
//   adaptive 1
//   jitter
}

//设置背景颜色

sky_sphere {
    pigment {
        gradient y
        color_map {
            [0, 1  color White color White]
        }
    }
}

//声明r的大小,类似于int float等
#declare r=0.02;


 union { 
     
// cell 14
// cell 7
sphere{<0.975637,-1,-1>,r}
sphere{<0.77992,-0.855811,-0.946429>,r}
sphere{<0.48367,-0.943088,-0.546919>,r}
cylinder{<0.48367,-0.943088,-0.546919>,<0.77992,-0.855811,-0.946429>,r}
sphere{<0.721746,-0.792901,-1>,r}
cylinder{<0.721746,-0.792901,-1>,<0.77992,-0.855811,-0.946429>,r}
sphere{<-0.422036,-0.629073,-0.478126>,r}
sphere{<0.929994,-0.954386,-1>,r}
cylinder{<0.929994,-0.954386,-1>,<0.975637,-1,-1>,r}
cylinder{<0.929994,-0.954386,-1>,<0.721746,-0.792901,-1>,r}
cylinder{<0.929994,-0.954386,-1>,<0.77992,-0.855811,-0.946429>,r}
sphere{<-0.0948664,-0.365769,-1>,r}
cylinder{<-0.0948664,-0.365769,-1>,<0.721746,-0.792901,-1>,r}
sphere{<-0.852311,-0.717163,-1>,r}
cylinder{<-0.852311,-0.717163,-1>,<-0.422036,-0.629073,-0.478126>,r}
cylinder{<-0.852311,-0.717163,-1>,<-0.0948664,-0.365769,-1>,r}
sphere{<-0.297797,-0.568924,-0.489879>,r}
cylinder{<-0.297797,-0.568924,-0.489879>,<-0.0948664,-0.365769,-1>,r}
cylinder{<-0.297797,-0.568924,-0.489879>,<-0.422036,-0.629073,-0.478126>,r}
sphere{<-0.834134,-1,-1>,r}
cylinder{<-0.834134,-1,-1>,<-0.852311,-0.717163,-1>,r}
cylinder{<-0.834134,-1,-1>,<0.975637,-1,-1>,r}
sphere{<-0.377755,-1,-0.453654>,r}
cylinder{<-0.377755,-1,-0.453654>,<-0.834134,-1,-1>,r}
cylinder{<-0.377755,-1,-0.453654>,<-0.422036,-0.629073,-0.478126>,r}
sphere{<0.401431,-0.925331,-0.505262>,r}
cylinder{<0.401431,-0.925331,-0.505262>,<0.48367,-0.943088,-0.546919>,r}
cylinder{<0.401431,-0.925331,-0.505262>,<-0.297797,-0.568924,-0.489879>,r}
sphere{<0.386068,-1,-0.498897>,r}
cylinder{<0.386068,-1,-0.498897>,<0.401431,-0.925331,-0.505262>,r}
cylinder{<0.386068,-1,-0.498897>,<-0.377755,-1,-0.453654>,r}
sphere{<0.595652,-1,-0.604238>,r}
cylinder{<0.595652,-1,-0.604238>,<0.386068,-1,-0.498897>,r}
cylinder{<0.595652,-1,-0.604238>,<0.975637,-1,-1>,r}
cylinder{<0.595652,-1,-0.604238>,<0.48367,-0.943088,-0.546919>,r}


//设置纹理,这一块可以去网上搜索,放在最后面
  texture {
      pigment {
        wood
        color_map {
          [0.0 color DarkTan]
          [0.9 color DarkBrown]
          [1.0 color VeryDarkBrown]
        }
        turbulence 0.05
        scale <0.2, 0.3, 1>
      }
      finish { phong 1 }
    }



}

​​​​​​​

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LV小猪精

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值