Skip to content

Commit 5ee8821

Browse files
authored
Merge pull request #73 from owl-project/development
Development
2 parents 377d6ec + 26861d0 commit 5ee8821

52 files changed

Lines changed: 17690 additions & 1143 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ data
1616
*.jpg
1717
*.mtl
1818
*.zip
19+
*.exr
1920
*__pycache__
2021
examples/content
2122
examples\content

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
[submodule "externals/assimp"]
1414
path = externals/assimp
1515
url = https://github.com/n8vm/assimp.git
16+
[submodule "externals/gli"]
17+
path = externals/gli
18+
url = https://github.com/g-truc/gli.git

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ option(NVCC_VERBOSE "verbose cuda -> ptx -> embedded build" OFF)
9797

9898
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
9999
# Enable c++11 and hide symbols which shouldn't be visible
100-
message(WARN "ENABLING FPIC")
100+
# message(WARN "ENABLING FPIC")
101101
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" CACHE STRING "" FORCE)
102102
endif()
103103

@@ -189,8 +189,8 @@ if (MSVC AND NOT Python_LIBRARIES)
189189
endif()
190190
include_directories(SYSTEM ${Python_INCLUDE_DIRS})
191191
include_directories(SYSTEM ${Python_NumPy_INCLUDE_DIRS})
192-
message(WARN "Numpy Include Dir is: ")
193-
message(WARN ${Python_NumPy_INCLUDE_DIRS})
192+
# message(WARN "Numpy Include Dir is: ")
193+
# message(WARN ${Python_NumPy_INCLUDE_DIRS})
194194
if (NOT EXISTS ${Python_NumPy_INCLUDE_DIRS})
195195
message(ERROR "ERROR, numpy include dir does not exist!")
196196
endif()
@@ -199,6 +199,10 @@ if (NOT EXISTS ${Python_NumPy_INCLUDE_DIRS}/numpy/arrayObject.h)
199199
message(ERROR "ERROR, arrayObject does not exist!")
200200
endif()
201201

202+
# gli
203+
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/externals/gli)
204+
205+
202206
# glm
203207
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/externals/glm)
204208

docs/source/visii.rst

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,42 @@ Visii
22
=================================
33
.. automodule:: visii
44
:members:
5-
initialize_interactive,
6-
initialize_headless,
7-
cleanup,
5+
initialize,
6+
clear_all,
7+
deinitialize,
8+
register_pre_render_callback,
89
set_camera_entity,
910
set_dome_light_intensity,
11+
set_dome_light_exposure,
12+
set_dome_light_color,
13+
set_dome_light_sky,
1014
set_dome_light_texture,
15+
clear_dome_light_texture,
1116
set_dome_light_rotation,
1217
set_indirect_lighting_clamp,
1318
set_direct_lighting_clamp,
1419
set_max_bounce_depth,
15-
resize_window,
20+
set_light_sample_count,
21+
sample_pixel_area,
22+
sample_time_interval,
1623
enable_denoiser,
1724
disable_denoiser,
1825
render,
1926
render_to_hdr,
2027
render_to_png,
2128
render_data,
22-
import_obj
29+
render_data_to_file,
30+
import_scene,
31+
get_scene_min_aabb_corner,
32+
get_scene_max_aabb_corner,
33+
get_scene_aabb_center,
34+
enable_updates,
35+
disable_updates,
36+
are_updates_enabled,
37+
resize_window,
38+
get_window_size,
39+
should_window_close,
40+
is_button_pressed,
41+
is_button_held,
42+
get_cursor_pos,
43+
set_cursor_mode

examples/00.helloworld.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# 00.helloworld.py
2+
#
3+
# This example will create a window where you
4+
# should only see a gaussian noise pattern
5+
16
import visii
27

3-
# this will create a window where you should
4-
# only see gaussian noise pattern
58
visii.initialize()
69

710
input("Press Enter to continue...")

examples/01.simple_scene.py

Lines changed: 32 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,67 @@
1+
# 01.simple_scene.py
2+
#
3+
# This shows a sphere on top of a mirror floor.
4+
# You should see how to set up a simple scene with visii, where light is
5+
# provided by the dome.
6+
17
import visii
28

3-
SAMPLES_PER_PIXEL = 50
4-
WIDTH = 500
5-
HEIGHT = 500
6-
USE_DENOISER = True
7-
FILE_NAME = "tmp.png"
9+
opt = lambda: None
10+
opt.spp = 50
11+
opt.width = 512
12+
opt.height = 512
13+
opt.out = '01_simple_scene.png'
814

915
# headless - no window
1016
# verbose - output number of frames rendered, etc..
1117
visii.initialize(headless = True, verbose = True)
1218

13-
# Uses a neural network to denoise ray traced
14-
if USE_DENOISER: visii.enable_denoiser()
19+
# Use a neural network to denoise ray traced
20+
visii.enable_denoiser()
1521

1622
# First, lets create an entity that will serve as our camera.
1723
camera = visii.entity.create(name = "camera")
1824

19-
# To place the camera into our scene, we'll add a "transform" component
20-
# Note that all visii objects have a "name" that can be used for easy lookup later.
21-
# These names must be unique per component-type, but can be reused across types.
25+
# To place the camera into our scene, we'll add a "transform" component.
26+
# (All visii objects have a "name" that can be used for easy lookup later.)
2227
camera.set_transform(visii.transform.create(name = "camera_transform"))
2328

2429
# To make our camera entity act like a "camera", we'll add a camera component
2530
camera.set_camera(
2631
visii.camera.create_from_fov(
2732
name = "camera_camera",
2833
field_of_view = 0.785398, # note, this is in radians
29-
aspect = float(WIDTH)/float(HEIGHT)
34+
aspect = opt.width / float(opt.height)
3035
)
3136
)
3237

3338
# Finally, we'll select this entity to be the current camera entity.
3439
# (visii can only use one camera at the time)
3540
visii.set_camera_entity(camera)
3641

37-
# Lets place our camera in the scene to look at an object
38-
39-
# All positions and vectors are defined through a sequence of three numbers.
40-
# That sequence can be specified using lists, tuples, through numpy,
41-
# or using the built in visii.vec3 type:
42-
# transform.set_position([x, y, z]) <- lists
43-
# transform.set_position((x, y, z)) <- tuples
44-
# transform.set_position(np.array([x, y, z])) <- numpy arrays
45-
# transform.set_position(visii.vec3(x, y, z)) <- visii vec3 object
46-
47-
# note that visii quaternions are slightly out of order from a normal list
48-
# transform.set_rotation([x, y, z, w]) <- lists
49-
# transform.set_rotation(visii.quat(w, x, y, z)) <- visii quat object
50-
5142
# Lets set the camera to look at an object.
52-
# We'll do this by editing the transform component,
53-
# which functionally acts like the camera's "view" transform.
54-
# (Note that any of the below three vectors can match any of
55-
# the above mentioned patterns)
56-
camera.get_transform().look_at(
57-
at = (0, 0, 0.9), # at position
58-
up = (0, 0, 1), # up vector
59-
eye = (0, 5, 1) # eye position
60-
)
43+
# We'll do this by editing the transform component.
44+
camera.get_transform().look_at(at = (0, 0, .9), up = (0, 0, 1), eye = (0, 5, 1))
6145

6246
# Next, lets at an object (a floor).
63-
# For an entity to be visible to a camera, that entity
64-
# must have a mesh component, a transform component, and a
65-
# material component.
66-
visii.entity.create(
47+
floor = visii.entity.create(
6748
name = "floor",
6849
mesh = visii.mesh.create_plane("mesh_floor"),
6950
transform = visii.transform.create("transform_floor"),
7051
material = visii.material.create("material_floor")
7152
)
7253

7354
# Lets make our floor act as a mirror
74-
# we first get the material associated with our floor entity
75-
# if you do not have a direct handler to the entity, you
76-
# search for a specific entity, material, transform, etc.
77-
# name.
78-
mat = visii.material.get("material_floor")
79-
80-
# Lets change the color
81-
# the colors are RGB and the values are expected to be between
82-
# 0 and 1.
55+
mat = floor.get_material()
56+
# mat = visii.material.get("material_floor") # <- this also works
57+
58+
# Mirrors are smooth and "metallic".
8359
mat.set_base_color((0.19,0.16,0.19))
84-
# Lets now change the metallic propreties for shinyness
8560
mat.set_metallic(1)
86-
# to make sure we get a perfect mirror lets change the roughness
8761
mat.set_roughness(0)
8862

89-
# we want to make sure our floor is large so let's update the
90-
# scale of the object.
91-
trans = visii.transform.get("transform_floor")
92-
93-
# the scale takes as input a vector of 3 numbers
63+
# Make the floor large by scaling it
64+
trans = floor.get_transform()
9465
trans.set_scale((5,5,1))
9566

9667
# Let's also add a sphere
@@ -100,24 +71,18 @@
10071
transform = visii.transform.create("sphere"),
10172
material = visii.material.create("sphere")
10273
)
103-
# lets set the sphere up
10474
sphere.get_transform().set_position((0,0,0.41))
10575
sphere.get_transform().set_scale((0.4, 0.4, 0.4))
10676
sphere.get_material().set_base_color((0.1,0.9,0.08))
10777
sphere.get_material().set_roughness(0.7)
108-
sphere.get_material().set_specular(1)
109-
11078

111-
# # # # # # # # # # # # # # # # # # # # # # # # #
112-
# now that we have a simple scene set up let's render it
113-
print("rendering to", FILE_NAME)
114-
visii.render_to_png(
115-
width = WIDTH,
116-
height = HEIGHT,
117-
samples_per_pixel = SAMPLES_PER_PIXEL,
118-
image_path = FILE_NAME
79+
# Now that we have a simple scene, let's render it
80+
print("rendering to", "01_simple_scene.png")
81+
visii.render_to_file(
82+
width = opt.width,
83+
height = opt.height,
84+
samples_per_pixel = opt.spp,
85+
file_path = "01_simple_scene.png"
11986
)
12087

121-
# let's clean up the GPU
12288
visii.deinitialize()
123-
print("done!")

0 commit comments

Comments
 (0)