Marching Cubes & Texture Coordinates

Started by
27 comments, last by PolyVox 15 years, 8 months ago
Hi, I am looking for an algorithm to compute texture coordinates for a iso surface extracted using the marching cubes algorithm The problem I am facing is, that the MC algorithm produces vertical triangles e.g.: you have a terrain with caves the horizontal tex coordinates can be computed out of the xy coordinates of each vertex, that doesn t work for vertical triangles however Do you have any idea how to get a somewhat continuous coordinate set? Some additional information: + mesh will be smoothed before tex coordinate generation + vertex normals are available thx in advance P.S.: I just did a dirty implementation of the memory alignment to the page sizes of the cpu, it didn t pay back a single millisecond, yet it shoud be considered to make the algorithm run with constant memory requirements, to allows for high uptimes. On the other hand when loading the mesh right at the beginning, the allocated memory won t be fragmented that much, I guess comparing speeds after a couple of thousands of modifications will make a difference. Next thing to do is the bounding box extraction from the RLE voxels to reduce the search spaces for the MC algorithm [Edited by - Basiror on July 31, 2008 3:45:25 PM]
http://www.8ung.at/basiror/theironcross.html
Advertisement
The only solution I can think of would be to use a procedural texture based on 3D Perlin noise.

In the Nvidia demo that uses volumes to generate 3D meshes they use a method similar to the height field method you mentioned but instead use 3 textures, one along the xy, one zy, and one on xz that they blend depending on the normal of the surface.
I think I know how to do that

Basically you find the dominant axis of the normal, project the geometry onto the plane spanned by the 2 axis left and the normalize the sum of the absolute value of the components of the normal to 1.0 to get a proper blend weight.

Thats fairly simple and can be done in the vertex shader

thx for the hint.

P.S.: which nvidia demo is it, I can t seem to find it
http://www.8ung.at/basiror/theironcross.html
http://developer.download.nvidia.com/presentations/2007/gdc/CascadesDemoSecrets.zip
thx, this looks like an ideal solution for my problem :)
http://www.8ung.at/basiror/theironcross.html
Quote:Original post by Basiror
thx, this looks like an ideal solution for my problem :)


Indeed, that's also the approach I use in my project.
I would recommend splatting from an atlas directly in the pixel shader, and thus remove the need for continuous texture coordinates.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

The problem is, that I used the MC algorithm to triangulate my terrain in realtime, updating a atlast in realtime would certainly kill the performance

I managed it to generate 10000 triangle below 60 ms

thats damn fast on my 3 years old winchester


I ll post some screenshots somewhen the next 3 weeks, currently i am still fighting with the edge collapse algorithm
http://www.8ung.at/basiror/theironcross.html
Quote:Original post by swiftcoder
I would recommend splatting from an atlas directly in the pixel shader, and thus remove the need for continuous texture coordinates.

Can you elaborate on that approach? I'm working on a similar project to Basiror and have been using triplanar texturing so far, but I'm interested in new ideas.

This topic is closed to new replies.

Advertisement