POV-Ray : Newsgroups : povray.newusers : DF3 / interpolation question Server Time
23 Dec 2024 14:59:09 EST (-0500)
  DF3 / interpolation question (Message 1 to 7 of 7)  
From: JeffBTX
Subject: DF3 / interpolation question
Date: 29 May 2009 22:00:01
Message: <web.4a2091fa9ea5e81c2c1590090@news.povray.org>
I am using POVRay version 3.6.1.msvc8.win64, OS is WinVista Home Premium 64 bit.

I am getting back into POVRay after a LONG hiatus. Its been maybe ... 4 or 5
years at least since I last touched POVRay.

Yesterday I started experimenting with .DF3 files. I've had SOME experience with
them under POVRay 3.5 (but I think I fully understand them). I've used Pod's
tga2df3 utility, and also experimented with using a program that I wrote to
*create* blank DF3s (just the header, plus filled with zeros). I've
experimented and figured out how to calculate the offset into a DF3 given x,y,z
coords. My results arwe what I expect, IE I'm not doing anything wrong, voxels
are where they are supposed to be.

I've noticed something odd. I THINK I know what is happening, but could use
input from a "Guru".

Assume you have a "blank" DF3 (just the header, plus filled with zeros). Assume
an 8 bit DF3, of say, dimensions 10x10x10 or 100x100x100 (because that is what
I've been experimenting with so far). Now... "activate" a *corner* of the DF3
by filling it (with, say, a density value of 255). The offset (for a 10x10x10)
(assuming zero-base coords of 0-9) would be x + (y*10) + (z*10*10) + 6. Or
substitute 100 for 10, for a 100x100x100 DF3. Okay... if you fill x,y,z = 0
with 255, you have filled the lower left forward corner of the cube.

If you use interpolate 0 with the DF3, the result is exactly as expected,
nothing strange... just a blocky "pixellated" voxel.

If you use interpolate 1 with the DF3, there are "artifacts" at other corners
and occasionally in other unexpected places (even in the center (?) of the cube
sometimes? huh?).

If you use interpolate 2 with the DF3, the artifacting becomes stranger and
extremely "wacky".

Okay, I guess the interpolation is ... "averaging" (kind of like antialiasing)
the region around that corner, and is unexpectedly "wrapping around" to the
other corners? And why are artifacts showing uop in odd places, like the middle
of the cube?

Okay ... so I say to myself, no problem, just make sure that you stay at least
one voxel away from all corners, edges and faces to avoid this "wrap-around" /
"bleeding" effect.

No good - if you are one voxel away from the corner, using interpolate 2, there
is still some "bleeding". Probably there is a "magic number" (number of voxels)
as a "safety zone"... before I try to find it by experimenting, I thought I
would ask for input, and maybe an explanation of what is happening.

-Thanks
-jeff


Post a reply to this message

From: Alain
Subject: Re: DF3 / interpolation question
Date: 30 May 2009 09:26:55
Message: <4a21341f$1@news.povray.org>
JeffBTX nous illumina en ce 2009-05-29 21:55 -->
> I am using POVRay version 3.6.1.msvc8.win64, OS is WinVista Home Premium 64 bit.
> 
> I am getting back into POVRay after a LONG hiatus. Its been maybe ... 4 or 5
> years at least since I last touched POVRay.
> 
> Yesterday I started experimenting with .DF3 files. I've had SOME experience with
> them under POVRay 3.5 (but I think I fully understand them). I've used Pod's
> tga2df3 utility, and also experimented with using a program that I wrote to
> *create* blank DF3s (just the header, plus filled with zeros). I've
> experimented and figured out how to calculate the offset into a DF3 given x,y,z
> coords. My results arwe what I expect, IE I'm not doing anything wrong, voxels
> are where they are supposed to be.
> 
> I've noticed something odd. I THINK I know what is happening, but could use
> input from a "Guru".
> 
> Assume you have a "blank" DF3 (just the header, plus filled with zeros). Assume
> an 8 bit DF3, of say, dimensions 10x10x10 or 100x100x100 (because that is what
> I've been experimenting with so far). Now... "activate" a *corner* of the DF3
> by filling it (with, say, a density value of 255). The offset (for a 10x10x10)
> (assuming zero-base coords of 0-9) would be x + (y*10) + (z*10*10) + 6. Or
> substitute 100 for 10, for a 100x100x100 DF3. Okay... if you fill x,y,z = 0
> with 255, you have filled the lower left forward corner of the cube.
> 
> If you use interpolate 0 with the DF3, the result is exactly as expected,
> nothing strange... just a blocky "pixellated" voxel.
> 
> If you use interpolate 1 with the DF3, there are "artifacts" at other corners
> and occasionally in other unexpected places (even in the center (?) of the cube
> sometimes? huh?).
> 
> If you use interpolate 2 with the DF3, the artifacting becomes stranger and
> extremely "wacky".
> 
> Okay, I guess the interpolation is ... "averaging" (kind of like antialiasing)
> the region around that corner, and is unexpectedly "wrapping around" to the
> other corners? And why are artifacts showing uop in odd places, like the middle
> of the cube?
> 
> Okay ... so I say to myself, no problem, just make sure that you stay at least
> one voxel away from all corners, edges and faces to avoid this "wrap-around" /
> "bleeding" effect.
> 
> No good - if you are one voxel away from the corner, using interpolate 2, there
> is still some "bleeding". Probably there is a "magic number" (number of voxels)
> as a "safety zone"... before I try to find it by experimenting, I thought I
> would ask for input, and maybe an explanation of what is happening.
> 
> -Thanks
> -jeff
> 

Interpolate 2 have problems when the density reatch zero, it seems that it tries 
  to create some negative values that wrap around to be large positive values.

The common solution is to not reatch zero. For your "empty" DF3, it can mean 
filling it with 1's instead of 0's.

Alain


Post a reply to this message

From: JeffBTX
Subject: Re: DF3 / interpolation question
Date: 30 May 2009 10:30:01
Message: <web.4a21422b6da9fd6af8eed5c40@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> JeffBTX nous illumina en ce 2009-05-29 21:55 -->
> > I am using POVRay version 3.6.1.msvc8.win64, OS is WinVista Home Premium 64 bit.
> >
> > I am getting back into POVRay after a LONG hiatus. Its been maybe ... 4 or 5
> > years at least since I last touched POVRay.
> >
> > Yesterday I started experimenting with .DF3 files. I've had SOME experience with
> > them under POVRay 3.5 (but I think I fully understand them). I've used Pod's
> > tga2df3 utility, and also experimented with using a program that I wrote to
> > *create* blank DF3s (just the header, plus filled with zeros). I've
> > experimented and figured out how to calculate the offset into a DF3 given x,y,z
> > coords. My results arwe what I expect, IE I'm not doing anything wrong, voxels
> > are where they are supposed to be.
> >
> > I've noticed something odd. I THINK I know what is happening, but could use
> > input from a "Guru".
> >
> > Assume you have a "blank" DF3 (just the header, plus filled with zeros). Assume
> > an 8 bit DF3, of say, dimensions 10x10x10 or 100x100x100 (because that is what
> > I've been experimenting with so far). Now... "activate" a *corner* of the DF3
> > by filling it (with, say, a density value of 255). The offset (for a 10x10x10)
> > (assuming zero-base coords of 0-9) would be x + (y*10) + (z*10*10) + 6. Or
> > substitute 100 for 10, for a 100x100x100 DF3. Okay... if you fill x,y,z = 0
> > with 255, you have filled the lower left forward corner of the cube.
> >
> > If you use interpolate 0 with the DF3, the result is exactly as expected,
> > nothing strange... just a blocky "pixellated" voxel.
> >
> > If you use interpolate 1 with the DF3, there are "artifacts" at other corners
> > and occasionally in other unexpected places (even in the center (?) of the cube
> > sometimes? huh?).
> >
> > If you use interpolate 2 with the DF3, the artifacting becomes stranger and
> > extremely "wacky".
> >
> > Okay, I guess the interpolation is ... "averaging" (kind of like antialiasing)
> > the region around that corner, and is unexpectedly "wrapping around" to the
> > other corners? And why are artifacts showing uop in odd places, like the middle
> > of the cube?
> >
> > Okay ... so I say to myself, no problem, just make sure that you stay at least
> > one voxel away from all corners, edges and faces to avoid this "wrap-around" /
> > "bleeding" effect.
> >
> > No good - if you are one voxel away from the corner, using interpolate 2, there
> > is still some "bleeding". Probably there is a "magic number" (number of voxels)
> > as a "safety zone"... before I try to find it by experimenting, I thought I
> > would ask for input, and maybe an explanation of what is happening.
> >
> > -Thanks
> > -jeff
> >
>
> Interpolate 2 have problems when the density reatch zero, it seems that it tries
>   to create some negative values that wrap around to be large positive values.
>
> The common solution is to not reatch zero. For your "empty" DF3, it can mean
> filling it with 1's instead of 0's.
>
> Alain

Thanks, Alain - I will experiment with that today.


Post a reply to this message

From: JeffBTX
Subject: Re: DF3 / interpolation question
Date: 30 May 2009 12:55:00
Message: <web.4a21646e6da9fd6af8eed5c40@news.povray.org>
I am still getting artifacts after filling the DF3 with 01's (versus 00's). It
is severe if the voxel is AT a corner, less severe if the voxel is 1 unit away
from the corner, filling with 01's does alleviate the problem a little,
however. I am posting some info in binaries -> images.


Post a reply to this message

From: Leroy Whetstone
Subject: Re: DF3 / interpolation question
Date: 31 May 2009 16:23:10
Message: <4A22E73B.5050300@joplin.com>
Hi!
  I haven't played with DF3 files for awhile. I did write a little 
program to covert an heightfeild TGA file(255 color) into a DF3 file by 
slicing the heightfeild into DF3 sections. Each section repersents an 
height, only where the hieght of the feild is greater than the section 
height is the voxel changed else it's zero. So there is a lot of zeros.

I went through some of these DF3 files and checked out all the 
interpolate values using
  POV version 3.6.1.icl8.win32 on my Win98
and had no troubles. So I don't think zeros is the problem.

Haven't use 'Pod's tga2df3' so I cann't comment on its use.

But, I may be able to help out some.
  First: Did you run the DF3 examples that came with POV?
        If you have and they work Ok, then we know that there is no bug.
         If not then we have a bug with your POV version or Win problem.
  Second: Do you know for sure what is in the DF3 file you make?
          That is can you read byte by byte what's on the DF3?
          This is very important. I ran into a variable problem where I 

          thought I was writing one thing but I was writing something
          else.
  Third: You mention using a Corner Voxel in your experiments.
         A line of voxels would tell ya more.

And at last if you want I could sent you some of the DF3 files I've made
along with that progam wrote them. The program ain't finished but it 
could giv you sme ideas.

Have Fun!!


Post a reply to this message

From: JeffBTX
Subject: Re: DF3 / interpolation question
Date: 31 May 2009 17:10:00
Message: <web.4a22f1496da9fd6a838003e0@news.povray.org>
Leroy Whetstone <lrw### [at] joplincom> wrote:
> Hi!
>   I haven't played with DF3 files for awhile. I did write a little
> program to covert an heightfeild TGA file(255 color) into a DF3 file by
> slicing the heightfeild into DF3 sections. Each section repersents an
> height, only where the hieght of the feild is greater than the section
> height is the voxel changed else it's zero. So there is a lot of zeros.
>
> I went through some of these DF3 files and checked out all the
> interpolate values using
>   POV version 3.6.1.icl8.win32 on my Win98
> and had no troubles. So I don't think zeros is the problem.
>
> Haven't use 'Pod's tga2df3' so I cann't comment on its use.
>
> But, I may be able to help out some.
>   First: Did you run the DF3 examples that came with POV?
>         If you have and they work Ok, then we know that there is no bug.
>          If not then we have a bug with your POV version or Win problem.
>   Second: Do you know for sure what is in the DF3 file you make?
>           That is can you read byte by byte what's on the DF3?
>           This is very important. I ran into a variable problem where I
>
>           thought I was writing one thing but I was writing something
>           else.
>   Third: You mention using a Corner Voxel in your experiments.
>          A line of voxels would tell ya more.
>
> And at last if you want I could sent you some of the DF3 files I've made
> along with that progam wrote them. The program ain't finished but it
> could giv you sme ideas.
>
> Have Fun!!

Leroy;

Hello, and thank you for the reply.

First: Yes, "GALAXY.POV" uses SPIRAL.DF3, and that renders just fine. I believe
that is the only media example that uses a DF3 file; although
SCENES\TEXTURES\PATTERNS\densfile.pov also uses SPIRAL.DF3 for both a pigment
and a normal.

Second: Yes, I know absolutely for certain. I've studied various DF3's and I
feel that I understand them... it was easy to create a small 10x10x10 DF3 "by
hand". I just used notepad until I had a textfile that was exactly 1006 bytes
long: XYZ = 10x10x10 = 10x10x10 = 1000 bytes, plus 6 bytes for the header. Then
I changed the extension from .TXT to DF3, used a hex editor to fill with zeros
(or later, 01's as Alain suggested), manually edited the first 6 bytes to 00 0A
00 0A 00 0A to create the header, and I had a blank 10x10x10 .DF3 file. I used a
hex editor to impose a voxel for testing... the offset would be X + (Y*10) +
(Z*10*10), assuming XYZ range 0 to 99. I filled the voxel location with FF (and
other values for experiments). I've experimented with setting other voxels and
intensities. In the subgroup POV Ray Binaries -> images, Alain made an
additional observation; he verifies aopparantly that he also got the error I
was getting with POVRay 3.6.1, but that the error is NOT in 3.7 (beta).

Third: I agree... a line of voxels might tell me more or, who knows? Might even
get rid of the error. Maybe it only happens when voxels are isolated and in or
near a corner, edge or face. I've never seen anyone report errors when they
uses .DF3s for, say, clouds. So maybe "busy" DF3's have no problem.

So... all in all, apparantly the problem rests in the version... since Alain
reports that 3.7 (beta) does not show this error. It might also be that I am
using the *64 bit* version of 3.6.1; if 32 bit code is improperly mixed with 64
bit code, maybe that is the source of the problem; but I expect that development
for 3.6.1 is expired, the development group is concentrating on 3.7 right now.


Post a reply to this message

From: Alain
Subject: Re: DF3 / interpolation question
Date: 2 Jun 2009 20:36:26
Message: <4a25c58a$1@news.povray.org>
Leroy Whetstone nous illumina en ce 2009-05-31 16:23 -->
> Hi!
>  I haven't played with DF3 files for awhile. I did write a little 
> program to covert an heightfeild TGA file(255 color) into a DF3 file by 
> slicing the heightfeild into DF3 sections. Each section repersents an 
> height, only where the hieght of the feild is greater than the section 
> height is the voxel changed else it's zero. So there is a lot of zeros.
> 
> I went through some of these DF3 files and checked out all the 
> interpolate values using
>  POV version 3.6.1.icl8.win32 on my Win98
> and had no troubles. So I don't think zeros is the problem.
> 
> Haven't use 'Pod's tga2df3' so I cann't comment on its use.
> 
> But, I may be able to help out some.
>  First: Did you run the DF3 examples that came with POV?
>        If you have and they work Ok, then we know that there is no bug.
>         If not then we have a bug with your POV version or Win problem.
>  Second: Do you know for sure what is in the DF3 file you make?
>          That is can you read byte by byte what's on the DF3?
>          This is very important. I ran into a variable problem where I
>          thought I was writing one thing but I was writing something
>          else.
>  Third: You mention using a Corner Voxel in your experiments.
>         A line of voxels would tell ya more.
> 
> And at last if you want I could sent you some of the DF3 files I've made
> along with that progam wrote them. The program ain't finished but it 
> could giv you sme ideas.
> 
> Have Fun!!
> 
Have you ever tried to render galaxy.pov with interpolate dset to 2?
I did, it renders well with interpolate 0 and 1.
With interpolate 2, the result is orrible. There are HUGE artefacts all over the 
place.

And yes, somebody did try patching the areas that are zero to one or 2, and it 
realy reduced the amount and gravity of the artefacts.


Post a reply to this message

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