Simple ambient occlusion demo¶
ambientOcclusion.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3newScene()
4print("Executing simple ambient occlusion demo!")
5print("Load a scene!")
6loadGeometry("$VRED_EXAMPLES/geo/car.osb")
7print("Update")
8updateScene()
9
10
11# define functions to call
12def computeAO():
13 print("Select the root node")
14 selectNode("Speedshape")
15 vrLogInfo("calculate ambient occlusion only")
16 computeAmbientOcclusion(5, 0.05, 300.0, false, false, 0,0, false,0.1)
17
18def computeAOSubdiv():
19 print("Select the root node")
20 selectNode("Speedshape")
21 vrLogInfo("calculate ambient occlusion with subdivision")
22 computeAmbientOcclusion(5, 0.05, 300.0, false, false, 0,0, true,0.1)
23
24def computeIndirect():
25 print("Select the root node")
26 selectNode("Speedshape")
27 vrLogInfo("calculate ambient occlusion with")
28 vrLogInfo("2 bounces of indirect illumination")
29 computeAmbientOcclusion(5, 0.05, 300.0, true, false, 4, 2, false,0.1)
30
31def computeGI():
32 print("Select the root node")
33 selectNode("Speedshape")
34 vrLogInfo("calculate ambient occlusion with 2 bounces of")
35 vrLogInfo("indirect illumination, color bleeding and subdivision")
36 computeAmbientOcclusion(5, 0.05, 300.0, true, true, 4,2, true, 0.1)
37
38
39key1 = vrKey(Key_1)
40key1.connect(computeAO)
41vrLogInfo("Press key '1' to calculate ambient occlusion only")
42
43key2 = vrKey(Key_2)
44key2.connect(computeAOSubdiv)
45vrLogInfo("Press key '2' to calculate ambient occlusion with subdivision")
46
47key3 = vrKey(Key_3)
48key3.connect(computeIndirect)
49vrLogInfo("Press key '3' to calculate ambient occlusion with")
50vrLogInfo("2 bounces of indirect illumination")
51
52key4 = vrKey(Key_4)
53key4.connect(computeGI)
54vrLogInfo("Press key '4' to calculate ambient occlusion with 2 bounces of")
55vrLogInfo("indirect illumination, color bleeding and subdivision")
56
57
58
59
60