POV-Ray : Newsgroups : povray.general : Density help Server Time
1 Nov 2024 09:22:52 EDT (-0400)
  Density help (Message 1 to 10 of 10)  
From: Florian Brucker
Subject: Density help
Date: 17 Nov 2004 15:01:35
Message: <419bae1f@news.povray.org>
Hi!

Can anybody give me some pointers on how to create a media density like 
the one you can see in http://tinyurl.com/4ddjl (the two spheres at the 
right side). I tried it using a spherical warp on a scaled leopard 
pattern and using actual cones, but none look good.


Thanks a lot!
Florian
-- 
camera{look_at-y*10location<8,-3,-8>*10}#local a=0;#while(a<999)sphere{
#local _=.01*a-4.99;#local p=a*.01-5;#local c=.01*a-4.995;<sin(p*pi)*5p
*10pow(p,5)*.01>sin(c*c*c*.1)+1pigment{rgb 3}}#local a=a+1;#end
/******** http://www.torfbold.com ******** http://www.imp.org ********/


Post a reply to this message

From: Slime
Subject: Re: Density help
Date: 17 Nov 2004 15:14:58
Message: <419bb142$1@news.povray.org>
> Can anybody give me some pointers on how to create a media density like
> the one you can see in http://tinyurl.com/4ddjl (the two spheres at the
> right side). I tried it using a spherical warp on a scaled leopard
> pattern and using actual cones, but none look good.

Looks like it's the noise function sampled along the surface of a sphere:

#include "functions.inc"

// separate function used to avoid recalculating dist multiple times
#declare noisefunc = function(x,y,z,dist) {f_noise3d(x/dist,y/dist,z/dist)}

density {
function {noisefunc(x,y,z,sqrt(x*x+y*y+z*z))}
// you may want to add a color map too, or maybe not:
color_map {
[.4 rgb 0]
[.6 rgb 1]
}
}

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Florian Brucker
Subject: Re: Density help
Date: 17 Nov 2004 15:54:39
Message: <419bba8f$1@news.povray.org>
> Looks like it's the noise function sampled along the surface 
 > of a sphere:

Nice. Fast. Beautiful.

Great job! Not that I really understand it, though.

	noisefunc(x,y,z,sqrt(x*x+y*y+z*z)

The sqrt() part is the distance to the origin.

	f_noise3d(x/dist,y/dist,z/dist)

And now you use the noise3d result of the current point, scaled with the 
inverse of that distance? Could you give some more explanation on how 
this works? All this function stuff is pretty new to me :)


Thanks!
Florian
-- 
camera{look_at-y*10location<8,-3,-8>*10}#local a=0;#while(a<999)sphere{
#local _=.01*a-4.99;#local p=a*.01-5;#local c=.01*a-4.995;<sin(p*pi)*5p
*10pow(p,5)*.01>sin(c*c*c*.1)+1pigment{rgb 3}}#local a=a+1;#end
/******** http://www.torfbold.com ******** http://www.imp.org ********/


Post a reply to this message

From: Slime
Subject: Re: Density help
Date: 17 Nov 2004 16:09:01
Message: <419bbded$1@news.povray.org>
> noisefunc(x,y,z,sqrt(x*x+y*y+z*z)
>
> The sqrt() part is the distance to the origin.

Right.

> And now you use the noise3d result of the current point, scaled with the
> inverse of that distance? Could you give some more explanation on how
> this works? All this function stuff is pretty new to me :)

Well, when you divide each component (x,y,z) of a vector by the size of that
vector, you get the normalized vector: that is, a vector pointing the same
direction away from the origin, but of length 1. (The exception is when you
try to do this for (0,0,0), which causes a division by zero - this makes
sense because (0,0,0) doesn't really have a direction.) So the end result is
that we're sampling the noise function on a sphere of radius 1. Another way
to think about it is that when you divide out the distance from the origin,
the distance is no longer a factor in where you're sampling the pattern:
only the direction is a factor. This causes directional rays of light which
don't vary according to distance.

If you want a busier pattern, you should change

f_noise3d(x/dist,y/dist,z/dist)

to

f_noise3d(x/dist * scale,y/dist * scale,z/dist * scale)

where scale is the amount to make the pattern busier by. This essentially
increases the radius of the sphere that we're sampling on, so you get more
variation in the pattern.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Raiford
Subject: Re: Density help
Date: 17 Nov 2004 16:19:14
Message: <419bc052$1@news.povray.org>
Slime wrote:

> f_noise3d(x/dist,y/dist,z/dist)

Why not use vnormalize?



-- 
~Mike


Post a reply to this message

From: Slime
Subject: Re: Density help
Date: 17 Nov 2004 16:27:58
Message: <419bc25e$1@news.povray.org>
> Why not use vnormalize?

That's an SDL feature; functions don't work with vectors (to my knowledge,
with the exception of transformation functions) so you have to do vector
math manually.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Raiford
Subject: Re: Density help
Date: 17 Nov 2004 16:30:31
Message: <419bc2f7$1@news.povray.org>
Slime wrote:

>>Why not use vnormalize?
> 
> 
> That's an SDL feature; functions don't work with vectors (to my knowledge,
> with the exception of transformation functions) so you have to do vector
> math manually.

Good enough reason :)

-- 
~Mike


Post a reply to this message

From: Florian Brucker
Subject: Re: Density help
Date: 17 Nov 2004 16:41:57
Message: <419bc5a5$1@news.povray.org>
Ah, normalizing the vector, of course! Nice idea ;)


Thanks for the explanation!
Florian
-- 
camera{look_at-y*10location<8,-3,-8>*10}#local a=0;#while(a<999)sphere{
#local _=.01*a-4.99;#local p=a*.01-5;#local c=.01*a-4.995;<sin(p*pi)*5p
*10pow(p,5)*.01>sin(c*c*c*.1)+1pigment{rgb 3}}#local a=a+1;#end
/******** http://www.torfbold.com ******** http://www.imp.org ********/


Post a reply to this message

From: Mike Thorn
Subject: Re: Density help
Date: 17 Nov 2004 16:56:58
Message: <419bc92a$1@news.povray.org>
Slime wrote:
>>noisefunc(x,y,z,sqrt(x*x+y*y+z*z)
>>
>>The sqrt() part is the distance to the origin.
> 
> 
> Right.
> 
> 
>>And now you use the noise3d result of the current point, scaled with the
>>inverse of that distance? Could you give some more explanation on how
>>this works? All this function stuff is pretty new to me :)
> 
> 
> Well, when you divide each component (x,y,z) of a vector by the size of that
> vector, you get the normalized vector: that is, a vector pointing the same
> direction away from the origin, but of length 1. (The exception is when you
> try to do this for (0,0,0), which causes a division by zero - this makes
> sense because (0,0,0) doesn't really have a direction.) So the end result is
> that we're sampling the noise function on a sphere of radius 1. Another way
> to think about it is that when you divide out the distance from the origin,
> the distance is no longer a factor in where you're sampling the pattern:
> only the direction is a factor. This causes directional rays of light which
> don't vary according to distance.
> 
> If you want a busier pattern, you should change
> 
> f_noise3d(x/dist,y/dist,z/dist)
> 
> to
> 
> f_noise3d(x/dist * scale,y/dist * scale,z/dist * scale)
> 
> where scale is the amount to make the pattern busier by. This essentially
> increases the radius of the sphere that we're sampling on, so you get more
> variation in the pattern.

I'm totally lost, but that's to be expected. Math never was or will be 
my best subject.

Since Florian has it figured out now and we're on the topic of media 
density, can I ask a question? For a while now I've been wondering how 
one would create a plasma effect similar to this: 
http://van.hep.uiuc.edu/van/demos/Plasma%20Ball/PlasmaBall-small.jpp. 
How would any of you go about doing it?

~Mike


Post a reply to this message

From: Slime
Subject: Re: Density help
Date: 17 Nov 2004 17:04:36
Message: <419bcaf4$1@news.povray.org>
> Since Florian has it figured out now and we're on the topic of media
> density, can I ask a question? For a while now I've been wondering how
> one would create a plasma effect similar to this:
> http://van.hep.uiuc.edu/van/demos/Plasma%20Ball/PlasmaBall-small.jpp.
> How would any of you go about doing it?


That's not an easy one. I would probably separate it into three emission
medias, one for the purple strands, one for the red things on the outside,
and one for the red thing on the inside.

For the purple things, I might start with the trick I just explained, only
with maybe the leopard pattern or crackle form<1,0,0> with some sort of
color map to get thin things extending outwards. Then I'd add some
turbulence.

The red things would use the same pattern (to ensure that there's a red
thing at the end of each purple thing), with a different color map that both
changes the color and makes them bigger. I'd combine this with a spherical
density that had a color map to make sure I only got red on the outer edges
(and not mixed in with the purple stuff).

The inner red thing could possibly be done with just a simple spherical
pattern.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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