POV-Ray : Newsgroups : povray.general : About Raytracing : Re: About Raytracing Server Time
20 Apr 2024 07:29:18 EDT (-0400)
  Re: About Raytracing  
From: Bald Eagle
Date: 11 Jul 2019 13:40:00
Message: <web.5d2774194548e5524eec112d0@news.povray.org>
"scorp08" <ozo### [at] gmailcom> wrote:

> I am developing a software with python and I want to implement freecad for cad
> works so is it possible to do same thing with freecad as brlcad did using
> raytracing??

I guess "yes"?
https://forum.freecadweb.org/viewtopic.php?t=19219

>
> Similar to POVray , I want to define a source that emit light (it can be only 1
> particle or it can be particles which defines an area). Output should contain
> followings:
> - Objects name and material IDs of which being hit by the particle or particles
> from the source
> -thickness of the objects
> -location of hitted points in vector form.
>
>
> How can I do that ?
> Do I need a python script also to get material IDs?

Well with regard to Python, you may be interested in looking at:
https://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/

You're probably going to want to familiarize yourself with trace () and
eval_pigment () to get the information you want.

Also, check out this thread:
https://news.povray.org/povray.binaries.images/thread/%3C5baddad1%40news.povray.org%3E/

Now, the way I'm thinking about this is:
you use trace to get the object.  Trace doesn't give you an abject "name", but
when you use the trace function, you specify the object that you want to shoot a
ray at.  If you have several objects, and want to shoot a lot of rays, then you
can use a loop to progress through all of the objects and shoot all of the test
rays.
If you choose unique pigment{} statements, then you can determine which pigment
gets hit by the ray with eval_pigment().
Do a switcheroo with a real texture, and they are functionally equivalent.
To get the thickness of the object along the test ray, you can do a trace {},
get the closest intersection point, and then shoot another ray backwards along
that vector from twice the bounding box thickness of the object, and that will
give you the farthest point (assuming there are no complicating factors like
hollow shells, holes, or other complexities).  Then just subtract the Euclidian
distance from the camera of the near point from the far point, and you have the
thickness.

As already stated, trace() will give you the vector coordinates of the
intersection points.

That should give you a solid start.


Post a reply to this message

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