PySpace icon indicating copy to clipboard operation
PySpace copied to clipboard

Totally black rendered images

Open andreascip98 opened this issue 5 years ago • 5 comments

The recording functionality (r key) should produce the rendered frames as images, to ./Playback folder. The problem is that i'm getting totally black images, even changing fps or resolution or any settings inside "camera.py".

Any guess?

andreascip98 avatar Nov 21 '20 10:11 andreascip98

I just started using this program and I'm having the same issue.

Qwerter49 avatar Nov 25 '20 19:11 Qwerter49

Found solution, works perfectly:

Inside ray_marcher_demo.py

from PIL import Image
from PIL import ImageOps

# REPLACE THIS:
pygame.image.save(window, 'playback/frame' + ix_str + '.png')

# WITH THIS:
glPixelStorei(GL_PACK_ALIGNMENT, 1)
data = glReadPixels(0, 0, window.get_width(), window.get_height(), GL_RGB, GL_UNSIGNED_BYTE)
image = Image.frombytes("RGB", (window.get_width(), window.get_height()), data)
image = ImageOps.flip(image)
image.save('playback/frame' + ix_str + '.png', 'PNG')
# Do the same for:
pygame.image.save(window, 'screenshot.png')

jookovjook avatar Dec 17 '20 19:12 jookovjook

when i replace it, it says there's an error with an "unexpected indent." i'm new to stuff like this, can someone help?

harperawl avatar Apr 06 '21 16:04 harperawl

when i replace it, it says there's an error with an "unexpected indent." i'm new to stuff like this, can someone help?

Python 3 does not allow the mixing of spaces and tabs. Delete the tabs at the start of each line you added and try adding spaces instead, or vice versa. It would be a good idea to download an IDE like VS Code which will autodetect which is being used in the current file and format it correctly (convert tabs to spaces if necessary)

Ayers-Kendall avatar Apr 07 '21 02:04 Ayers-Kendall

I have fixed this issue in my fork of the repo, and plan to expand this project quite a bit when I have the time. Everyone feel free to check it out, and also contribute if desired

Ayers-Kendall avatar Apr 08 '21 20:04 Ayers-Kendall