JOGL Mipmaps

I’ve implemented mipmaps in the demo. You can download it here:
myweb.dal.ca/mkiefte/MipmapDemo.zip

The old demo is still there:
myweb.dal.ca/mkiefte/TextureDemo.zip

Same as before except panning is faster as there are no calls to Double.toString().

Let me know what you think.

  • M.

Still good here.
To be honest I was not able to discern any difference between the two versions as far as panning goes.

mkiefte messages@forums.vassalengine.org wrote:

Post generated using Mail2Forum (mail2forum.com)

2008/5/7 Timothy Mccarron <timothy.mccarron@sbcglobal.net (timothy.mccarron@sbcglobal.net)>:

Actually, I changed the old version to be faster as well and uploaded it. You shouldn’t see either version using up a lot of cycles in panning. If you do, let me know, but I wouldn’t immediately have an answer for it.

I was more interested in the rescaling and rotation quality. You can run them side-by-side. Let me know what you think.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake Timothy Mccarron:

Even if it’s maxing out your processor during panning, you wouldn’t
notice if nothing else is contending for processor cycles at the
same time.

I think this is much, much better in terms of image quality when the
zoom factor is less than 1.

There’s no source code in this one. I’d like to see what you did. :slight_smile:

Also, is it possible to get rid of the flickering when the window
is resized?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’ve checked a Linux and a Windows machine and hardly any cycles are being used once the images are loaded. I heard the GPU fan kick in though.

I checked all your filters and the Lanszoc3 filter appears to be the best one to my eyes. The others result in a lot of blurriness.

I had inserted numerous obscenities in the code and I didn’t want to offend anyone. However, I just ran sed on the source code and eliminated all the foul language. I’ve updated the ZIP file and the source code can be downloaded here:
http://myweb.dal.ca/mkiefte/TextureDemo.java

I played with that briefly, but I couldn’t get rid of it. I don’t know where it comes from. I’ll have to dig.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Lanczos3 is clearly the best of all of them for downscaling, as it’s
the best at handling high-frequency regions (i.e., where there are
sharp changes in color, i.e., edges). Since the filter is not being
applied in real-time, then we could potentially get even better results
by increasing the window size from 3 to something larger, maybe 7,
though the time to filter is quadratic in the window size, so it’s
going to take 5.4 times longer that way. I couldn’t say whether it will
be 5.4 times better-looking for the extra computation done until
we try it. (The way to get LanczosN for whatever N you want is to
replace the 3’s in the code with your preferred N.)

I find that kind of cathartic. :slight_smile:

Thanks.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

The current implementation too general, although that’s what you need right now in VASSAL. I only need it for factor-of-2 downsampling and all the images already have to have power-of-2 dimensions, so this could be done via 2-d FFT very efficiently. As long as the length of the filter is also a power of 2, the operation should be extremely fast.

The Java AWT does have a ConvolveOp.class, but there’s nothing to say that’s it’s done using FFT, and my guess is that it isn’t.

Should have left them in.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Yes, you’re certainly right—given some assumptions about the input,
this could be made much faster than it is. Without any such assumptions,
I think it’s about as fast as it can be right now.

If we can do this with FFTs, then maybe we could also ship the work
off to the GPU for creating the mipmaps? That would be wicked fast,
since a GPU is basically just a whacking big matrix multiplier.

(I figured you’d know something about this stuff, BTW, as you work
on audio. The only real difference between sampling audio and images
is the number of dimensions, since hardly do you ever see anyone
using a filter which isn’t separable (which could in give you better
results in 2D than making a pass along each dimension with a 1D filter,
but at the expene of being a lot slower). I learned a lot about these
things from talking with Leigh Smith, a guy in my institute who works
on music cognition.)

The performance of the ConvolveOp class is crap, last I checked (as
I looked into that when I was writing and optimizing this stuff last
fall).


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

You can do it with fragment shaders. Or you could use a filter when you paste it directly onto the back framebuffer and then copy the image to a texture all inside the GPU. I don’t know if JOGL will let you do that, though. I can check it out, but I think it’s low priority right now as that can be done probably fast enough with a good FFT library. Is there such a thing for Java? We’re already using platform-dependent binaries, might as well go all the way.

And if you do fMRI, you can do it in 3D! (with a basement lab full of RedHat servers, although today, I could probably do it on my laptop).

We have somewhere here who does that. Don’t know a whole lot about it. I used to do a lot of DSP in the lab, but with all the tools that are available these days, I have to admit that I don’t think about it very much any more. Though when I was your age, we had to do FFTs by hand with an abacus. And we had to walk 5 miles in the snow to do it.

The lost opportunities just kill me.

Otherwise my impression of Java is quite positive. I’m thinking of doing more work in Java now that it appears somewhat mature and relatively easy to learn.

  • M.

Post generated using Mail2Forum (mail2forum.com)

2008/5/7 Jeffrey Brent McBeth <mcbeth@broggs.org (mcbeth@broggs.org)>:

Oh yeah? I can do a Fourier transform with a collection of oddly shaped glass tubes!

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

I’m not sure that we can require our users to have a collection of oddly
shaped glass tubes.

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thing is, we already have to have native binaries, so might as well have native FFT libraries. I know it sounds bad, but if we have an FFT implementation for every platform for which JOGL native binaries exist, then it won’t matter at all. They would just go in the same library directory.

However, FFT could just be written in Java and it would still be an order of magnitude faster than what we’re doing now. In fact, FFT is so simple, that I could just write it myself… I’ll have to open a book though.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake Jeffrey Brent McBeth:

FFTW is out because it’s GPL. (Gah, I hate licensing issues!)

I can’t find anything out about MKL’s license (or even where you can
download it).

The FFTW people have kindly provided benchmarks over a whole slew of
FFT implementations, here, so we might be able to find one we can
use that way:

fftw.org/benchfft/


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

I know I’ve seen some pure-Java FFT implementations already, surely
one of which we could use.

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Google search reveals this:
http://www.cs.princeton.edu/introcs/97data/FFT.java.html

and this:
http://www.mathtools.net/Java/FFT/index.html

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

cs.princeton.edu/introcs/97d … .java.html
rsb.info.nih.gov/ij/source/ij/plugin/FFT.java


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

CONGRATULATION MICHAEL !!! :astonished: :astonished: :astonished:

Joel shows it to me directly in Paris … in front of me :wink:

Here my home video …

softbug.free.fr/vassal/project/vassal_video.htm

2008/5/9 soft-bug <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>:

I’m just getting started. I’ve already decreased the loading time by half and I think I can do better.

Wow. How did you make that?

  • M.

Post generated using Mail2Forum (mail2forum.com)

The direct link to capture the video file is here :

softbug.free.fr/vassal/project/vassal_video.wmv

I have used a tool named CamStudio to capture my screen window … then i have converted the avi file (28 Mo) in wmv (5 Mo) for 30 secondes video …

CONGRATULATION AGAIN !!! :smiley:

Thus spake “Michael Kiefte”:

Yes, that’s quite impressive! (I know there are some open-source
screencast programs out there, like Constantinople, IIRC.)

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)