Jose Ricardo

01-16-2010, 08: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

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