Multilayer image rendering (and some scripting errors)

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Masoumeh
Posts: 1
Joined: Sat Sep 29, 2012 6:23 pm

Multilayer image rendering (and some scripting errors)

Postby Masoumeh » Sat Sep 29, 2012 7:06 pm

Hi all,

Just to make my question clear, first I have a short explanation about my task. I would appreciate if you tell me any comment for each step of my work, since i am beginner in this stuff.
I want to render an image for display on a multilayer display, based on the z values of the picture. I found Blender as a rendering tool (it means i am completely new :wink: ) to have the z values of an image and then use those value to make two images, as a 2 layer image, in opengl.
So, for extracting z value in Blender, I opened a .blender image, clicked on "Render" menu, then wrote a short script of Python, like:

import bgl
zbuf = bgl.Buffer(bgl.GL_FLOAT, [100*100])
bgl.glReadPixels(150, 140, 100, 100, bgl.GL_DEPTH_COMPONENT, bgl.GL_FLOAT, zbuf)

But I got for all z values 1.0. I know almost nothing about working with Blender. Is there something I am missing?
And, is the process that i am going to do with the whole idea correct or achievable?


Thanks in advance

Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest