POV-Ray : Newsgroups : povray.binaries.images : Snow-on-Tree Macro Server Time
17 Nov 2024 23:15:43 EST (-0500)
  Snow-on-Tree Macro (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Tim Nikias
Subject: Snow-on-Tree Macro
Date: 9 Dec 2004 14:15:51
Message: <41b8a467@news.povray.org>
So, for those interested: I'm currently working on a set of macros to drop
snow onto objects, see my thread in p.b.g "Ingenious snow placement?".

The input to actually save parsing time when competing against the brute
force method (just dropping buckets of particles onto the object) is the
topview image. It can be generated with a simple script which measures the
boundary-box using min- and max_extent and matches an orthographic camera to
look at the object. The object has to be white, the background black.

Once this image is generated, the macro will subdivide the image with a
regular grid into cells. Each cell's edges are checked if they intersect the
white of the image (this is cleverly done using trace() and a heightfield)
or, if that fails, if the entire cell is actually inside the object's
topview (by checking if the center is inside). Of course, small objects
might get lost, but the macros are designed for a single object with a
rather proper boundary-box, and that "getting-lost" issue is always the case
for discrete sampling...

Once the cells are determined full or empty, full cells will receive the
brute force method and get one bucket of trace(). The empty cells don't get
buckets, and thus, I save lots of parsing time! Additionally, particles will
drop straight through the object and will also hit surfaces underneath the
first surface, but it checks if the normal is actually pointing towards the
sky, to see if I've just hit the bottom of a surface.

And the small overhead due to the pretesting phase is worth it! The macro
ran on the tree in the image below (using the topview also supplied, but
with 1000x1000 dimensions for better accuracy) in 53 seconds. It generated
53.000 cells and discarded 42.000 empty cells (that's 80% of the volume!)
and dropped 80 particles in each active cells. I got 40.000 surface hits
that way, which are displayed in the 3D-Image of the tree.

Now I need to write macros to add further detail, like accumulation of snow
at walls and in edges and such. Also, the described technique above is only
meant to be used to generate an initial, crude set of positions, which I can
use as starting points for more detailed traces.

Comments and suggestions welcome (though I don't expect many, after all, I'm
just presenting some simple algorithm :-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message


Attachments:
Download 'tree_top.jpg' (21 KB) Download 'tree_snow.jpg' (34 KB)

Preview of image 'tree_top.jpg'
tree_top.jpg

Preview of image 'tree_snow.jpg'
tree_snow.jpg


 

From: Tim Nikias
Subject: Better view on the tree
Date: 9 Dec 2004 14:18:26
Message: <41b8a502@news.povray.org>
I've forgotten to add the tree itself in the last image, it's kinda hard to
see that the particles are really *on* the surface without it...

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message


Attachments:
Download 'tree_snow2.jpg' (115 KB)

Preview of image 'tree_snow2.jpg'
tree_snow2.jpg


 

From: Mike Thorn
Subject: Re: Better view on the tree
Date: 9 Dec 2004 14:27:46
Message: <41b8a732$1@news.povray.org>
Tim Nikias wrote:
> I've forgotten to add the tree itself in the last image, it's kinda hard to
> see that the particles are really *on* the surface without it...

I'm the last person qualified to give advice on something this advanced, 
but something sticks out to me. The snow on the tree looks fantastic. It 
really looks like, well, snow! The thing is that even on the branches 
that are nearly vertical, there are snow particles. Since it's still 
green here (not that I'm complaining) I can't verify this for myself, 
but it seems to me like only really wet snow will stick at that angle. 
Maybe you need to incorporate some Teflon into your macro? :)

This was especially evident on the trunk. Generally there would be a 
little bit of wind (snow very rarely falls straight down - maybe you 
should change the angle you shoot trace() from, if that's possible?), so 
snow would stick more evenly on one side and very little at all on the 
other side.

The more I look at these WIP renders the more I think this should be a 
POVCOMP entry... :)

~Mike


Post a reply to this message

From: Tim Nikias
Subject: Re: Better view on the tree
Date: 9 Dec 2004 14:42:17
Message: <41b8aa99$1@news.povray.org>
SNIP
> The thing is that even on the branches
> that are nearly vertical, there are snow particles. Since it's still
> green here (not that I'm complaining) I can't verify this for myself,
> but it seems to me like only really wet snow will stick at that angle.
> Maybe you need to incorporate some Teflon into your macro? :)

Like I said, there was no discarding of the samples yet, this will be done
with other macros. So as long as the surface doesn't actually point
downwards, particles will stick. "Teflon" will be implemented in successive
macros to be run over the collected data.

> This was especially evident on the trunk. Generally there would be a
> little bit of wind (snow very rarely falls straight down - maybe you
> should change the angle you shoot trace() from, if that's possible?), so
> snow would stick more evenly on one side and very little at all on the
> other side.

It was shot in -y-direction, as that is the topview. I've already been
thinking about how to add a different vector, but this should be implemented
for the topview-macro as well, and then things get difficult successively
for the calculation of the grid etc. But it is on my to-do list.

> The more I look at these WIP renders the more I think this should be a
> POVCOMP entry... :)

I'd have to read the rules first to find out if it is okay to make use of
Arbaro for the tree, and then I'd have to ask permission of the person I'm
making this image for. It'll be a christmas present and images that I've
made as a gift are meant to stay unique prints. Putting it on a Poster would
make it famous, but then again, lots of people would have it hanging in
their room (wishful thinking?), and that's like everyone owning a Mona
Lisa... But I'll give it a thought. :-)

Thanks for the positive feedback, BTW.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Tim Nikias
Subject: Re: Better view on the tree
Date: 9 Dec 2004 18:16:52
Message: <41b8dce4@news.povray.org>
> This was especially evident on the trunk. Generally there would be a
> little bit of wind (snow very rarely falls straight down - maybe you
> should change the angle you shoot trace() from, if that's possible?), so
> snow would stick more evenly on one side and very little at all on the
> other side.

Here we go. Five hours of fiddling around with vector arithmetics, I finally
ended up with this and then soon noticed, that I could have gotten it
earlier if I hadn't been to focussed on a certain approach... Ah, well. At
least it's done.

Now, you can pick a direction at which you want to drop the snow (and create
the orthographic view with). The image was created by dropping snow from
above and right (-x-y is the direction then: left and down). Used some
higher settings than in the last one to see if the branches' tips get
properly mapped, and as far as I can tell, they do (mathematically, they
should, anyways). 3m20seconds to create 68.000 surface points.

Teflon was still not invented... ;-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message


Attachments:
Download 'tree_snow3.jpg' (116 KB)

Preview of image 'tree_snow3.jpg'
tree_snow3.jpg


 

From: stm31415
Subject: Re: Better view on the tree
Date: 9 Dec 2004 18:45:01
Message: <web.41b8e29084f688771252f280@news.povray.org>
Very cool (cold?) I would suggest a multiple-run senario,  initialy straight
down, then with a lighter snow in several directions (wind swirlies). This
would get rid of the snow exclusively covering one side of the tree,
letting you give a light dusting on the side(s) you want the wind to blow.

Looking good.

-S
5TF!


Post a reply to this message

From: Ross
Subject: Re: Better view on the tree
Date: 10 Dec 2004 10:11:41
Message: <41b9bcad@news.povray.org>
looking good Tim. very good.


Post a reply to this message

From: Tim Nikias
Subject: Re: Better view on the tree
Date: 10 Dec 2004 12:20:06
Message: <41b9dac6@news.povray.org>
> looking good Tim. very good.

Thank you. I hope to have a few more basic macros up and running soon, so
that I can release the code to the public (like I do with all major
scripts...).

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Tim Nikias
Subject: Re: Better view on the tree
Date: 10 Dec 2004 12:22:29
Message: <41b9db55@news.povray.org>
> Very cool (cold?) I would suggest a multiple-run senario,  initialy
straight
> down, then with a lighter snow in several directions (wind swirlies). This
> would get rid of the snow exclusively covering one side of the tree,
> letting you give a light dusting on the side(s) you want the wind to blow.

I'm not sure I understand what you mean. Should I just layer several layers
of snow on top of each other, but from various directions?

That aside, my idea was that the current macro just produces *all* points on
a surface pointing towards a certain direction, removing some points and
adding details - like places where snow accumulates and grows to small piles
against walls and such - is planned to be implemented with macros which
build upon the gathered surface-data.

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: stm31415
Subject: Re: Better view on the tree
Date: 10 Dec 2004 17:15:00
Message: <web.41ba1f6884f68877df706a580@news.povray.org>
"Tim Nikias" <JUSTTHELOWERCASE:timISNOTnikias(at)gmx.netWARE> wrote:

> I'm not sure I understand what you mean. Should I just layer several layers
> of snow on top of each other, but from various directions?
>
That is what I meant. i.e a LOT of points from the top, a bunch from the
main wind direction, and a few from a third direction, jut to get a little
variagation rather than solid snow on one side and none on the other. BUT--
> That aside, my idea was that the current macro just produces *all* points on
> a surface pointing towards a certain direction, removing some points and
> adding details - like places where snow accumulates and grows to small piles
> against walls and such - is planned to be implemented with macros which
> build upon the gathered surface-data.
>

This would, obviously, be even better. I was just trying to thing of a quick
way to make it a little less harsh/sharply one sided.

Awesome, though. This two-pass method ought to work with a lot of different
applications.

-s
5TF!


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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