java - How could I draw an Outlined Mesh like this? -
so saw blog parsing obj files, caught eye object parsing (this question isn't parsing obj files).
i know mesh created using 3d noise algorithm, simplex noise, want know how make similar line effect in lwjgl.
i have 3d simplex noise algorithm, , code thought work doesn't quite same thing.
the pattern notice mesh there rows of lines start on outside noise density highest. lines evolve based on noise density in specific spots, tried make algorithm produce lines , evolve them well, didn't quite work.
simplexnoise noise = new simplexnoise(23453) //variable seed worldlist = glgenlists(1); glnewlist(worldlist, gl_compile); //inefficient gets job done float prevx = 0.0f; float prevy = 0.0f; float prevz = 0.0f; for(int x=0;x<256;x++){ for(int y=0;y<256;y++){ for(int z=0;z<256;z++){ float xf = x/100; float yf = y/100; float zf = z/100; density = noise.simplex(3,xf,yf,zf); //octaves,x,y,z if(density>3){ //filter out results drawline(prevx,prevy,prevz,x+1,y*density,z*density); drawline(prevx,prevy,prevz,x*density,y+1,z*density); drawline(prevx,prevy,prevz,x*density,y*density,z+1); } } } } glendlist();
it shouldn't hard realize doesn't produce near same results. not know how approach or produce same mesh shape or similar, can me?
i'm not familiar lwjgl, think may able point in right direction far algorithm goes. can plug perlin/simplex noise marching cubes algorithm , generate triangle mesh it. used technique create mesh:
i believe may able result want drawing wireframe of outputted mesh. after all, if closely, of lines make triangles. can find more info marching cubes here.
Comments
Post a Comment