POV-Ray : Newsgroups : povray.binaries.scene-files : soft prisms Server Time
2 Sep 2024 22:18:59 EDT (-0400)
  soft prisms (Message 1 to 5 of 5)  
From: Remco de Korte
Subject: soft prisms
Date: 8 Aug 1999 18:48:23
Message: <37AE08A6.B371B39F@xs4all.nl>
I wasn't exactly sure whether to post this here or in the utilities-group, but
here it is.

I needed a prism with soft edges. I remember wanting to make such a macro some
time ago. I vaguely remember someone mentioning a thing like that here so there
is a chance I'm reinventing the wheel.

With this macro you can make only linear sweeps and splines.

This is a first version which seems to do what I want but I can imagine you can
find some mistakes in it or have suggestions for improvement. Comments are
welcome.

There is something weird though. The test-scene included renders fine, but I
tested it with an orthographic camera and there are thin white lines on some
objects which shouldn't be there. With a normal camera you can also see some,
depending on the location of the camera. I have no idea what's causing this. It
may well be a bug in the macro but I can't find it. Anyone any ideas?

Regards,

Remco
http://www.xs4all.nl/~remcodek/


Post a reply to this message


Attachments:
Download 'softpris.zip' (2 KB)

From: Ron Parker
Subject: Re: soft prisms
Date: 9 Aug 1999 10:24:09
Message: <37aee489@news.povray.org>
On Mon, 09 Aug 1999 00:45:58 +0200, Remco de Korte wrote:
>There is something weird though. The test-scene included renders fine, but I
>tested it with an orthographic camera and there are thin white lines on some
>objects which shouldn't be there. With a normal camera you can also see some,
>depending on the location of the camera. I have no idea what's causing this. It
>may well be a bug in the macro but I can't find it. Anyone any ideas?

This is a bug in POV.  I first reported it back in version 3.0, but I
have had no luck actually finding the problem.  It's similar to the bug
that Truetype fonts used to have, which Kochin Chang fixed.  I sent him
my code that duplicates the problem you see here and he never found a 
solution either, to my knowledge.  What's happening is that POV is 
counting crossings (the Jordan Curve Theorem) to see whether the ray/
object intersection point is inside or outside the object, but it's
accidentally counting a crossing twice due to numerical inaccuracies
or segment overlap or both, and thus thinking it's inside the object
when it shouldn't be.


Post a reply to this message

From: Remco de Korte
Subject: Re: soft prisms
Date: 9 Aug 1999 12:23:54
Message: <37AF00C6.C1E2F046@xs4all.nl>
Ron Parker wrote:
> 
> On Mon, 09 Aug 1999 00:45:58 +0200, Remco de Korte wrote:
> >There is something weird though. The test-scene included renders fine, but I
> >tested it with an orthographic camera and there are thin white lines on some
> >objects which shouldn't be there. With a normal camera you can also see some,
> >depending on the location of the camera. I have no idea what's causing this. It
> >may well be a bug in the macro but I can't find it. Anyone any ideas?
> 
> This is a bug in POV.  I first reported it back in version 3.0, but I
> have had no luck actually finding the problem.  It's similar to the bug
> that Truetype fonts used to have, which Kochin Chang fixed.  I sent him
> my code that duplicates the problem you see here and he never found a
> solution either, to my knowledge.  What's happening is that POV is
> counting crossings (the Jordan Curve Theorem) to see whether the ray/
> object intersection point is inside or outside the object, but it's
> accidentally counting a crossing twice due to numerical inaccuracies
> or segment overlap or both, and thus thinking it's inside the object
> when it shouldn't be.

Is it a bug in the prism-object or somewhere else?

I found another bug in my inc-file I can't solve.
Try rendering this:

#include "softpris.inc"

camera{location <0,0,-12> look_at <0,0,0> orthographic}              

light_source{<-100,20,-100> color rgb 1}
light_source{<100,20,-100> color rgb .7 shadowless}
light_source{<-100,-20,-100> color rgb .4 shadowless}
light_source{<100,-20,-100> color rgb .1 shadowless}


#declare pp=array[3]
{ < 0,-2>,
  <-3, 3>,
  < 3, 3>}

object{soft_prism(-2,2,3,pp,.25)
  pigment{rgb 1}   
  rotate y*225
  rotate x*-45 
  translate<-3,0,0>
}
  
#declare pp=array[3]
{ < 0, 2>,
  <-3,-3>,
  < 3,-3>}

object{soft_prism(-2,2,3,pp,.25)
  pigment{rgb 1}   
  rotate y*45
  rotate x*-45 
  translate<5,0,0>
}
//eof  

Both objects should look the same, but they don't. I can't find what I'm doing
wrong and where I'm doing it. If anyone has any ideas please let me know. 
Meanwhile if a soft prism looks screwy the only solution is to create a another
soft prism and rotate that to get the prism you want. Not really very elegant...

Regards,

Remco
http://www.xs4all.nl/~remcodek/


Post a reply to this message

From: Ron Parker
Subject: Re: soft prisms
Date: 9 Aug 1999 13:05:30
Message: <37af0a5a@news.povray.org>
On Mon, 09 Aug 1999 18:24:38 +0200, Remco de Korte wrote:

>Is it a bug in the prism-object or somewhere else?

It's in the prism object.  For your purpose, since your prisms
are always convex, you could just intersect a bunch of planes and
bound them apropriately.

>I found another bug in my inc-file I can't solve.
>Try rendering this:
[code elided]
>Both objects should look the same, but they don't. I can't find what I'm doing
>wrong and where I'm doing it. If anyone has any ideas please let me know. 

The problem is in your calculation of nn.  Its sign seems to be dependent on 
the direction you go around the prism.  I find that if I put a 

#declare nn=-nn;

in the right place, the bad prism becomes good and the good one becomes bad.


Post a reply to this message

From: Remco de Korte
Subject: Re: soft prisms
Date: 9 Aug 1999 18:07:22
Message: <37AF513E.72E90B40@xs4all.nl>
Ron Parker wrote:
> 
> On Mon, 09 Aug 1999 18:24:38 +0200, Remco de Korte wrote:
> 
> >Is it a bug in the prism-object or somewhere else?
> 
> It's in the prism object.  For your purpose, since your prisms
> are always convex, you could just intersect a bunch of planes and
> bound them apropriately.
> 
> >I found another bug in my inc-file I can't solve.
> >Try rendering this:
> [code elided]
> >Both objects should look the same, but they don't. I can't find what I'm doing
> >wrong and where I'm doing it. If anyone has any ideas please let me know.
> 
> The problem is in your calculation of nn.  Its sign seems to be dependent on
> the direction you go around the prism.  I find that if I put a
> 
> #declare nn=-nn;
> 
> in the right place, the bad prism becomes good and the good one becomes bad.

Okay, thank you.
I guess I'll leave it at this for now.

Regards,

Remco
http://www.xs4all.nl/~remcodek/


Post a reply to this message

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