POV-Ray : Newsgroups : povray.off-topic : Geometric puzzle : Re: Geometric puzzle Server Time
5 Sep 2024 03:20:01 EDT (-0400)
  Re: Geometric puzzle  
From: Invisible
Date: 18 Dec 2009 04:53:07
Message: <4b2b5103@news.povray.org>
>>> That method has problems when you are drawing triangles adjacent to 
>>> each other.
>>
>> Like what?
> 
> Well draw your first filled triangle with your algorithm, and down the 
> edges I presume most pixels will have some fractional coverage.  So if 
> the coverage for a particular pixel is say 25%, I assume you take 25% of 
> the triangle colour and blend it with 75% of the existing background 
> colour. All looks very nice and perfectly AA'd.

Well, presumably you'd need an alpha channel. Otherwise any further 
drawing to these partially-covered pixels won't look right...?

>>> Also how does your method work with a pixel shader?
>>
>> If I actually knew what a pixel shader is, I could maybe answer. :-)
> 
> The pixel shader is the code that gets called on the GPU to calculate 
> the pixel value.  It will be passed various bits of information like the 
> world coordinates, screen coordinates, lighting vectors etc.

Interesting. I didn't know that. Last time I looked, the GPU takes a 
polygon, and optionally a texture, optionally does some point-light 
calculations, and draws a textured polygon according to the current 
camera position. The textures are usually MIP-mapped - in other words, 
AA precomputed - so that only leaves the polygon edges to worry about.

> Should the 
> GPU still pass the coordinates of the *centre* of the pixel, even if 
> only 25% of one corner is actually being covered?  Or is it more correct 
> to pass the coordinates of the centre of the sub-pixel area that is 
> being shaded?  IDK.

If I had to take a guess, I'd say pretend that the polygon extends to 
infinity in all directions, run the shader as usual, and then just 
adjust the alpha channel according to polygon coverage. (IOW, yes, the 
center of the screen pixel.) OTOH, I haven't actually tried it to see 
what it looks like...

>> Unless it's a particle method.
> 
> You mean to be rendered as a fluid?  You can't just raytrace particles 
> directly either, you need some algorithm to make it look like a fluid.  
> I suspect algorithms exist for raytracing particles as a fluid (blobs?) 
> and also for creating meshes from particles.  Anyway, people don't place 
> the triangles by hand.

Yeah, if you use particles you need to somehow construct a surface from 
the particle positions. But saying "all points within K units of a 
particle are designed as inside" is much easier than trying to determine 
the curvature of a complex shape and tesselate it with just the right 
number of triangles...

But hey, what do I know? Apparently nothing.


Post a reply to this message

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