 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Slime <slm### [at] slimeland com> wrote:
> I always thought bi-cubic interpolation was really just bi-linear
> interpolation with the points interpolated between in a smoother manner.
AFAIK bicubic interpolation takes into account 16 pixels (instead of 4
like bilinear interpolation does). It probably works a bit like the
bicubic_patch surface.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Rohan Bernett" <rox### [at] yahoo com> wrote in message
news:web.3d7d48acdc16a7ab18ccf4f70@news.povray.org...
> http://astronomy.swin.edu.au/~pbourke/curves/
I think the interpolation method of that link is not appropriate
for images or multi-dimensional data. I implemented another
cubic interpolation method in my patch.
http://staff.aist.go.jp/r-suzuki/e/povray/iso/df_body.htm
The current version (V03) of my patch has both interpolation methods.
Try following code with different 'interpolate' number.
'interpolate 3' is the method of that link.
'interpolate 2' is the method I implemented for density data.
-----------------------------------------------
#version unofficial dfe 3.5;
#include "functions.inc"
camera { location <25, 20, -40.0> look_at <0,0,0> direction 45.*z}
light_source { <1,1.4,-1>*5 color rgb <1.4,1.2,1.0>*1.7 }
#declare Density_File=on;
#declare Make_Density_File=on;
#declare DATA3D1=function{
f_noise3d(x*8,y*8,z*8)/4+f_sphere(x-0.5,y-0.5,z-0.5,0)}
#declare DATA3D2= function{ pattern{
density_file
#if (Make_Density_File=on)
function 40,40,40 {DATA3D1(x,y,z)}
save_file "povdat1.df"
#else
df3 "povdat1.df"
#end
interpolate 2 // or 3
}
}
isosurface{
#if (Density_File=on)
function{ DATA3D2(x,y,z) }
#else
function{ DATA3D1(x,y,z) }
#end
contained_by{box{0.05,0.95}}
max_gradient 3
threshold 0.4
texture{ pigment{color rgb 0.7} finish{phong 0.30 phong_size 90} }
translate <-0.5,-0.5,-0.5>
}
-----------------------
R. Suzuki
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi,
Slime schrieb:
> Hmm, that picture *does* show cubic interpolation blurring the pixels
> together too much.
>
> I always thought bi-cubic interpolation was really just bi-linear
> interpolation with the points interpolated between in a smoother manner.
> Like, if you graphed a row of pixels interpolated with bi-linear
> interpolation, you'd have a bunch of points connected with straight lines,
> but if you graphed it with bi-cubic interpolation, you'd have a bunch of
> points connected with curves that match the curve
>
> y = -2*x^3 + 3*x^2 = x^2*(3-2*x)
I implemented cubic-interpolation for a perlin noise ... here is some code:
----+----+----+----+---- interpolatedNoise2d ----+----+----+----+----
int IntX = ( int )x;
int IntY = ( int )y;
double FractX = x - IntX;
double FractY = y - IntY;
// to store all the numbers
double cv0, cv1, cv2, cv3, cv4, cv5, cv6, cv7,
cv8, cv9, cv10, cv11, cv12, cv13, cv14, cv15;
double ci0, ci1, ci2, ci3;
int IntX1, IntY1, IntX2, IntY2, IntX3, IntY3, IntX4, IntY4;
// some variables....
IntX1 = IntX - 1;
IntX2 = IntX;
IntX3 = IntX + 1;
IntX4 = IntX + 2;
IntY1 = IntY - 1;
IntY2 = IntY;
IntY3 = IntY + 1;
IntY4 = IntY + 2;
// smoothedNoise2d( x, y ); returns a noise for these
// coordinates
cv0 = smoothedNoise2d( IntX1, IntY1 );
cv1 = smoothedNoise2d( IntX2, IntY1 );
cv2 = smoothedNoise2d( IntX3, IntY1 );
cv3 = smoothedNoise2d( IntX4, IntY1 );
cv4 = smoothedNoise2d( IntX1, IntY2 );
cv5 = smoothedNoise2d( IntX2, IntY2 );
cv6 = smoothedNoise2d( IntX3, IntY2 );
cv7 = smoothedNoise2d( IntX4, IntY2 );
cv8 = smoothedNoise2d( IntX1, IntY3 );
cv9 = smoothedNoise2d( IntX2, IntY3 );
cv10 = smoothedNoise2d( IntX3, IntY3 );
cv11 = smoothedNoise2d( IntX4, IntY3 );
cv12 = smoothedNoise2d( IntX1, IntY4 );
cv13 = smoothedNoise2d( IntX2, IntY4 );
cv14 = smoothedNoise2d( IntX3, IntY4 );
cv15 = smoothedNoise2d( IntX4, IntY4 );
ci0 = cubicInterpolate( cv0, cv1, cv2, cv3, FractX );
ci1 = cubicInterpolate( cv4, cv5, cv6, cv7, FractX );
ci2 = cubicInterpolate( cv8, cv9, cv10, cv11, FractX );
ci3 = cubicInterpolate( cv12, cv13, cv14, cv15, FractX );
return cubicInterpolate( ci0, ci1, ci2, ci3, FractY );
----+----+----+----+---- cubicInterpolate ----+----+----+----+----
double p = ( v3 - v2 ) - ( v0 - v1 );
double q = ( v0 - v1 ) - p;
double r = v2 - v0;
double s = v1;
return p * pow( x, 3 ) + q * pow( x, 2 ) + r * x + s;
----+----+----+----+----
If someone can knows to add this to povray... feel free to use this code :o)
here is the tutorial from where i learned about:
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
i also wrote some code for cubic-interpolation in 3-dimensions, it's
very long, but works well...
greetings, Marcus
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3D7### [at] fritschy de> , Marcus Fritzsch <m### [at] fritschy de>
wrote:
> I implemented cubic-interpolation for a perlin noise
I am not sure what exactly this is supposed to be useful for?
POV-Ray already uses the Perlin noise function and its implementation is
more efficient...
Thorsten
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi,
Thorsten Froehlich schrieb:
> I am not sure what exactly this is supposed to be useful for?
>
> POV-Ray already uses the Perlin noise function and its implementation is
> more efficient...
Yes, surely it's more efficient then mine :o) It was an example for a
cubic interpolation, nothin more...
greetz, Marcus
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Mon, 9 Sep 2002 02:30:02 EDT Rohan Bernett wrote:
>Hopefully the POV-Team should be able to implement these in the next version
>(although it would be nice to have a little update for v3.5 adding the
>bicubic filtering).
>
>If anyone else gets any ideas, how about posting them in replies to this
>post? That would keep all the feature requests together, make things nice
>and neat.
Traditionally, many patches are user-written (but not all!) and
custom-compiled for others to test, debug, and fine tune. If these
features prove popular and compatible with the official POV-Ray, we may
implement them. Please see docs section 8.2.3 - POV-Ray 3.5 Development.
It is not always a simple matter as incorporating the patch code into
the official source - it sometimes requires much beta-testing and
rewriting of the patch code to ensure bug-free performance. Many of the
new features in 3.5 were thoroughly tested in MegaPov
http://www.nathan.kopp.com/patched.htm and other custom compiles.
Personally, for the 4.0 re-write, I'm campaigning vigorously for extra
cupholders and a CD changer ;)
--
Alan
ako### [at] povray org
a k o n g <at> p o v r a y <dot> o r g
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <ca50oug9in4ok2qcctf7idj13upcp994ja@4ax.com> , Alan Kong
<ako### [at] povrayWWW SPAM COM org> wrote:
> Personally, for the 4.0 re-write, I'm campaigning vigorously for extra
> cupholders and a CD changer ;)
I think those features will be no problem to be added to 3.5.1 already.
Just provide me with details how to email them to you, I have problems
fitting them into my modem right now ;-)
Thorsten
____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povray org
I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 12 Sep 2002 21:49:35 +0200 Thorsten Froehlich wrote:
>I think those features will be no problem to be added to 3.5.1 already.
Thank you, Thorsten. You POV-Team guys are really very clever ;)
--
Alan
ako### [at] povray org
a k o n g <at> p o v r a y <dot> o r g
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>That's possible too. Split the alpha channel out as a grayscale bitmap and use
>it as the guiding image in an image_pattern statement.
This should be added that to the tutorials section of the docs.
Rohan _e_ii
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
>Slime <slm### [at] slimeland com> wrote:
>> I always thought bi-cubic interpolation was really just bi-linear
>> interpolation with the points interpolated between in a smoother manner.
>
> AFAIK bicubic interpolation takes into account 16 pixels (instead of 4
>like bilinear interpolation does). It probably works a bit like the
>bicubic_patch surface.
I think I've managed to guess what the 16 pixels used for bicubic filtering
are (and the bilinear ones).
Bilinear
x
x*x
x
Bicubic
x x x
xxx
xx*xx
xxx
x x x
The '*' is the pixel being found and the 'x'es are reference pixels. The
outermost pixels are just control points to help align the curve. I _think_
this is correct, but if I am not, please correct me.
Rohan _e_ii
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |