PDA

View Full Version : Mesh from Image



Jose Ricardo
01-16-2010, 07:40 AM
Hi people,

In my research, I need to convert a model in a set of spheres. To do it, I'm using depth peeling, rendering the model using an orthographic projection and saving the eye vertex position in a texture at the fragment shader.

The radius of the sphere is a user's parameter so, given a radius, I have to render the model using a set of spheres.

What I'm doing is calculating how much a unit world space corresponds in my texture. So, if I have a frustum that goes from -20 to 20 in the x axes and rendering to a texture size 800x600, I wold get 20. So, each unit in my world space correspond to 20 pixels in the texture. In this case, I advance 20 pixels and get the central point in this for my position.

Unfortunatly, this is not working as I expected. For my research, the spheres needs to touch each one, leaving no gap between them, what is happening using this approach.

Does someone knows a better method or could give any advise to solve this problem?

Thanks a lot.

Jose Ricardo

Brolingstanz
01-17-2010, 03:22 AM
Do you mean to fill an object with tightly packed spheres?

What if the user specifies a radius larger than the mesh itself?

Jose Ricardo
01-18-2010, 11:05 AM
Hi Brolingstanz,

I mean compose a mesh with a set of spheres. I want to represent my mesh using a set of spheres instead a set of vertex and triangles.

Do you understand?