Skip to content

Commit

Permalink
Merge pull request #43 from owl-project/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
natevm authored Aug 3, 2020
2 parents 0f67916 + c258cb9 commit 8b0f407
Show file tree
Hide file tree
Showing 19 changed files with 2,117 additions and 1,000 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Download Dependencies
run: |
# Add directory containing cmake
export PATH=$PATH:/opt/_internal/cpython-3.8.4/bin/
export PATH=$PATH:/opt/_internal/cpython-3.8.5/bin/
# list contents of python folder
#ls -R /opt/python/${{ matrix.python-version }}
Expand All @@ -52,7 +52,7 @@ jobs:
/opt/python/cp38-cp38/bin/pip install cmake
find / -iname "cmake"
/opt/_internal/cpython-3.8.4/bin/cmake --version
/opt/_internal/cpython-3.8.5/bin/cmake --version
# Setuptools scm
/opt/python/${{ matrix.python-version }}/bin/pip install setuptools_scm
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:

- name: Configure and install cmake project
run: |
export PATH=$PATH:/opt/_internal/cpython-3.8.4/bin/
export PATH=$PATH:/opt/_internal/cpython-3.8.5/bin/
source /opt/rh/devtoolset-8/enable
PY=${{ matrix.python-version }}
Expand Down
47 changes: 25 additions & 22 deletions examples/13.reprojection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import math
import visii
import noise
import random
Expand Down Expand Up @@ -38,7 +39,6 @@
print(f'created folder {opt.outf}/')

# # # # # # # # # # # # # # # # # # # # # # # # #

visii.initialize_headless()

camera = visii.entity.create(
Expand All @@ -51,11 +51,22 @@
)
)

angle = 0
camera.get_transform().look_at(
visii.vec3(0,0,.1), # look at (world coordinate)
visii.vec3(0,0,1), # up vector
visii.vec3(math.sin(angle), math.cos(angle),.2),
previous = True
)

angle = -visii.pi() * .05
camera.get_transform().look_at(
visii.vec3(0,0,0), # look at (world coordinate)
visii.vec3(0,0,.1), # look at (world coordinate)
visii.vec3(0,0,1), # up vector
visii.vec3(0,1,1)
visii.vec3(math.sin(angle), math.cos(angle),.2),
previous = False
)

visii.set_camera_entity(camera)

# # # # # # # # # # # # # # # # # # # # # # # # #
Expand All @@ -67,20 +78,8 @@
material = visii.material.create("floor")
)

floor.get_transform().set_scale(visii.vec3(100))
floor.get_material().set_roughness(1.0)

areaLight1 = visii.entity.create(
name="areaLight1",
light = visii.light.create("areaLight1"),
transform = visii.transform.create("areaLight1"),
mesh = visii.mesh.create_teapotahedron("areaLight1"),
)
areaLight1.get_light().set_intensity(10000.)
areaLight1.get_light().set_temperature(8000)
areaLight1.get_transform().set_position(
visii.vec3(0, 0, 5))

mesh1 = visii.entity.create(
name="mesh1",
mesh = visii.mesh.create_teapotahedron("mesh1"),
Expand All @@ -92,17 +91,21 @@
mesh1.get_material().set_base_color(
visii.vec3(1.0, 0.0, 0.0))

mesh1.get_transform().set_position(visii.vec3(-0.05, 0.0, 0))
mesh1.get_transform().set_scale(visii.vec3(0.1))
mesh1.get_transform().set_linear_velocity(visii.vec3(0.1, 0.0, 0.0))
mesh1.get_transform().set_position(visii.vec3(-0.05, 0.0, 0), previous=True)
mesh1.get_transform().set_scale(visii.vec3(0.1), previous = False)
mesh1.get_transform().set_scale(visii.vec3(0.1), previous = True)
mesh1.get_transform().set_position(visii.vec3(0.05, 0.0, 0), previous=False)

tex = visii.texture.create_from_image("dome", "../data/dome.hdr")
visii.set_dome_light_texture(tex)
visii.set_dome_light_intensity(2)

visii.set_dome_light_intensity(1)
visii.set_direct_lighting_clamp(10.0)
visii.set_indirect_lighting_clamp(10.0)
visii.set_max_bounce_depth(0)
visii.sample_pixel_area(visii.vec2(.5), visii.vec2(.5))
# # # # # # # # # # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # # # # # # # # # #
# First, let's render out the scene with motion blur to understand
# how the object is moving
visii.sample_time_interval(visii.vec2(0.0, 1.0))
Expand All @@ -129,7 +132,7 @@ def save_image(data, name):
t1_array = visii.render(
width=opt.width,
height=opt.height,
samples_per_pixel=1,
samples_per_pixel=8,
seed = 1
)
t1_array = np.array(t1_array).reshape(opt.height,opt.width,4)
Expand Down Expand Up @@ -205,4 +208,4 @@ def save_image(data, name):
save_image(mixed_img, f"{opt.outf}/mixed_img.png")

# let's clean up the GPU
visii.deinitialize()
visii.deinitialize()
128 changes: 128 additions & 0 deletions examples/14.normal_map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import visii
import noise
import random
import argparse
import numpy as np

parser = argparse.ArgumentParser()

parser.add_argument('--spp',
default=100,
type=int,
help = "number of sample per pixel, higher the more costly")
parser.add_argument('--width',
default=500,
type=int,
help = 'image output width')
parser.add_argument('--height',
default=500,
type=int,
help = 'image output height')
parser.add_argument('--noise',
action='store_true',
default=False,
help = "if added the output of the ray tracing is not sent to optix's denoiser")
parser.add_argument('--out',
default='tmp.png',
help = "output filename")

opt = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # #
visii.initialize_headless()

if not opt.noise is True:
visii.enable_denoiser()

camera = visii.entity.create(
name = "camera",
transform = visii.transform.create("camera"),
camera = visii.camera.create_perspective_from_fov(
name = "camera",
field_of_view = 0.785398,
aspect = float(opt.width)/float(opt.height)
)
)

camera.get_transform().look_at(
visii.vec3(0,0,0), # look at (world coordinate)
visii.vec3(0,0,1), # up vector
visii.vec3(0,0,3), # camera_origin
)
visii.set_camera_entity(camera)

# # # # # # # # # # # # # # # # # # # # # # # # #

visii.set_dome_light_intensity(0)

# third light
obj_entity = visii.entity.create(
name="light",
mesh = visii.mesh.create_plane('light'),
transform = visii.transform.create("light"),
)
obj_entity.set_light(
visii.light.create('light')
)
obj_entity.get_light().set_intensity(10000)

obj_entity.get_light().set_temperature(5000)

obj_entity.get_transform().set_scale(
visii.vec3(0.2)
)
obj_entity.get_transform().set_position(
visii.vec3(1,0,2)
)
obj_entity.get_transform().look_at(
at = visii.vec3(0,0,0), # look at (world coordinate)
up = visii.vec3(0,0,1), # up vector
)
obj_entity.get_transform().add_rotation(visii.quat(0,0,1,0))


# Lets set some objects in the scene
entity = visii.entity.create(
name = "floor",
mesh = visii.mesh.create_plane("mesh_floor"),
transform = visii.transform.create("transform_floor"),
material = visii.material.create("material_floor")
)


entity.get_transform().set_scale(visii.vec3(2))

mat = visii.material.get("material_floor")
mat.set_metallic(0)
mat.set_roughness(1)

# # # # # # # # # # # # # # # # # # # # # # # # #

# load the texture
color_tex = visii.texture.create_from_image("color",'content/Bricks051_2K_Color.jpg')
normal_tex = visii.texture.create_from_image("normal",'content/Bricks051_2K_Normal.jpg')
rough_tex = visii.texture.create_from_image("rough",'content/Bricks051_2K_Roughness.jpg')

mat.set_base_color_texture(color_tex)
mat.set_normal_map_texture(normal_tex)
mat.set_roughness_texture(rough_tex)


# # # # # # # # # # # # # # # # # # # # # # # # #


visii.render_to_png(
width=int(opt.width),
height=int(opt.height),
samples_per_pixel=int(opt.spp),
image_path=f"{opt.out}"
)
visii.render_to_hdr(
width=int(opt.width),
height=int(opt.height),
samples_per_pixel=int(opt.spp),
image_path=f"{(opt.out).replace('png', 'hdr')}"
)

# let's clean up the GPU
visii.deinitialize()
Loading

0 comments on commit 8b0f407

Please sign in to comment.