Author Topic: Marching Cubes Question  (Read 5239 times)

0 Members and 1 Guest are viewing this topic.

Offline Motorherp

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • Shmup Dev
Marching Cubes Question
« on: June 11, 2008 »
How do.

So I'm thinking of implementing a marching cubes algorithm which I'd be using to polygonise some potentialy complex isosurfaces.  The algorithm for the tri vetex and normal generation seems straight forward enough but I'm a bit confused when it comes to generating texture uv's for the verts.  I've considered using 3d textures but these aren't easy to generate if I want a very specific texturing.  Does anyone know what the best way to generate uv data for traditional 2d texture mapping would be which would avoid texturing artifacts?

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Marching Cubes Question
« Reply #1 on: June 11, 2008 »
Since the marching-cube polygonizes volume-data, it makes sense to use volume-textures, too ("usual" 2d-texturing approaches usually suffer badly from discontinuities).
Volume-textures are usually expensive either in memory (stored 3d textures) or in processing (procedural textures), but since the iso-surface only intersects a small area of the whole volume, most of the texture-data isn't needed anyway. Assuming your surface stays constant, you could "bake" the 3d-texels into a 2d texture-unwrap.
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: Marching Cubes Question
« Reply #2 on: June 12, 2008 »
Yes Motorherp, hellfire would be the person to answer your questions. He kicked some ass with a demo featuring marching cubes.

http://dbfinteractive.com/index.php?topic=3106.0
Challenge Trophies Won:

Offline Motorherp

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • Shmup Dev
Re: Marching Cubes Question
« Reply #3 on: June 12, 2008 »
Thanks for the advice, much appreciated.  Indeed I plan to keep the geometry static once it's created so baking is a really cool idea.  I could use the original isosurface as a guide for creating the base 3d texture, then add the details once it has been baked into 2d where doing so is easier.  Sweet.

Offline Motorherp

  • C= 64
  • **
  • Posts: 57
  • Karma: 8
    • View Profile
    • Shmup Dev
Re: Marching Cubes Question
« Reply #4 on: June 12, 2008 »
Update ->  I found a cool piece of functionality hidden away in the depths of the DX SDK for handling the 2d uv coord generation.  Do a search for D3DXUVATLAS in the SDK manual or alternatively look here -> http://msdn.microsoft.com/en-us/library/bb206321.aspx.  Just thought some of you might find that useful since it certainly looks like it's going to shave a load of my task list anyway.  DX always continues to amaze me with the amount of built in stuff that's just hidden away in there with no real documentation.  It's kind of a shame in a way that I only really become aware of these things when I specificaly go searching for them.  I wonder what other undiscovered treasures lie in there unbeknownest to me. 

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Marching Cubes Question
« Reply #5 on: June 12, 2008 »
That's part of the fun :) Finding those hidden gems.

Anyway I am not a DX programmer, I use GL but I think you should have some good karma for that, it's always nice when folks post back with some useful follow-up to a question they asked, be it with information like you have, or even just to say the program is working now :)
Shockwave ^ Codigos
Challenge Trophies Won: