POV-Ray : Newsgroups : povray.general : About Raytracing Server Time
18 Apr 2024 23:53:05 EDT (-0400)
  About Raytracing (Message 1 to 7 of 7)  
From: scorp08
Subject: About Raytracing
Date: 11 Jul 2019 08:55:01
Message: <web.5d27316da3134cee56755e030@news.povray.org>
Hello All
For a project, I am using brl-cad (https://brlcad.org) for raytracing stuff.
What it does is , it emit a particle towards geometry and give output of
geometry thickness where particle passes, material ID of the geometries ,
particle vector(direction) etc.
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??


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?

It is similar with povray but in povray, I guess I have to define light source
as an area only...
Tnks


Post a reply to this message

From: Alain
Subject: Re: About Raytracing
Date: 11 Jul 2019 11:25:16
Message: <5d2754dc$1@news.povray.org>
Le 19-07-11 à 08:54, scorp08 a écrit :
> Hello All
> For a project, I am using brl-cad (https://brlcad.org) for raytracing stuff.
> What it does is , it emit a particle towards geometry and give output of
> geometry thickness where particle passes, material ID of the geometries ,
> particle vector(direction) etc.
> 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??
> 
> 
> 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?
> 
> It is similar with povray but in povray, I guess I have to define light source
> as an area only...
> Tnks
> 
> 

In POV-Ray, light sources are defined by location and intensity. They 
are point-light by default. Normally/by default, they don't emit any 
«particle».
It works like this (in an oversimplified way):
Rays are shot from the camera toward the objects in the scene. From the 
intersection between those rays and where they hit something, tests are 
made to determine the illumination by shooting a shadow ray toward the 
light source.
This is called backward ray tracing.

It can be changed using the photons feature where light sources will 
emit «photons» toward target objects. Those photons can reflect on the 
target, or, if the target is transparent, go through the object and get 
refracted according to the IOR as defined for that object.
The number of photon shot is specified by a count value or a spacing, or 
density, parameter.
Normally, photons are shot from a single dimensionless geometric point.

If you want a light to «cover» some area, you need to define it as an 
area_light where you determine it's extant and the number of sampling 
points. This won't affect how photons are shot unless you add
photons{area_light}
to the light's definition.
For your purpose, you should also add the «area_illumination» feature to 
your light.


Post a reply to this message

From: Bald Eagle
Subject: Re: About Raytracing
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

From: scorp08
Subject: Re: About Raytracing
Date: 12 Jul 2019 04:40:00
Message: <web.5d2846e24548e55256755e030@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "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.

Is eval_pigment() used for colors only? because I want to give names to the stl
or step objects then , I will start shooting to get thickness, intersection
points (coordinates) and names of objects
Is it possible ?


Post a reply to this message

From: Bald Eagle
Subject: Re: About Raytracing
Date: 12 Jul 2019 06:20:01
Message: <web.5d285e654548e5524eec112d0@news.povray.org>
"scorp08" <ozo### [at] gmailcom> wrote:

> Is eval_pigment() used for colors only?

Yes.
http://wiki.povray.org/content/Reference:Functions.inc
Pre defined functions
eval_pigment(Pigm, Vect): This macro evaluates the color of a pigment at a
specific point. Some pigments require more information than simply a point,
slope pattern based pigments for example, and will not work with this macro.
However, most pigments will work fine.

Parameters:

Vect = The point at which to evaluate the pigment.
Pigm = The pigment to evaluate.

> because I want to give names to the stl
> or step objects then , I will start shooting to get thickness, intersection
> points (coordinates) and names of objects
> Is it possible ?

Right, which is why I laid out the scheme to do everything stepwise - you can
only do what POV-Ray can do - everything else has to be structured to take that
into account.


Post a reply to this message

From: scorp08
Subject: Re: About Raytracing
Date: 12 Jul 2019 09:10:00
Message: <web.5d2886724548e55256755e030@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "scorp08" <ozo### [at] gmailcom> wrote:
>
> > Is eval_pigment() used for colors only?
>
> Yes.
> http://wiki.povray.org/content/Reference:Functions.inc
> Pre defined functions
> eval_pigment(Pigm, Vect): This macro evaluates the color of a pigment at a
> specific point. Some pigments require more information than simply a point,
> slope pattern based pigments for example, and will not work with this macro.
> However, most pigments will work fine.
>
> Parameters:
>
> Vect = The point at which to evaluate the pigment.
> Pigm = The pigment to evaluate.
>
> > because I want to give names to the stl
> > or step objects then , I will start shooting to get thickness, intersection
> > points (coordinates) and names of objects
> > Is it possible ?
>
> Right, which is why I laid out the scheme to do everything stepwise - you can
> only do what POV-Ray can do - everything else has to be structured to take that
> into account.

Does pigment has to be color or can it be any other string ?
Also Can I use those macros in freecad ?
Thnks for the help


Post a reply to this message

From: Alain
Subject: Re: About Raytracing
Date: 12 Jul 2019 10:21:37
Message: <5d289771$1@news.povray.org>
Le 19-07-12 à 09:09, scorp08 a écrit :
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> "scorp08" <ozo### [at] gmailcom> wrote:
>>
>>> Is eval_pigment() used for colors only?
>>
>> Yes.
>> http://wiki.povray.org/content/Reference:Functions.inc
>> Pre defined functions
>> eval_pigment(Pigm, Vect): This macro evaluates the color of a pigment at a
>> specific point. Some pigments require more information than simply a point,
>> slope pattern based pigments for example, and will not work with this macro.
>> However, most pigments will work fine.
>>
>> Parameters:
>>
>> Vect = The point at which to evaluate the pigment.
>> Pigm = The pigment to evaluate.
>>
>>> because I want to give names to the stl
>>> or step objects then , I will start shooting to get thickness, intersection
>>> points (coordinates) and names of objects
>>> Is it possible ?
>>
>> Right, which is why I laid out the scheme to do everything stepwise - you can
>> only do what POV-Ray can do - everything else has to be structured to take that
>> into account.
> 
> Does pigment has to be color or can it be any other string ?
> Also Can I use those macros in freecad ?
> Thnks for the help
> 
> 
> 
It can be a pigment, such as bozo or agate. Most of the time, you'll use 
an identifier defined in a #declare statement.

eval_pigmemt NEVER take illumination into account.

If your pigment is only a plain colour, then, eval_pigment not useful as 
the colour will be the same everywhere.
Take
#declare Pigment = rgb<1,0.1, 0.01>;

This will always evaluate as <1, 0.1, 0.01>.


Post a reply to this message

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