POV-Ray : Newsgroups : povray.general : Stars, sizes, and antialiasing. (Was: Re: Starfields...) : Re: Stars, sizes, and antialiasing. (Was: Re: Starfields...) Server Time
5 Aug 2024 16:10:05 EDT (-0400)
  Re: Stars, sizes, and antialiasing. (Was: Re: Starfields...)  
From: Rafal 'Raf256' Maj
Date: 27 Aug 2002 17:20:44
Message: <Xns9277ECD4D8FBEraf256com@204.213.191.226>
"ron_ivi" <nomail@nomail> wrote in
news:web.3d6bc301b4c1e988cd0d0b840@news.povray.org 

> On the subject of stars and starfields, how do you make little stars
> show up?

I was alsow thinking about this problem.
Imho - primitive "pivel" would be very useful.
syntax :

pixel {
  CENTER
  color
  TRANSFORMS
}

i.e.
pixel { <1e5,0,0>  <.1, .1, 1>*.8  rotate y*24 rotate z*143 }

will give nice star.

How to implement it ? quite simple.
1. take coordinates after all transforms, i.e. A=<100,250,380>
2. project it into screen, to get i.e. P=<12.0001, 10.05> pixel. So this 
point is almost at center of pixel <12,10> in output image.
3. round screen cordinates (P), to P'=<12.0,10.0>
4. reverse-project it - find point more close to A, that projected on 
screen gives A'. i.e. P'=<101,245,380>

The intersection test of 'pixel' is same as sphere with radius==epsilon (or 
some tolerance value)

There are 2 problems :
- pixel will disapera when strong AA is on
- too many small pixels without AA will make strange effect


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

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