POV-Ray : Newsgroups : povray.binaries.images : using 'object pattern' as media Server Time
15 Aug 2022 12:01:32 EDT (-0400)
  using 'object pattern' as media (Message 1 to 10 of 23)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Kenneth
Subject: using 'object pattern' as media
Date: 28 Apr 2022 17:35:00
Message: <web.626b05efc2e3b4cf8d86850a6e066e29@news.povray.org>
POV-ray's 'object pattern' is a really useful feature-- but the single 'pigment'
example in the docs does not do it justice, IMO. It can instead be used as
density for media, which is not mentioned there. Searching through newsgroup
posts from the past, I could not find a reference to such a use. For months, I
have been experimenting and testing this 'discovery'.

The object pattern is fully volumetric. Give it an object-- just about any kind
of object or CSG construction -- and it creates a 3-D pattern of the shape's
overall surface, which can then be manipulated like any other pattern (using
warp{...} for example). For mesh and mesh2 objects, the model requires an
inside_vector for the media to show up. Unfortunately, bicubic_patch objects
either don't work or don't show the media.

The really neat thing about this technique is that the media is no longer
confined 'within' the model, but can occupy the area outside it (as large as the
overall required media container shape.) The object pattern is placed inside the
container.

Once I started playing around with this, my first thought was using it for
clouds that look like objects. It has many more interesting media uses as well--
and different methods of setting-up the code when pigments{...} or image_maps
are used for the volumetric density-- but here is a basic cloud example using a
single scattering media. For the object, I used James Holsenback's Stanford
Bunny mesh2 model from October 2014, then heavily warped the resulting pattern
and media. The background is a simple image_map, and I adjusted the lights'
colors on the media to try and match the look.

The only drawback with this particular example was the *long* render time, even
on my Core I7 8 core/16 thread machine: These 640X480 renders took an average of
20 minutes each (without AA or radiosity!), possibly due to the model being a
triangle mesh, and the use of two light_sources. Media's samples value was 109.

(I had intended to run a 200-frame animation of this 'Bunny cloud' at 800X600,
to show the increase of the warping-- but I calculated that it would take about
85 hours to render!)


Post a reply to this message


Attachments:
Download 'object_pattern_as_media_1.jpg' (117 KB)

Preview of image 'object_pattern_as_media_1.jpg'
object_pattern_as_media_1.jpg


 

From: Thomas de Groot
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 02:41:32
Message: <626b889c$1@news.povray.org>
Oooh!  LOL!

This is brilliant! Well done Kenneth.

-- 
Thomas


Post a reply to this message

From: s day
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 06:20:00
Message: <web.626bbab0ac9c0ae1ca4c22fb6a8f0b95@news.povray.org>
This is a neat idea, I assume this could be used to control how media is shaped
for many purposes (thinking of the struggles I have had with media in the past).

I still have some unfinished Pov business if I ever have time to get back to it.
A few scenes I wanted to do with my steam train model that needed media and I
never got around to.

Sean


Post a reply to this message

From: Alain Martel
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 09:50:43
Message: <626bed33$1@news.povray.org>
Le 2022-04-28 à 17:29, Kenneth a écrit :

> warp{...} for example). For mesh and mesh2 objects, the model requires an
> inside_vector for the media to show up. Unfortunately, bicubic_patch objects
> either don't work or don't show the media.
> 

There is a simple explanation for the bicubic_patch : That object only 
have a surface, it have zero thickness.
The same will happen with the triangle primitive.

Even if you have an union of them forming a completely closed shape, 
they'll never have an interior.

What would be required is the possibility to integrate bicubic_patch in 
a mesh.


Post a reply to this message

From: Kenneth
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 12:35:00
Message: <web.626c0f28ac9c0ae18d86850a6e066e29@news.povray.org>
Here is another example, using a different and more complex set-up of the code--
with 'solid' high-density emission + absorption medias rather than scattering.

This one uses the object pattern as a 'pigment' (not a density)-- with some
'Bunny artwork' as the main pigment there. Some image-to-functions-to-pigment
operations were required for its final use in the media, mainly because I used
the 'once' keyword for the artwork image_map.

For the art, I found a photo on Google that looked *somewhat* like the pose of
the Stanford Bunny, then used my paint.net app to clone and shift various parts
around so that the image covered the model as projected from the front. Even
though the art is just a 2-D image_map, it projects through the entire media, so
its colors are 'in depth' throughout the Bunny. Then I added a fake shadow under
the model :-)

BTW, the Stanford Bunny mesh2 model is not quite a closed mesh-- it has some
holes on its bottom surface-- so I simply made an intersection of it with a
larger and well-placed box object, which solidified those holes. Interestingly,
this also eliminated the need for the model to have an inside_vector (for the
media appearance.)

I made several animations of this example which I will post at
binaries.animation; they rendered *much* faster than my aborted scattering-media
version, in about 1/10 the time (but with no lighting interaction of course).


Post a reply to this message


Attachments:
Download 'object_pattern_as_media_2.jpg' (372 KB)

Preview of image 'object_pattern_as_media_2.jpg'
object_pattern_as_media_2.jpg


 

From: Kenneth
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 13:20:00
Message: <web.626c1e10ac9c0ae18d86850a6e066e29@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Oooh!  LOL!
>
> This is brilliant! Well done Kenneth.
>

Thanks Thomas! I know that you like using media ;-)

I plan to post the basic code for these examples, once I clean all of it up. (I
currently have four huge scene files full of comments and aborted trial code,
from the many tests and experiments I have made.)


Post a reply to this message

From: Kenneth
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 13:55:00
Message: <web.626c2555ac9c0ae18d86850a6e066e29@news.povray.org>
Alain Martel <kua### [at] videotronca> wrote:
>
> There is a simple explanation for the bicubic_patch : That object only
> have a surface, it have zero thickness.
> The same will happen with the triangle primitive.
>
> Even if you have an union of them forming a completely closed shape,
> they'll never have an interior.
>

While testing a bicubic_patch model vs. the mesh2 Bunny, the first problem that
occurred was that the bicubic_patch version could not accept an inside_vector
(which the mesh2 can, and is required for the media to appear.) I initially
thought that was the primary reason for the patch model not showing up. So I
tried the trick of making an intersection of it with a box, to somehow
'solidify' it; but that did not work either.

My understanding of mesh/mesh2 objects and bicubic_patch objects is that they
are *both* just zero-thickness 'shells' -- so I still don't quite understand why
one works as an object pattern, while the other does not. I still have the
thought that it is due to a missing inside_vector(?). OR, the problem could be
due to the particular bicubic model I used. It is just a union of patches, but
is not a completely 'closed' one. (I made that model many years ago in an *old*
app called sPatch, and it renders OK as-is in POV-ray as a typical object... but
perhaps it has some kind of problem when I try to use it for the object
pattern.)

I should probably try a well-constructed bicubic_patch model from some other
source, to see if it works.


Post a reply to this message

From: Kenneth
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 14:15:00
Message: <web.626c2a0dac9c0ae18d86850a6e066e29@news.povray.org>
"s.day" <s.d### [at] uelacuk> wrote:
> This is a neat idea, I assume this could be used to control how media is shaped
> for many purposes (thinking of the struggles I have had with media in the past).
>

Yes! I have not yet tried using functions for the media distortion, but other
pigment-based patterns do work for that, with the appropriate color_maps or
pigment_maps.

The neat thing about media itself is that any colors or densities of exactly 0.0
(0/255) create holes in the media-- no density. Along with warps or other
distortions, some really interesting and odd 3-D media patterns and colors can
be produced this way... especially in what I call 'solid' media (very high
density.)


Post a reply to this message

From: Bald Eagle
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 19:50:00
Message: <web.626c7935ac9c0ae11f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> My understanding of mesh/mesh2 objects and bicubic_patch objects is that they
> are *both* just zero-thickness 'shells' -- so I still don't quite understand why
> one works as an object pattern, while the other does not. I still have the
> thought that it is due to a missing inside_vector(?). OR, the problem could be
> due to the particular bicubic model I used. It is just a union of patches, but
> is not a completely 'closed' one.

The issue isn't whether it's closed or not, it's what takes place under-the-hood
in POV-Ray.  Meshes are geared toward making "solid" objects by defining the
object's surface, and has the code to support such an extrapolation.  Bicubic
patches are only ever interpreted as surfaces, no matter what you do.

What you'll likely have to do is take the control points of your patches, and
run them through the Bernstein polynomial stuff that TOK, and later I did to get
the <x, y, z> of any point on the surface of the patch.

Then you can use the points and the normals, and make a mesh object.

I did that in the Bezier monograph.

I'll probably have to give you a zip of the scene and any includes, and then it
would have to be extended to create a mesh from multiple patches.


Post a reply to this message

From: Bald Eagle
Subject: Re: using 'object pattern' as media
Date: 29 Apr 2022 20:00:00
Message: <web.626c7bbaac9c0ae11f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:


> I'll probably have to give you a zip of the scene and any includes, and then it
> would have to be extended to create a mesh from multiple patches.

Have a look:


Post a reply to this message


Attachments:
Download 'beziertotriangles.zip' (6 KB)

Goto Latest 10 Messages Next 10 Messages >>>

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