POV-Ray : Newsgroups : povray.advanced-users : clutter.mcr and trace() Server Time
21 Dec 2024 11:55:30 EST (-0500)
  clutter.mcr and trace() (Message 1 to 10 of 28)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: clutter.mcr and trace()
Date: 17 May 2021 01:12:14
Message: <60a1fb2e@news.povray.org>
I am having trouble getting the `trace` function to detect intersections 
with a mesh object. Does `trace` not recognize meshes? Thanks!


Mike


Post a reply to this message


Attachments:
Download 'clutter_003.zip' (2940 KB)

From: Thomas de Groot
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 02:31:50
Message: <60a20dd6$1@news.povray.org>
Op 17/05/2021 om 07:12 schreef Mike Horvath:
> I am having trouble getting the `trace` function to detect intersections 
> with a mesh object. Does `trace` not recognize meshes? Thanks!
> 
It might... if the meshes are not well-behaving, for instance if the 
normals of each mesh face are not /all/ consistently pointing outwards, 
or if the mesh is not 'closed'. Mesh objects (especially when generated 
by external programs and not POV-Ray) are notorious.

I would suggest to convert your meshes with Poseray to mesh2 objects 
which are much better behaving than mesh objects. I tried to upload your 
file as a whole into Poseray but it appears to be too big for the 
program, so upload chunks of meshes separately. I am not sure if you can 
put them together again afterwards as it is bad practice to edit mesh2 
files manually, but you can put them in a union at least.

-- 
Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 02:40:50
Message: <60a20ff2$1@news.povray.org>
I had not loaded the code before in POV-Ray, but it appears that each 
mesh is only 1 (one!) triangle... This is terrible, and no wonder trace 
does not work well. You need to have at least one mesh containing /all/ 
the triangles to start with if you want it to work at all.

-- 
Thomas


Post a reply to this message

From: Mike Horvath
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 03:57:32
Message: <60a221ec@news.povray.org>
On 5/17/2021 2:40 AM, Thomas de Groot wrote:
> I had not loaded the code before in POV-Ray, but it appears that each 
> mesh is only 1 (one!) triangle... This is terrible, and no wonder trace 
> does not work well. You need to have at least one mesh containing /all/ 
> the triangles to start with if you want it to work at all.
> 


I attached new terrain with a single mesh2 object, but the issue 
persists! :(


Mike


Post a reply to this message


Attachments:
Download 'clutter_004.zip' (4244 KB)

From: Mike Horvath
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 04:39:04
Message: <60a22ba8$1@news.povray.org>
On 5/17/2021 2:40 AM, Thomas de Groot wrote:
> I had not loaded the code before in POV-Ray, but it appears that each 
> mesh is only 1 (one!) triangle... This is terrible, and no wonder trace 
> does not work well. You need to have at least one mesh containing /all/ 
> the triangles to start with if you want it to work at all.
> 

Alternatively, do you know how I might create a bitmap heightfield image 
from this data?

For instance, if I were to copy the coordinates into an array and loop 
through the array?

Thanks.


Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 04:47:28
Message: <60a22da0$1@news.povray.org>
Op 17/05/2021 om 09:57 schreef Mike Horvath:
> I attached new terrain with a single mesh2 object, but the issue 
> persists! :(
> 

As /last/ line inside the mesh2 {} add the following line:

inside_vector <0,0,1>

For good measure, add the line also to the sf_terrain_water_dot_ldr 
mesh2 object.

Then it works, at least in my system.

-- 
Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 04:56:02
Message: <60a22fa2$1@news.povray.org>
Op 17/05/2021 om 10:39 schreef Mike Horvath:
> On 5/17/2021 2:40 AM, Thomas de Groot wrote:
>> I had not loaded the code before in POV-Ray, but it appears that each 
>> mesh is only 1 (one!) triangle... This is terrible, and no wonder 
>> trace does not work well. You need to have at least one mesh 
>> containing /all/ the triangles to start with if you want it to work at 
>> all.
>>
> 
> Alternatively, do you know how I might create a bitmap heightfield image 
> from this data?
> 
> For instance, if I were to copy the coordinates into an array and loop 
> through the array?
> 
Thinking aloud here... assuming that you can render the landscape itself 
without trouble (I assume you can) then using a gradient texture going 
e.g. from black (bottom) to white (top) on the landscape, and rendering 
that with an orthographic camera from above, within a white sphere 
containing a finish {emission 1 diffuse 0}... that would do the job imo. 
Make a large render, at least 2048x2048px.

-- 
Thomas


Post a reply to this message

From: Mike Horvath
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 04:59:03
Message: <60a23057$1@news.povray.org>
On 5/17/2021 4:47 AM, Thomas de Groot wrote:
> Op 17/05/2021 om 09:57 schreef Mike Horvath:
>> I attached new terrain with a single mesh2 object, but the issue 
>> persists! :(
>>
> 
> As /last/ line inside the mesh2 {} add the following line:
> 
> inside_vector <0,0,1>
> 
> For good measure, add the line also to the sf_terrain_water_dot_ldr 
> mesh2 object.
> 
> Then it works, at least in my system.
> 

It is still not working for me. There are no errors or warnings, but the 
spheres and cones are still at y = 0 instead of conforming to the hills.

Can you upload your working files?


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 05:01:23
Message: <60a230e3$1@news.povray.org>
On 5/17/2021 4:56 AM, Thomas de Groot wrote:
> Thinking aloud here... assuming that you can render the landscape itself 
> without trouble (I assume you can) then using a gradient texture going 
> e.g. from black (bottom) to white (top) on the landscape, and rendering 
> that with an orthographic camera from above, within a white sphere 
> containing a finish {emission 1 diffuse 0}... that would do the job imo. 
> Make a large render, at least 2048x2048px.
> 

The problem is that the pixels in a heightmap represent _vertices_ (and 
are therefore n+1 pixels per side) whereas a rendered image as you 
describe shows _faces_. So there will be a discrepancy (that I would 
like to avoid).


Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: clutter.mcr and trace()
Date: 17 May 2021 09:39:37
Message: <60a27219@news.povray.org>
Op 17-5-2021 om 10:59 schreef Mike Horvath:
> It is still not working for me. There are no errors or warnings, but the 
> spheres and cones are still at y = 0 instead of conforming to the hills.
> 
> Can you upload your working files?
> 

I only changed terrain.pov in the package. Attached also a render of the 
scene.


-- 
Thomas


Post a reply to this message


Attachments:
Download 'makescene.png' (358 KB) Download 'clutter_004b.zip' (4489 KB)

Preview of image 'makescene.png'
makescene.png

Goto Latest 10 Messages Next 10 Messages >>>

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