POV-Ray : Newsgroups : povray.newusers : Spark/Electricity : Re: Spark/Electricity Server Time
7 Jul 2024 06:53:43 EDT (-0400)
  Re: Spark/Electricity  
From: Reactor
Date: 9 Apr 2010 03:55:00
Message: <web.4bbedce95cca2b36a00793690@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> For that, you need to use emissive media.
> Define your "spark" verticaly around the origin with a cylinder of the
> desired lengt.
>
> Make that cylinder hollow and give it texture{rgbt 1} The cylinder is
> now totaly invisible.
> Add an interior block to it.
>
> Fill it with emissive media.
>
> Give the media a cylindrical pattern.
> The cylindrical pattern have a value of 1 around the Y axis that falls
> to zero at a radius of 1.
>


As it turns out, since the glows were originally spherical in shape, one may
also use a unit sphere with emission media and a spherical density pattern as a
replacement for the glow statement within the macro.  This would allow you to
use it with official versions of povray, but the output may be slightly
different.  I'm going to play with this a bit and see if I can get a more
correct output and I encourage you to do so also.

If you are very new to povray, note that scenes intended strictly for megapov
have the "#version unofficial" directive.  If you are modifying such a scene to
work with an official version, those version directives must be changed or
removed entirely in addition to any features not supported by the official
version (in this case, the glow statement on line 39 in electric.inc).

I replaced the glow statement with the sphere below:


//-------------------
sphere{ <0,0,0>, 1 pigment{ color rgbt 1 }
    interior{
    #local M_samples = 15;
    #local M_variance = 1/500;
        media
        {
            intervals 1
            samples M_samples
            confidence 1 - M_variance
            variance m_variance
            emission color rgb 1
            method 3
            aa_threshold 0.1
            aa_level 4
            //jitter 0.5
            density{
                spherical
                poly_wave 1.5
                color_map{
                [0.00 color rgb 0 ]
                [0.80 color rgb ElectricColor(ValueM)*Brightness*2 ]
                [0.90 color rgb <1,1,1>*Brightness*75  ]
                [1.00 color rgb <1,1,1>*Brightness*200 ]
                        }
            }
        }
    }

hollow
#if(Thickness>0) scale Thickness  #else scale 0.50 #end
translate PointM
}

//-------------------

Note that this is a very quick and dirty hack job that suffers from several
problems:
*The media quality (as controlled by the samples parameter) is simply a
placeholder number - you should be able to set the sample count via the macro.
*The density statement needs work to achieve matching image output -
particularly with the Brightness values.  The way media behaves when scaled
means that the Brightness value must be taken into account when the in scene
diameter (controlled by the Thickness parameter in the original macro) is very
large or very small.
*Depending on the number of objects and the view, you may have artifacts if the
max_trace_level is hit.
*The above version does not cast any light.

Almost all of those problems can be addressed, but it'll probably take me a few
days.  Also, I believe Rune still posts on here occasionally, and I'm sure he'd
be interested in extending the functionality by making it compatible with
current versions.

    HTH,
  -Reactor


Post a reply to this message

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