Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


PlatinumOz

Member Since 08 Sep 2012
Offline Last Active Feb 13 2013 01:51 PM

#4979784 Voxel structure programming implementation

Posted by PlatinumOz on 13 September 2012 - 11:26 AM

First, render your model to a texture. Vertex shader:

// Authors : Sinje Thiedemann, Niklas Henrich,
//		   Thorsten Grosch, Stefan Mueller

varying vec3 P;

void main()
{	
   // Transform atlas texture coordinate into NDC
	gl_Position = vec4((gl_MultiTexCoord0.xy * 2.0) - vec2(1.0), 0.0, 1.0);

	// Pass world-space position to fragment shader
	P = (gl_ModelViewMatrix * gl_Vertex).xyz;
}

Frag shader:
varying vec3 P;

void main()
{
   // Store world-position in atlas texture
   gl_FragColor = vec4(P, 1.0);
}

Then, for each pixel, to something like this:
foreach pixel:
	addVoxelAtPosition(pixel.color);

Got it?

Man, I got it, thanks. But how can I use voxel data in program code? Do you read my question?
I asked about "c# structure class to store voxel data and be able for further using in code". Capish?


#4979758 Voxel structure programming implementation

Posted by PlatinumOz on 13 September 2012 - 09:46 AM

Make sure your model has uv coordinates. Render your model to a texture. Set each vertex position to its vertex coordinates. Set each vertex color to its position. For each pixel, create a voxel at the position from pixel's color.

man, I don't catch what you have in mind! Could you show me class structure?


#4979722 Converting a 3D mesh model to a voxel field

Posted by PlatinumOz on 13 September 2012 - 08:33 AM

Man, It will be good if you give any reference or fresh idea. Capish?


#4979714 Voxel structure programming implementation

Posted by PlatinumOz on 13 September 2012 - 08:24 AM

Look up the Sparse Voxel Octree. It's probably the best way to squeeze voxel data down to a reasonable size.

What's your end goal of the project? What do you want to use the distance fields for?

DracoLacertae, thanks so. I'm planing to use distance field for definition distance between objects. It's very difficult to build distance field for Sparse Voxel Octree, 3D array is more better I think. If you have another mind about it, please, post me material reference.


#4978945 Voxel structure programming implementation

Posted by PlatinumOz on 11 September 2012 - 10:16 AM

No, man.

I don't need rendering voxelized object. I need structure of voxelizard object in program code, for exapmle, type - array of byte.


#4978609 Voxel structure programming implementation

Posted by PlatinumOz on 10 September 2012 - 09:57 AM

Come on, ladies and gentlemen !


#4978608 Voxel API Constructing

Posted by PlatinumOz on 10 September 2012 - 09:56 AM

Guys, I need your advise ))


#4978476 Converting a 3D mesh model to a voxel field

Posted by PlatinumOz on 09 September 2012 - 10:57 PM

Good afternoon!

Please, tell me, how can I convert a 3D mesh model to a voxel field array?

Thanks.


#4977950 Voxel structure programming implementation

Posted by PlatinumOz on 08 September 2012 - 05:06 AM

Hello, everybody!

The 3D scene consist of 20 objects based on polygonal model structure. I wanna convert polygonal objects to voxel data structure (i think it's array 3D map) . And voxel objects will be used for constructing distance field of all environment world.

Please, tell me, do you have any ideas about using c# structure class to store voxel data and be able for further using in code or any algorithms and methods?

Do you know any API or wrap that could realize this functionality?

Thanks.


PARTNERS