POV-Ray : Newsgroups : povray.binaries.images : Ping Pong : Re: Ping Pong Server Time
2 Aug 2024 02:21:51 EDT (-0400)
  Re: Ping Pong  
From: alphaQuad
Date: 24 Mar 2008 00:35:00
Message: <web.47e73cdd41aa233d34ef70380@news.povray.org>
Did'nt have much time today (or lastnight) obviously this is just preview code
and much will change with correct design. (still need a star, people must not
want this much)

Update:
//rearview (camera must be co-set)
#declare cameramatrix = array[16] { -1.0, 0.0, 0.0 0.0,
 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }

//#declare cameramatrix = array[16] { 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 }
#declare  worldmatrix = array[16] { 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 }
//Stars(400, 512, 60, 70)
#macro Stars(minmag, w, an, fac)
  #local ab = invertmatrix(cameramatrix,worldmatrix);
  #local stars=union {
     #local m=0.00058/(w/800)/(50/an);
     #local i=0;
     #while (i<dimension_size(Cat, 1))
       #local rad=(abs(((val(Cat[i][0]) + 2.4) - 16.6)) - 2) *fac;
       //*$asa-sin(%PI.5,637,%a)
       #if (rad < minmag) #local rad = minmag; #end

       #local ra=val(Cat[i][1])*15+val(Cat[i][2])*0.25;
       #local dec=val(Cat[i][3]);
       #local _v = <cos(radians(ra))*cos(radians(dec)), sin(radians(dec)),
          sin(radians(ra))*cos(radians(dec))>;

       #local _v = _v*300000; //distance cant used now val(Cat[i][4])
       #local ab = pop_matrix(worldmatrix,_v)
       #if (ab.z > 0.0)

         #if (mod(i,2) = 0)
           text {
             ttf "Arial.ttf" Cat[i][5] 1 0 scale<8, 8, .000001>
             texture {
               pigment { rgb starcolor(Cat[i][6]) }
               finish { ambient 1 diffuse 0 }
             }
             translate <0,0,800>
             rotate <-dec,0,0>
             rotate <0,-ra+90,0>
           }#end
         sphere { _v, rad pigment { rgb starcolor(Cat[i][6]) }
           finish { ambient 1 diffuse 0 }
         }
       #end
       #declare i=i+1;
     #end
  }
  object { stars }
#end

other stuff to think about ***************************

To set the size of a sphere, you will use a formula that looks something like
the following:

    * Sphere radius = k * sqrt(L/L0)

where L is the star's true luminosity and L0 is some reference value for that
luminosity -- for example, L0 might be the luminosity of the Sun, so L would
then be in multiples of solar luminosity.

Since it's the sphere's radius, not area, that the POV-Ray
sphere object expects to see, we need the square root of the whole thing.
Doubling the luminosity doubles the star's apparent area. The constant k will
adjust the ratio L/L0 into an appropriate value for POV-Ray; we can figure it
out later while doing some test traces.

If you're pulling data straight from a star catalog, you're
probably either extracting or calculating the absolute
magnitude instead of a luminosity. They're closely related, however. The
relationship between luminosity L and absolute magnitude MV is given by:

    * MV = MV0 + 2.5 log (L / L0)

where L0 and MV0 are the reference values (i.e. star with luminosity L0 has
absolute magnitude MV0).

This means we can rewrite the sphere radius formula as:

    * Sphere radius = k * sqrt(10(0.4 * [MV - MV0]))

To simplify things, we can choose the reference magnitude,
MV0, to equal 0. Then:

    * Sphere radius = k * sqrt(10(0.4 * MV))

Problems with the simple model

This simple model is good in many respects, but it has one big flaw: it is very
difficult to get realistic star images over a wide range of magnitudes. In
particular, stars that are very bright as seen from Earth, such as Sirius, tend
to look like big disks, whereas dim stars tend to fade out altogether.
A simple fix

One solution to this is to "compress" the symbol range according to the apparent
magnitude of the stars. This results in a formula for sphere size that looks
like the following:

    * Sphere radius = k * sqrt(10(0.4 * MV)) * (B/B0)n

where B is the apparent brightness of a star, B0 some reference brightness, and
n is a number between 0 and -1. The value n effectively decreases the sphere
size for stars with large B, and increases it for stars of small B. The
brightness ratio can be determined from apparent magnitudes much as the
luminosity ratio could be determined from absolute magnitudes:

    * V = V0 + 2.5 log (B / B0)
    * B / B0 = 10(0.4 * [V - V0])

Thus you could set a reference magnitude roughly in the middle of the naked-eye
range, such as +3, and a value of n around -0.5 or so, to uniformly shrink the
largest stars and enlarge the smallest ones.


Post a reply to this message


Attachments:
Download 'planete5.png' (49 KB)

Preview of image 'planete5.png'
planete5.png


 

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