Question

Assuming I have a 3d object in my world looking like something below..

http://en.wikipedia.org/wiki/File:Graftal3.png

I also have a node storing the information on how to draw for example...

http://en.wikipedia.org/wiki/File:Graftal4.png

How do I go about interpolating from one to the other. From my research I know I will have to use vertex shaders. But the main part that is troubling me is that the 2nd model has more vertices than the original image.

I'm hoping for some guidance for how I should achieve this affect.

Thanks!

Was it helpful?

Solution

Vertex shaders is the wrong thing for the situation you're describing. You want to use geometry shaders instead. This requires you to use either Direct3D 10 or OpenGL 3.2 (alternatively OGL2 with a suitable extension)

In a geometry shader you feed it with basic geometry data, from which you can emit additional vertices as needed. In your case you'd probably feed it with the single line for the root of the tree and tesselate the tree as needed.

You have several options for the language of the shader, depending on the rendering system you intend to have the application running on. You have not specified the rendering system you're using and the actual implementation will be dependent on this choice.

The only real other option is to generate the geometry outside of shaders in the old-school way and then rendering it without a geometry shader but still using vertex and pixel shaders as needed.

It's also dependent on which OGRE version you're using. Geometry shaders are supported from Ogre 1.6 and upwards, which should be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top