Last active
August 11, 2017 17:05
-
-
Save Utopiah/eeac6d35b6032634907931f548c0a90b to your computer and use it in GitHub Desktop.
360 map for offline rendering of an existing heavy scene
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 360 map for offline rendering of an existing heavy scene | |
""" | |
example of player https://vatelier.net/MyDemo/Browsable360s/ | |
improvement | |
- have an example WITHOUT a mesh in the middle creating a black screen, duh | |
- fading in/out with a bit of virtual camera movement for target loading | |
- stero renders | |
- using a shader to do the warping, preloading the neirhbours, etc | |
- motion estimation to compress | |
- link parameters between the Blender script and the WebVR page (e.g position, rotation, scale) | |
- generate the "player" also | |
- teleport controls and a grid with no depthtest (swap with a low res version then swap as transition) | |
- depth texture to manage occlusion/physical limitation | |
- continuous render densification (gradually increasing the number of renders up to a certain upper limit in time, cycles or size) | |
""" | |
import bpy | |
bpy.context.scene.render.engine = 'CYCLES' | |
bpy.context.scene.cycles.device = 'GPU' | |
bpy.ops.object.select_camera() | |
bpy.context.object.data.type = 'PANO' | |
#bpy.context.scene.file_format = 'JPEG' | |
bpy.context.object.data.lens = 5 | |
bpy.context.scene.render.resolution_percentage = 100 | |
bpy.context.object.data.cycles.panorama_type = 'EQUIRECTANGULAR' | |
print('Rendering in: '+bpy.app.tempdir) | |
preview = True | |
full = True | |
bpy.context.object.location = (-2, 0, 1) | |
for i in range(0,5): | |
bpy.ops.transform.translate(value=(1, 0, 0)) | |
for j in range(0,5): | |
bpy.ops.transform.translate(value=(0, 1, 0)) | |
x = str(round(bpy.context.object.location[0])) | |
y = str(round(bpy.context.object.location[1])) | |
z = str(round(bpy.context.object.location[2])) | |
if full: | |
bpy.context.scene.render.resolution_x = 2048 | |
bpy.context.scene.render.resolution_y = 1024 | |
bpy.data.scenes['Scene'].render.filepath = bpy.app.tempdir+'image_'+x+'_'+y+'_'+z+'.jpg' | |
bpy.ops.render.render( write_still=True ) | |
if preview: | |
bpy.context.scene.render.resolution_x = 512 | |
bpy.context.scene.render.resolution_y = 256 | |
bpy.data.scenes['Scene'].render.filepath = bpy.app.tempdir+'preview_'+x+'_'+y+'_'+z+'.jpg' | |
bpy.ops.render.render( write_still=True ) | |
if (j == 4): | |
bpy.ops.transform.translate(value=(0, -5, 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment