|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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)
 
 
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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)
 
 
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | 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'
  |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  |