Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weird render behavior #170

Open
weberhen opened this issue Sep 16, 2021 · 0 comments
Open

weird render behavior #170

weberhen opened this issue Sep 16, 2021 · 0 comments

Comments

@weberhen
Copy link

Hi!

I'm puzzled by a simple render script of mine. I have a sphere and an envmap with two source lights symmetrically placed. For some reason, depending on the values of the lights, the final render is not symmetrical, even though the sphere is placed exactly in the middle of the lights. The code bellow reproduces the problem:

import torch
import pyredner
import numpy as np
import cv2

vertices, indices, uvs, normals = pyredner.generate_sphere(theta_steps = 64, phi_steps = 128)
m = pyredner.Material(diffuse_reflectance = torch.tensor((0.5, 0.5, 0.5), device = pyredner.get_device()))
obj = pyredner.Object(vertices = vertices, indices = indices, uvs = uvs, normals = normals, material = m)
cam = pyredner.automatic_camera_placement([obj], resolution = (480, 640))

envmap_img = np.zeros((16, 32, 3)).astype(np.float32)
envmap_img[2:3, 4:5, :] = 1000
envmap_img = envmap_img + np.flip(envmap_img, axis=1)
envmap_img = cv2.resize(envmap_img, (2048, 1024))
envmap_img[envmap_img > 0] = 1000
envmap_img = torch.tensor(envmap_img).to(pyredner.get_device())

pyredner.imwrite(envmap_img.cpu(), '_envmap.png', normalize=True)

envmap = pyredner.EnvironmentMap(envmap_img, directly_visible=False) # *10 to make the image brighter
scene = pyredner.Scene(objects = [obj], camera = cam, envmap=envmap)
img = pyredner.render_pathtracing(scene, num_samples=1024, use_primary_edge_sampling=True, use_secondary_edge_sampling=True)

pyredner.imwrite(img.cpu(), '_render.png', normalize=True)

The above code produce expected result bellow:
Screenshot from 2021-09-16 09-45-32

But once I comment line envmap_img[envmap_img > 0] = 1000 the result becomes:
Screenshot from 2021-09-16 09-46-27

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant