POV-Ray : Newsgroups : povray.windows : How to generate sphere and cylinder with csv file : Re: How to generate sphere and cylinder with csv file Server Time
8 Feb 2023 08:24:01 EST (-0500)
  Re: How to generate sphere and cylinder with csv file  
From: Bald Eagle
Date: 6 Apr 2017 09:05:00
Message: <web.58e63ca1ae95604b80403a200@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> My guess would be that you have arbitrary text in the CSV file; in that
> case, you'll need to make sure it is enclosed in double quotes, e.g.
>     "Foo"
> instead of
>     Foo

Jeff, look at the comment in the code:
//  data format: "bus", "CN/Beijing", "bus2382659521", 116.4093833, 39.9067192,
//    etc.

That's exactly how it all will need to be formatted.
I'd probably use a spreadsheet, "copy" the data into an adjacent set of cells,
by using a formula that surrounds the relevant data with double quotes (the
String Literal POV-Ray is wanting for the #read directive) and commas and then
copying and pasting that into a text document, or displaying the data on a
separate spreadsheet and saving it to CSV format that way.

="\""&A1&"\", "&"\""&A2&"\", "&A3&"\", "&A4&"\", "&A5&"\","
or something like that

POV-Ray is a raytracer that generates 2D static images.  It can't render a 3D
model that you can then move around and inspect on-the-fly.
You can make an animation from a large series of static images sequentially
arranged, but it's as interactive as a VHS movie.

It seems like you have a fair amount of stuff you want to do - so for now, I'd
step back for a sec, write up some simple scenes from scratch, "wrap your head
around" POV-Ray's syntax, error messages, definitions, and other things peculiar
to it, and just get your 4 image layers working all by themselves.
You will have to use "transmit all 0.9" (or some other value) for the top 3
layers, so that you can see through them.

My standard bit of saved code for Image Mapping a box is:

#declare Feet = 12;
//  Sized image Map - 1 unit thick box
#declare XSize = 4*Feet;
#declare ImageMap = pigment {image_map {png "MyImage.png" once} };
#declare Resolution = max_extent (ImageMap);
#declare Resolution = Resolution + <0, 0, 1>;

#declare ImageMappedBox =
 box {0, 1
  texture {
   pigment {ImageMap}
  translate <-0.5, -0.5, -0.5>
  scale Resolution*(1/Resolution.x)*XSize
  //translate y*(Resolution.y / Resolution.x)*XSize/2

object {ImageMappedBox translate <0, 0, 0>}

Set yourself up some visible axes, and maybe a grid to give yourself some
orientation in the scene and maybe a sphere at the origin for a reference
marker.  (AT the beginning, it's easy to forget to include a camera, a light
source, get you axes mixed up, use right-hand rule instead of left hand rule,

You're going to need all these skills once you start creating a scene that's set
up for rendering frames for an animation - because you're going to need to
understand how the guts of the code works when you write the formulas with the
clock variable to control how everything is rendered in each successive frame.

Do everything stepwise, and save a working result with a different filename, so
that as you progressive, you don't overwrite your Last-Known-Good scene.

1. make a basic scene with axes
2. add a grid to give a sense of scale
3. add 4 layered boxes
4. move you camera around by editing the code and rerendering
4a. save as a different filename
5. add image_map textures
6. adjust transmit and scaling
N. add point and lines from the first scene code
N++. define the formulas to create a series of renders for animating
N++1.  Run you .ini animation file and let it churn them all out
N++2. Use a 3rd party software (VideoMach, etc) to make the static images into a
video file

and then tweak, tweak, tweak, rewrite and debug   ;)

There are plenty of example scenes, Lohmueller's site, the standard include
drop-down menu, and the POV-Ray scene files sections of the forum.

Only you will know exactly what you want, and we can't write it all for you -
you're best served by spending a few hours ( ;) ) grappling with what we all
struggled with when we first started doing this.

But we are here to help  :)

Post a reply to this message

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