POV-Ray : Newsgroups : povray.general : using POV-Ray as 3D renderer for Python scripts : Re: using POV-Ray as 3D renderer for Python scripts Server Time
29 May 2024 16:13:28 EDT (-0400)
  Re: using POV-Ray as 3D renderer for Python scripts  
From: kurtz le pirate
Date: 16 Sep 2021 13:40:56
Message: <614381a8$1@news.povray.org>
On 12/09/2021 23:52, Florin Andrei wrote:
> I'm not happy with what I've seen so far in terms of rendering 3D graphs in
> Python. I want to be able to draw many points in 3D, each with its own
> coordinates and other attributes such as size and color, and render the scene
> with optional dynamic parameters (such as rotating it around some axis).
> But that would mean POV-Ray would have to take a scene file with thousands of
> small objects (the dots), each point being a small opaque sphere. The file will
> be machine-generated and fairly large. Should I be concerned with the
> performance of the renderer?
> The scene will otherwise be simple - I will draw a system of coordinates, and
> optionally grids of coordinates. I'm not planning on using textures.

Very easy. POV-Ray is able to read data from file.
Look at this page.

Your Python script can write data to a file with (for exemple) the3DPos 
(a vector), theSphereRadius (a scalar) and theColor (a color).
Each value separated with ","

The POV code open the file, read lines and for each of them define a 
sphere at the the3DPos with radius = theSphereRadius, and a 

Simplified code :
#fopen FILE fileName read
#while (defined(FILE))
  #read (FILE,p,r,c)
  sphere { p, r pigment { color c } }
#fclose FILE

there are always several ways to code ;)

Kurtz le pirate
Compagnie de la Banquise

Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.