POV-Ray : Newsgroups : povray.binaries.images : Localized damage to planes and edges Server Time
14 Nov 2024 12:24:04 EST (-0500)
  Localized damage to planes and edges (Message 1 to 7 of 7)  
From: Eriban
Subject: Localized damage to planes and edges
Date: 7 Jun 2009 08:25:01
Message: <web.4a2bb1616a2f4ef881475b100@news.povray.org>
Hi all,

For adding some damage to my WIP "Rock the Boat" I have been working on same
macros to create localized damage to planes and edges of box-shaped objects. A
marco for corners is still to follow.

The approach I have taken is as follows. Damage is specified by an object, to be
subtracted from the plane or edge. The damage macros then approximate this
damage by a mesh, also adding some extra erosion. The purpose of both the
mesh-approximation and additional erosion are to more smoothly integrate the
damage into the object. The mesh is closed so that it can be used for CSG.

The approach is illustrated in the attached image. From left to right:
1) The basic damage, when directly applied using CSG. On its own it is obviously
not very realistic.
2) The basic damage mesh, when flat triangles are used to show the mesh
structure.
3) The damage mesh when smooth triangles are used.
4) The end result, when a granite normal is used to further simulate damage.

Shown in red are the damage mesh objects generated by the macros, which have
been used to create the damage that is shown.

The DamagedEdge macro has support for rounded edges, which helps to smoothen the
transition from the damaged area to the undamaged rounded edge.

Creating these macros has been an interesting learning excercise for me, as I
had not created mesh2 objects before, nor used the trace function. I am also
hopeful that I can use the macros to good effect on my "Rock The Boat" scene.
However, I do have a few questions, which some of you may be able to answer.

Is the overall approach sensible, or could the same results have been obtained
in an easier way? The macros currently are about six hundred lines in total.

Do similar are better macros exist already? I am aware of Bill Pragnell's
meshrelief macros, which is an elegant and generic approach, but unfortunately,
did not seem appropriate for my current needs.

Is there a good way to more adaptively create the mesh? I am currently using a
hexagonal mesh pattern. The sample points have a bit of noise added, to break
up some of the regularity, but sampling is otherwise independent of the damage
object. The hexagonal pattern is still visible in some places, in particular at
the edges of the damage. Better results could be achieved when the samples are
taken adaptively, with a higher density of triangles where this is needed.
Implementing this would, however, not be straightforward. It would also be
nicer if it could be handled more generically. A simpler approach would be to
let the macros create a very high density mesh, and pass this mesh through a
mesh-optimisation tool that merges nearby mesh triangles that are very similar
in orientation. This should also result in a mesh-structure with an adaptive
density. Does such a tool exist, in particular one that's compatible with a
mesh format supported by POV-Ray?

Any other suggestions for improvement, thoughts, or comments?

Cheers,

Erwin


Post a reply to this message


Attachments:
Download 'damagestepbystep.png' (207 KB)

Preview of image 'damagestepbystep.png'
damagestepbystep.png


 

From: Bill Pragnell
Subject: Re: Localized damage to planes and edges
Date: 7 Jun 2009 09:50:01
Message: <web.4a2bc4bd4da08f7069f956610@news.povray.org>
This is looking good so far. Do your macros find edges/corners automatically, or
does the user place the cutting shape manually?

Your thoughts on mesh generation echo my own, when I wrote the meshrelief
macros. In particular, the idea of adaptive mesh resolution, which, as you say,
is important for high-resolution damage without great memory expense. This is
something I too wish to improve, although I don't currently have the time to
devote (sometime soon, I hope!).

My macros can save high-res meshes as .inc files to cut down repeated parse
times, and I believe that PoseRay (http://mysite.verizon.net/sfg0000/) can
import mesh2 objects, although I haven't tried it yet. This could be a
profitable line of enquiry for optimisation.

Bill


Post a reply to this message

From: clipka
Subject: Re: Localized damage to planes and edges
Date: 7 Jun 2009 10:00:01
Message: <web.4a2bc7824da08f706a18a93d0@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> My macros can save high-res meshes as .inc files to cut down repeated parse
> times, and I believe that PoseRay (http://mysite.verizon.net/sfg0000/) can
> import mesh2 objects, although I haven't tried it yet.

I did try, and yes, it can. (Provided it's straightforward mesh2 code without
any macro stuff or variables inside, I bet.)


Post a reply to this message

From: Thomas de Groot
Subject: Re: Localized damage to planes and edges
Date: 7 Jun 2009 10:01:07
Message: <4a2bc823@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> schreef in bericht 
news:web.4a2bc4bd4da08f7069f956610@news.povray.org...
[...]  and I believe that PoseRay (http://mysite.verizon.net/sfg0000/) can
> import mesh2 objects, although I haven't tried it yet. This could be a
> profitable line of enquiry for optimisation.

Yes, it can indeed, works very well.

Thomas


Post a reply to this message

From: Eriban
Subject: Re: Localized damage to planes and edges
Date: 7 Jun 2009 15:55:00
Message: <web.4a2c1afa4da08f7081475b100@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> This is looking good so far.

Thanks.

> Do your macros find edges/corners automatically, or
> does the user place the cutting shape manually?

The user has to manually place the cutting shape. The assumed placement and
orientation of the plane/edge to be damaged by the macro is fixed. If I find a
nice way to improve the user-friendlyness, I may do so eventually, but I am
currently focussing my attention on improving the results of the macro.

> My macros can save high-res meshes as .inc files to cut down repeated parse
> times, and I believe that PoseRay (http://mysite.verizon.net/sfg0000/) can
> import mesh2 objects, although I haven't tried it yet. This could be a
> profitable line of enquiry for optimisation.

Yes, looking at PoseRay's feature list suggests that it supports adaptive
merging of neighbouring triangles to reduce the size of meshes. Unfortunately,
I am only running OS X at home, which isn't supported, so I cannot try it out
myself. Maybe similar functionality is provided by a simpler command-line tool
that's cross-platform though. I will see if I can find anything once I finished
my macros. I still need to write the one for corners after all. Furthermore, I
am still improving the plane and edge damage macro.

Cheers,
Erwin


Post a reply to this message

From: Eriban
Subject: Re: Localized damage to planes and edges
Date: 7 Jun 2009 17:45:00
Message: <web.4a2c34764da08f7081475b100@news.povray.org>
When I increased the number of triangles in the mesh (to see to what extend this
improved the visual appearance) some sampling artifacts showed up. In response
to that I improved the samping method that is used to calculate the erosion,
and also improved the calculation of the normal vectors for the points that had
erosion applied to them (only for the DamagedPlane macro; I have yet to adapt
the DamagedEdge macro). Attached is an image showing the improved results. It's
definitely looking better now. :-)

Erwin


Post a reply to this message


Attachments:
Download 'damagestepbystep2.png' (206 KB)

Preview of image 'damagestepbystep2.png'
damagestepbystep2.png


 

From: Eriban
Subject: Re: Localized damage to planes and edges
Date: 14 Jun 2009 17:35:01
Message: <web.4a356bf44da08f7081475b100@news.povray.org>
Hi all,

FYI, I have now also completed my macro for damaging corners, and refactored the
plane and edge damage macros while doing so. Attached is an imaging showing the
results. The red objects are the mesh objects generated by the macros, and the
rounded box shows the result after CSG. The meshes each consist of a medium
number of triangles; the results can be improved by using more triangles of
course. The stats for the meshes in the image are:

  DamagedPlane: vertices traced/fixed = 451/84, triangles smooth/flat = 820/162
  DamagedEdge: vertices traced/fixed = 329/70, triangles smooth/flat = 588/140
  DamagedCorner: vertices traced/fixed = 513/77, triangles smooth/flat = 950/158

The macros are surprisingly lengthy; in total they span more than 1300 lines. I
plan to add them to the POV collection eventually, after adding some
documentation and examples. However, I first want to get back to my scene for
which I created these. This macro-creating detour took a bit longer than
initially anticipated.

Erwin


Post a reply to this message


Attachments:
Download 'damage.png' (175 KB)

Preview of image 'damage.png'
damage.png


 

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