Search code examples
pythonblenderrender-to-texture

Can Blender generate a scene based off of a text file?


I have written a program in Python that generates a 10,000 tile coordinate plane with each tile having characteristics such as texture, temperature, elevation etc. I am doing this for a project and thought a much better way to show this part of the project would be to show a 3d rendering of it and the best program i know for that is Blender. I know scripts can be written in Python for Blender but I'm not sure how blender can generate things based off of a text file that my Python program writes to. If anyone knows if and how Blender can generate things from a text file or any other way i could have my Python program write to Blender would be excellent!

~ Thanks


Solution

  • You will have to make a Python script for that - that would read your text file and use blender API internally to create the tiles and the scene. Blender can only render files if it does have programs (plug-ins) that do that. Actually most file-formats can be read by blender just due to plug-ins implemented in Python that are shipped with the program.

    Alternatively, you can adapt your program that generates the scene to be able to, beyond generating the text file, to draw it inside blender using its API instead. This approach might be easier than writing a separate logic to parse your own file.

    If your script is Python2.x you will have to use blender 2.49 - as Blender 2.5 and newer versions use Python 3 for scripting.