POV-Ray : Newsgroups : povray.bugreports : Bad cylinder warp causes crash : Re: Bad cylinder warp causes crash Server Time
15 Jun 2021 09:04:17 EDT (-0400)
  Re: Bad cylinder warp causes crash  
From: Bald Eagle
Date: 1 Dec 2018 10:00:02
Message: <web.5c02a1057cc2800765e06870@news.povray.org>
"green" <rov### [at] gmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > hi,
> >
> > "Bald Eagle" <cre### [at] netscapenet> wrote:
> > > I was trying to work out how to create a paneled cylindrical tank, ...
> >
> > > When done improperly, POV-Ray crashes.
> > > A slight change, and it works fine.
> > > ...
> > > cylinder {Origin, y+<0, TankH, 0> 1
> > > scale <TankR, 1, TankR>
> > > texture {TankTex}
> > > //scale <TankR, 1, TankR> // after is fine
> > > }
> >
> > sort of works for me.  your version renders the cap but no walls (maybe because
> > I use a wrong image?), green's version renders cap and solid (blue) wall.
> > strange.  v3.8.0-alpha.9945627.unofficial.
> >
> >
> > regards, jr.
>
> i used povray-3.8.0-x.tokenizer.9945666-av627-Win64.  with the non-crashing
> versions i show a very dark wall (gray), not my image.  i messed around with it
> a little while and concluded i know nothing about 'warp'.  i also do not know
> why putting scale before texture would work, or not work.  but recasting the
> image_map as map_type 2 (no warp) works (shows the image), but crashes when the
> scale is before texture.

I'll have to see if I can install the new tokenizer and executable this weekend.
I started off by copy-pasting the cylinder warp example code from the wiki,
using the hexagon pigment pattern and going from there.

My theory, based upon my difficulty orienting and scaling the image_map,
crashing, and fixing it is this:
The docs describe that the warp has to terminate _somewhere_ and not be
infinite, which is what the distance exponent is.  So when that's very large and
it tries to extend the pattern way out to encompass the edges of the very large
cylinder, some source code internal math / memory thing happens and it crashes.
Switching over to where the cylinder is a 1-unit radius, the texture is applied,
and THEN it is scaled avoids the math/memory issue with the warp, and then the
textured cylinder is subjected to a simple problem-free scaling.

I haven't yet tried scaling the texture - in the way suggested - to see what
combination simply render, actually work (proper final results), or crash.

Anyway - for now, this is just a cautionary notice, and the solution will likely
be to develop such an object at a small scale and then enlarge it AFTER it is
properly textured with the warp.

In the future, it would likely be a huge time-saver to have a macro that takes
the image_map size (or pigment pattern square size), cylinder radius, and number
of desired repeats around the circumference and returns the proper scaling of
the texture.
My personal preference is to write such macros with a flag to trigger some data
to be sent to the debug stream showing the calculations and resulting values....
  Work it out once, have it be available to everyone for decades.

Thanks for looking into this - so many things to do IRL.


Post a reply to this message

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