Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to save the color buffer and depth buffer of a given camera in a scene in Blender Game Engine every frame to a file (each to their own file). Is this possible? How can this be setup using the BGE and python?

Ive asked on the Blender Artists forum but noone seems to have picked up the question.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Saving the frame buffer out to a file is a very slow operation. So I am going to be assuming you don't have to do this in real time... So what you will want to do is set up two sets of shaders. One that is your normal color shader, and another that renders the depth of the object as the color. Then you will render your scene twice with both sets of shaders. From there you have two options...

  1. Use BGL.glReadPixels to read the screen image every frame and export them manually.
  2. Switchover to the standard blender renderer and render an animation with both sets of shaders.
share|improve this answer
    
How do I render the screen twice in BGE? –  twerdster Jun 8 '12 at 18:07
    
Dont, either swap the shaders every other frame (render color on even frames, then depth on odd) or render the entire sequence twice. May I ask what you are wanting to use this for? –  Skyler Saleh Jun 8 '12 at 18:16
    
Il use the first method. Definitely the easiest. Using it to simulate depth scanner –  twerdster Jun 8 '12 at 18:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.