POV-Ray : Newsgroups : povray.binaries.images : Funky Granules Server Time
5 Nov 2024 22:22:42 EST (-0500)
  Funky Granules (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Loki
Subject: Funky Granules
Date: 14 Apr 2006 06:10:01
Message: <web.443f748e848f4a273d13d5660@news.povray.org>
Hi all,

Just a pic demonstrating a macro I knocked up this morning.  It takes any
object that has a defined interior and finite bounding box and
'granularizes' it into blocks of a user defined resolution.  This example,
in keeping with the RSOCP kind of idea, was a granular version of a simple
difference of two spheres.

If anyone is interested in the code I can post it, though in its present
form it is pretty rough and ready.  It does what I needed it to, but if
anyone want to inprove on it feel free.

(BTW, I should apologise to Slime, if he still posts on here, for abandoning
our POV-pong match ages ago - things got very busy for me very quickly and
I've been away from POV for a while.)

L
-


Post a reply to this message


Attachments:
Download 'granule.jpg' (152 KB)

Preview of image 'granule.jpg'
granule.jpg


 

From: Bob H
Subject: Re: Funky Granules
Date: 14 Apr 2006 07:18:31
Message: <443f8507$1@news.povray.org>
Not sure how you could have done this, it's a fascinating thing. I'd think 
it were done in a non-SDL way if you hadn't said "macro".


Post a reply to this message

From: Tim Cook
Subject: Re: Funky Granules
Date: 14 Apr 2006 09:31:24
Message: <443fa42c$1@news.povray.org>
mmmm, Lego-sculpturizer

it work with meshes?

-- 
Tim Cook
http://home.bellsouth.net/p/PWP-empyrean

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

From: Loki
Subject: Re: Funky Granules
Date: 14 Apr 2006 10:55:00
Message: <web.443fb66aa9f0c1853e48c3860@news.povray.org>
Haven't tested it with meshes but I don't expect it would work in all cases
as it requires the use of an inside(obj,vect) test.  I think the POV docs
state that meshes can have an inside if they form a closed shape and you
specify the inside_vector, but I rarely use meshes where I can get away
with SDL, CSG or macros so haven't tried it out.

It basically works by sampling points within the bounding box of an object
with a user-set resolution, testing whether each point is inside the
object, and creating a union of cubes for the inside points.  The same
method can be used with a merge instead of a union if you want to create a
well-behaved transparent version of the same.  Render times are OK, as it's
just a collection of simple primitives, but for high resolution sampling the
parse time (and probably memory usage) can skyrocket.

As I mentioned the method is a but clunky and can no doubt be improved, but
it achieved what I wanted it to so I'm not going to pursue it any further.

Here's the SDL, since it sounds like a couple of people are interested:


#macro GRANULE(GrObj,Res,Text)
  #local MinExt = 0;
  #local MaxExt = 0;
  Extents(GrObj,MinExt,MaxExt)
  #local MinCxLim = Res*floor((MinExt.x)/Res);
  #local MinCyLim = Res*floor((MinExt.y)/Res);
  #local MinCzLim = Res*floor((MinExt.z)/Res);
  #local MaxCxLim = Res*ceil((MaxExt.x)/Res);
  #local MaxCyLim = Res*ceil((MaxExt.y)/Res);
  #local MaxCzLim = Res*ceil((MaxExt.z)/Res);
  #local Cz = MinCxLim;
  union {
  #while ( Cz < MaxCzLim )
    #local Cy = MinCxLim;
    #while ( Cy < MaxCyLim )
      #local Cx = MinCxLim;
      #while ( Cx < MaxCxLim )
        #if ( inside(GrObj,<Cx+(Res/2),Cy+(Res/2),Cz+(Res/2)>) )
        object {
          box {
            <Cx,Cy,Cz>-(Res/100),<Cx,Cy,Cz>+(Res*1.01)
          }
        }
        #end
        #local Cx = Cx + Res;
      #end
      #local Cy = Cy + Res;
    #end
    #local Cz = Cz + Res;
  #end
    texture {
      Text
    }
  }
#end


Call it by using
GRANULE(Object,Resolution,Texture)

where Object and Texture are previously declared, and Resolution is a float
indicating the size of each cube.

L
-


Post a reply to this message

From: kurtz le pirate
Subject: Re: Funky Granules - granules.jpg (1/1)
Date: 14 Apr 2006 13:51:52
Message: <kurtzlepirate-EE6B85.19514814042006@news.povray.org>
In article <web.443fb66aa9f0c1853e48c3860@news.povray.org>,
 "Loki" <nomail@nomail> wrote:

> ...
> Here's the SDL, since it sounds like a couple of people are interested:
> ...


yes, a funny macro... and so simple ! great work loki ;)



-- 
klp


Post a reply to this message


Attachments:
Download 'granules.jpg' (52 KB)

Preview of image 'granules.jpg'
granules.jpg


 

From: Mike Kost
Subject: Re: Funky Granules
Date: 14 Apr 2006 16:20:36
Message: <44400413@news.povray.org>
Tim Cook wrote:
> mmmm, Lego-sculpturizer
> 
> it work with meshes?
> 

Why not take it all the way to it's silly conclusion...

Thanks for posting the SDL, Loki!

Mike
--
http://povray.tashcorp.net


Post a reply to this message


Attachments:
Download 'legos.png' (80 KB)

Preview of image 'legos.png'
legos.png


 

From: DJ Wiza
Subject: Re: Funky Granules
Date: 15 Apr 2006 03:54:33
Message: <4440a6b9@news.povray.org>
Awhile ago, I made a macro similar to this one, but it was based on a 
function.  It was more similar to an isosurface that approximated it 
with cubes.

I wonder what kind of result I could get if I used a blob with spheres...

-DJ

Loki wrote:
> Haven't tested it with meshes but I don't expect it would work in all cases
> as it requires the use of an inside(obj,vect) test.  I think the POV docs
> state that meshes can have an inside if they form a closed shape and you
> specify the inside_vector, but I rarely use meshes where I can get away
> with SDL, CSG or macros so haven't tried it out.
> 
> It basically works by sampling points within the bounding box of an object
> with a user-set resolution, testing whether each point is inside the
> object, and creating a union of cubes for the inside points.  The same
> method can be used with a merge instead of a union if you want to create a
> well-behaved transparent version of the same.  Render times are OK, as it's
> just a collection of simple primitives, but for high resolution sampling the
> parse time (and probably memory usage) can skyrocket.
> 
> As I mentioned the method is a but clunky and can no doubt be improved, but
> it achieved what I wanted it to so I'm not going to pursue it any further.
> 
> Here's the SDL, since it sounds like a couple of people are interested:
> 
> 
> #macro GRANULE(GrObj,Res,Text)
>   #local MinExt = 0;
>   #local MaxExt = 0;
>   Extents(GrObj,MinExt,MaxExt)
>   #local MinCxLim = Res*floor((MinExt.x)/Res);
>   #local MinCyLim = Res*floor((MinExt.y)/Res);
>   #local MinCzLim = Res*floor((MinExt.z)/Res);
>   #local MaxCxLim = Res*ceil((MaxExt.x)/Res);
>   #local MaxCyLim = Res*ceil((MaxExt.y)/Res);
>   #local MaxCzLim = Res*ceil((MaxExt.z)/Res);
>   #local Cz = MinCxLim;
>   union {
>   #while ( Cz < MaxCzLim )
>     #local Cy = MinCxLim;
>     #while ( Cy < MaxCyLim )
>       #local Cx = MinCxLim;
>       #while ( Cx < MaxCxLim )
>         #if ( inside(GrObj,<Cx+(Res/2),Cy+(Res/2),Cz+(Res/2)>) )
>         object {
>           box {
>             <Cx,Cy,Cz>-(Res/100),<Cx,Cy,Cz>+(Res*1.01)
>           }
>         }
>         #end
>         #local Cx = Cx + Res;
>       #end
>       #local Cy = Cy + Res;
>     #end
>     #local Cz = Cz + Res;
>   #end
>     texture {
>       Text
>     }
>   }
> #end
> 
> 
> Call it by using
> GRANULE(Object,Resolution,Texture)
> 
> where Object and Texture are previously declared, and Resolution is a float
> indicating the size of each cube.
> 
> L
> -
> 
>


Post a reply to this message

From: Tim Nikias
Subject: Re: Funky Granules
Date: 15 Apr 2006 07:46:15
Message: <4440dd07@news.povray.org>
> Haven't tested it with meshes but I don't expect it would work in all
cases
> as it requires the use of an inside(obj,vect) test.  I think the POV docs
> state that meshes can have an inside if they form a closed shape and you
> specify the inside_vector, but I rarely use meshes where I can get away
> with SDL, CSG or macros so haven't tried it out.

Just a note for those interested in using this on meshes:
If you've got a well-defined mesh, with which I mean it has no coincident
surfaces and no holes (which is also known as waterproof), you'd just need a
macro which'll shoot a ray in some random direction. When it hits a surface
of the mesh, continue from there and count how many times you hit a surface
on a mesh whilst travelling along the ray to the outside of the mesh. If the
resulting number is uneven, the original starting point is inside the mesh,
otherwise it's outside.
This even works for multiple mesh objects that intersect, but like I said,
no coincident surfaces and the meshes all have to be completely closed for
the counting to work properly.

I've done this for various things, especially my Liquid Surface Simulation
Macros to get the water to properly interact with meshes.

Regards,
Tim

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


Post a reply to this message

From: Bob H
Subject: Re: Funky Granules
Date: 15 Apr 2006 09:32:11
Message: <4440f5db@news.povray.org>
Ah yes, LEGO blocks. Makes perfect sense to be used like that.

BTW, if anyone else is wondering, be sure to #include "shapes.inc" for 
Extents() to work in that macro. Another thanks to Loki for sharing this.

And here's the logo put into the logo.


Post a reply to this message


Attachments:
Download 'povlogospovlogo.jpg' (32 KB)

Preview of image 'povlogospovlogo.jpg'
povlogospovlogo.jpg


 

From: Anthony D'Agostino
Subject: Re: Funky Granules
Date: 15 Apr 2006 15:42:12
Message: <44414c94$1@news.povray.org>
Thanks for posting the macro. Nice render! What kind of light setup did you
use? GI, HDRI, or area light?


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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