2、静态几何:
因为三角形更快交叉,所以V-Ray中的几何图形由三角形网格表示,而不支持任意多边形。
几何的分类:
3、Node插件:
在定义实际几何数据之前,将几何数据(几何参数)与材质插件(材质参数)链接,并将其定位在世界中(变换参数)的。您可以在不同位置从不同节点引用相同的几何体,而无需复制数据
Geometry几何体分类:
其中具体以GeoStaticMesh来说,需要必须设置的是:
ex3.1
import vray
with vray.VRayRenderer() as renderer:
# Create a new static geometry
mesh = renderer.classes.GeomStaticMesh()
# Assign a cube geometry
mesh.vertices=vray.List([
vray.Vector(-10, -20, 0.0),
vray.Vector(10, -20, 0.0),
vray.Vector(-10, 20, 0.0),
vray.Vector(10, 20, 0.0),
vray.Vector(-10, -20, 20),
vray.Vector(10, -20, 20),
vray.Vector(-10, 20, 20),
vray.Vector(10, 20, 20)
])
mesh.faces=vray.List([
0, 2, 3,
3, 1, 0,
4, 5, 7,
7, 6, 4,
0, 1, 5,
5, 4, 0,
1, 3, 7,
7, 5, 1,
3, 2, 6,
6, 7, 3,
2, 0, 4,
4, 6, 2
])
mesh.normals=vray.List([
vray.Vector(0.0, 0.0, -1.0), vray.Vector(0.0, 0.0, -1.0), vray.Vector(0.0, 0.0, -1.0),
vray.Vector(0.0, 0.0, -1.0), vray.Vector(0.0, 0.0, -1.0), vray.Vector(0.0, 0.0, -1.0),
vray.Vector(0.0, 0.0, 1.0), vray.Vector(0.0, 0.0, 1.0), vray.Vector(0.0, 0.0, 1.0),
vray.Vector(0.0, 0.0, 1.0), vray.Vector(0.0, 0.0, 1.0), vray.Vector(0.0, 0.0, 1.0),
vray.Vector(0.0, -1.0, 0.0), vray.Vector(0.0, -1.0, 0.0), vray.Vector(0.0, -1.0, 0.0),
vray.Vector(0.0, -1.0, 0.0), vray.Vector(0.0, -1.0, 0.0), vray.Vector(0.0, -1.0, 0.0),
vray.Vector(1.0, 0.0, 0.0), vray.Vector(1.0, 0.0, 0.0), vray.Vector(1.0, 0.0, 0.0),
vray.Vector(1.0, 0.0, 0.0), vray.Vector(1.0, 0.0, 0.0), vray.Vector(1.0, 0.0, 0.0),
vray.Vector(0.0, 1.0, 0.0), vray.Vector(0.0, 1.0, 0.0), vray.Vector(0.0, 1.0, 0.0),
vray.Vector(0.0, 1.0, 0.0), vray.Vector(0.0, 1.0, 0.0), vray.Vector(0.0, 1.0, 0.0),
vray.Vector(-1.0, 0.0, 0.0), vray.Vector(-1.0, 0.0, 0.0), vray.Vector(-1.0, 0.0, 0.0),
vray.Vector(-1.0, 0.0, 0.0), vray.Vector(-1.0, 0.0, 0.0), vray.Vector(-1.0, 0.0, 0.0)
])
mesh.faceNormals=vray.List([
0, 1, 2,
3, 4, 5,
6, 7, 8,
9, 10, 11,
12, 13, 14,
15, 16, 17,
18, 19, 20,
21, 22, 23,
24, 25, 26,
27, 28, 29,
30, 31, 32,
33, 34, 35
])
# Create a BRDF with diffuse color
newBRDF = renderer.classes.BRDFDiffuse()
# We specify solid red color
newBRDF.color = vray.Color(1.0, 0.0, 0.0)
# Create a new material with single BRDF
newMaterial = renderer.classes.MtlSingleBRDF()
# Assign the BRDF to the material
newMaterial.brdf = newBRDF
# Create a new node for the cube
newNode = renderer.classes.Node()
newNode.material = newMaterial # Assign the new material to the new node
newNode.geometry = mesh # Assign the mesh
# We must specify transform in order to position the cube in the world
newNode.transform = vray.Transform(vray.Matrix(vray.Vector(1.0, 0.0, 0.0),
vray.Vector(0.0, 1.0, 0.0),
vray.Vector(0.0, 0.0, 1.0)), vray.Vector(-50, 100, 0))
# Create the light
light = renderer.classes.LightRectangle()
# We must specify transform in order to position the light in the world
light.transform = vray.Transform(vray.Matrix(vray.Vector(1.0, 0.0, 0.0),
vray.Vector(0.0, 1.0, 0.0),
vray.Vector(0.0, 0.0, 1.0)), vray.Vector(-50, 100, 150))
# Set white color
light.color = vray.Color(1.0, 1.0, 1.0)
# Increase the light's size (by default it's 1x1)
light.u_size = 50
light.v_size = 50
# Increase the default intensity
light.intensity = 100
# Create the camera
renderView = renderer.classes.RenderView()
# Position the camera towards the cube
renderView.transform=vray.Transform(vray.Matrix(vray.Vector(1.0, 0.0, 0.0), vray.Vector(0.0, 0.0, 1.0), vray.Vector(0.0, -1.0, 0.0)), vray.Vector(50, -150, 50))
# Set Field of view (horizontal) in radians
renderView.fov=2
renderer.start()
renderer.waitForRenderEnd(6000)
4、渲染视图RenderView
相机的主要三个参数为: