官方文档:http://www.povray.org/documentation/3.7.0/t2_0.html
POV-Ray简单上手教程——坐标系统:https://blog.csdn.net/zhr_hadoop/article/details/51819337
X轴的正方向指向右边,Y轴正方向指向上,Z轴指向屏幕里
变形的关键字:
rotate:变形物体和纹理
scale:处理大小物体和纹理
translate:移动物体和纹理,相对于目前位置,要移动的变化量。
transformation标识符:一组变形操作可以融合在一起,存储到一个transformation标识符里,
matrix :一个转化矩阵可以用来完成更复杂的变化操作。
POV-Ray简单上手教程(学习笔记): https://blog.csdn.net/zhr_hadoop/article/details/51289804
POV-Ray简单上手教程——摄像机的使用: https://blog.csdn.net/zhr_hadoop/article/details/51763300
相机光圈的作用和应用:https://baijiahao.baidu.com/s?id=1606019929191876904&wfr=spider&for=pc
[CG编程] 基本光照模型:http://www.cnblogs.com/QG-whz/p/5189831.html?utm_source=tuicool&utm_medium=referral
图形学理论 光照模型:http://www.cnblogs.com/mengdd/archive/2013/08/05/3238123.html
POV-Ray简单上手教程-简单贴图/纹理设置:https://blog.csdn.net/zhr_hadoop/article/details/51706558
二. 一个例子及注释 1. 代码#include "colors.inc" //..\Documents\POV-Ray\v3.7\include
#include "shapes.inc"
#include "textures.inc"
#include "stones.inc"
camera
{
location //决定相机位置:物体始终在屏幕中心,相机对着物体,沿着xyz方向平移
look_at < 0.0,0,0.0> //决定相机朝向:相机位置不动,屏幕中心移动
//(有相机绕一个支点,沿着xyz轴方向转动的感觉)
//angle 90 //距离物体的远近(放大缩小的感觉,范围0-180)
focal_point //焦点所落在的位置
aperture 0.01 //小光圈大光图,即获得不同的聚焦效果;
//值越小,关注的区域就越大(各个远近层次的物体都很清楚),反之,则小.
blur_samples 20 //采样设置,值越大,采样点数越多,质量/分辨率越高的图像,
//但相应的渲染时间就会长.
}
light_source { color White } 定义两个光源;关于x轴对称
light_source { color White }
plane { 定义一个平面
y, -1.5 //平面方程:y=-1.5
pigment { //着色;使用棋盘格
checker color Gray65 color Gray30
}
}
sphere {
, 0.5 定义一个球体: 圆心+半径
translate //移动:相对于目前位置,要移动的变化量
finish {
ambient 0.1 //环境光
diffuse 0.7 //物体漫反射光
}
pigment { LimeGreen }
//texture { PinkAlabaster }
finish { phong 0.3} //添加Phong光照模型,来产生高亮效果
}
#declare my_box_transform = //自定义一个变换集合
transform {
rotate //旋转: 绕xyz轴分别旋转40/20/30度
translate
scale 1.5 //缩放: 大小*1.1倍; 相当于向量
}
box {
, 定义一个立方体: 两个对角顶点
//texture { //Method 1.棋盘格纹理模型
// pigment {
// checker Red, White
// scale 0.25 //这个scale只影响texture
// }
//}
transform my_box_transform
finish {
ambient 0.4
diffuse 0.6
}
pigment { //Method 2.木质纹理模型
wood //确定上色模式,这里是木制
color_map { //确定颜色向量是如何来安排颜色值
[0.0 color DarkTan] //从DarkTan到DarkBrown占据脉络的90%,
[0.9 color DarkBrown] //而从DarkBrown到VeryDarkBrown占据了10%
[1.0 color VeryDarkBrown]
}
turbulence 0.07 //调节模式的条纹脉络,褶皱强度
scale //调节模式的大小,此处值越小纹理越密集
}
//pigment {DMFWood4 } //Method 3.使用预定义的木质纹理
}
cylinder { 定义一个圆柱体: 两个底面圆心+圆柱半径
, , 3
rotate
translate
finish {
ambient 1.9
diffuse 0.1
}
//pigment {NeonBlue}
texture {
T_Stone24 //预定义纹理: 添加大理石纹理
scale 0.9 //这个scale只影响纹理
}
normal {
bumps 1.1 // 指定凸起的表观高度
scale 0.03 // 指定直径大小(凸起间隔/高度).对颜色图案没有影响
}
}
2.效果图
(union 并集, intersection 交集, difference 差集, merge 融合的使用)
1.代码#include "colors.inc"
camera{
location
look_at 0
angle 36
rotate //改变y的值,类似于相机绕着物体水平旋转一周
}
light_source{ White }
plane{
y, -1.5
pigment { checker Green White }
}
//********************************************
#declare my_union = union{ //两个物体的并集
sphere{
, 1
translate -0.5*x
}
sphere{
, 1
translate 0.5*x
}
pigment { Blue }
//scale
//rotate
//translate 1.4*y
}
#declare my_intersection = intersection{ //两个物体的交集(此处未着色一片黑)
sphere{
, 1
translate -0.5*x
}
sphere{
, 1
translate 0.5*x
}
}
#declare my_intersection_1 = intersection{ //两个物体的交集(此处着色后可见效果)
object { my_intersection }
pigment { Red } //此处使用pigment 下面引用该object时,pigment中的filter(透明效果)将不起作用
}
//-------------------------------
#declare my_differ = difference{
object{
my_intersection
rotate 90*y
}
cylinder{
, , 0.35
}
}
#declare my_differ_1 = difference{
object{my_differ}
pigment {Red}
}
//********************************************
//object {my_union}
//object {my_intersection_1}
//object {my_differ_1}
//union{
// object {my_differ translate }
// object {my_differ translate }
// object {my_differ translate }
// object {my_differ translate }
// pigment {Red filter 0.5}
//}
merge{ //对比上面的union,类似但内部的融合去除了,多用在透明物体上
object {my_differ translate }
object {my_differ translate }
object {my_differ translate }
object {my_differ translate }
pigment {Red filter 0.5}
}
2.效果