Jump to content
  • Advertisement
Sign in to follow this  
Basiror

Marching Cubes & Texture Coordinates

This topic is 3609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
The only solution I can think of would be to use a procedural texture based on 3D Perlin noise.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
http://developer.download.nvidia.com/presentations/2007/gdc/CascadesDemoSecrets.zip

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!