Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

Anyone here using VBO's with .3ds files?

This topic is 4511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have just encountered my HUGE slow down in my engine. I am using immediate mode to render my models and OUCH... I haven't done anything with .3ds files other than some code to load and display them I had gotten off the net. I have modified it to suit my needs for GLSL ect... but never have I tried to use VBO's instead. How would I go about doing this? Is there a tutorial on it? I have setup my terrain to use VBO's but I know my data is 2D and easy to setup as strips... Now with models I have no idea how this is going to work for strips or fans ect... So are you all using just triangles and no strips? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I wasn't sure whether to reply or just rate you down for such badly thought out questions.

After 5 minutes of trying to sort your question into some realistic ones I decided you weren't worth wasting my lunch hour on. Sorry.

Spend more time thinking about what the gaps in your knowledge are, then work out how to explain them to us.

I'm happy to help, but this reads like you've thought about it for 10 seconds, got a vague idea that it might not be exactly the same as your terrain code, googled "3ds VBO tutorial" and then posted here. Think about it in more depth, ask better questions, and you'll get lots of help.


Share this post


Link to post
Share on other sites
3DS is a file format from Autodesk. It defines a 3D mesh and its properties.

VBO is a standardized data structure that obeys base rules, so that when sent to the graphcis card it allows an increase in speed.

You need to read the 3DS file and re-interpret its data into a VBO-compatible structure.

VBOs also suport TriStrips, but that means you'll have to further work upon your in-engine 3D data and convert the face list into a triangle strip list.

I suggest reading:
* NeHe to learn about VBOs
* NvTriStrip is a Library by nVidia to Stripify your 3D Data.

...and yes, please format your posts better in the future. People here like to help, but they can't be bothered translating people posts into something that makes sense. [wink]

Share this post


Link to post
Share on other sites
Sorry, but I am working on my coding late at night after working 12hr days 7 days a week and my mind is gone... :( Anyway currently I am using immediate mode to render my .3ds models. What I need to know is the data that is loaded from a .3ds file how is it laid out. Can I just dump that data into a VBO along with a IB from the data directly? If so what data do I work with the face data or the vertices? Not 100% sure why I need to work with the face data if I have access to the vertices. Also for the IB does .3ds store the index data along with the file so I don't have to arrange the data in the IB to render the mesh? Hope this is clarifies my problems...

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
Sorry, but I am working on my coding late at night after working 12hr days 7 days a week and my mind is gone... :( Anyway currently I am using immediate mode to render my .3ds models. What I need to know is the data that is loaded from a .3ds file how is it laid out. Can I just dump that data into a VBO along with a IB from the data directly? If so what data do I work with the face data or the vertices? Not 100% sure why I need to work with the face data if I have access to the vertices. Also for the IB does .3ds store the index data along with the file so I don't have to arrange the data in the IB to render the mesh? Hope this is clarifies my problems...


Re-read my post, the answers are there.

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
Sorry, but I am working on my coding late at night after working 12hr days 7 days a week and my mind is gone... :( Anyway currently I am using immediate mode to render my .3ds models. What I need to know is the data that is loaded from a .3ds file how is it laid out. Can I just dump that data into a VBO along with a IB from the data directly? If so what data do I work with the face data or the vertices? Not 100% sure why I need to work with the face data if I have access to the vertices. Also for the IB does .3ds store the index data along with the file so I don't have to arrange the data in the IB to render the mesh? Hope this is clarifies my problems...


As prozak pointed out you have to convert to a VBO friendly format. The same case is with the glDrawElements where you will have to load and convert data to a glDrawElement friendly format. This would have been evident if you had looked at closely the immediate mode rendering.

Share this post


Link to post
Share on other sites
VBO was evolved from Vertex Array implementation. Therefore, if you know Vertex Array method to render meshes using glDrawArrays() or glDraw[Range]Elements(), then implementing VBO is quite easy. Top of vertex array implementation, you only need to know how to create vertex buffer objects and how to bind it before use, similar to texture objects.

The difference between Vertex Array and VBO is that: In vertex array mode, the vertex data are stored in your program and needed to transfer to render every frame, but in VBO mode, the data can be cached in high performance video memory and don't need to be re-sent every frame.

I think the first thing you do is: modify your 3ds loader in order to store its vertex data (vertex coords, color comp., normals, texture coords) into vertex array structure.

Share this post


Link to post
Share on other sites
Quote:
Original post by songho
I think the first thing you do is: modify your 3ds loader in order to store its vertex data (vertex coords, color comp., normals, texture coords) into vertex array structure.


Yes, and it is quite easy to do with the .3DS format.

Share this post


Link to post
Share on other sites
Quote:
Original post by songho
VBO was evolved from Vertex Array implementation. Therefore, if you know Vertex Array method to render meshes using glDrawArrays() or glDraw[Range]Elements(), then implementing VBO is quite easy. Top of vertex array implementation, you only need to know how to create vertex buffer objects and how to bind it before use, similar to texture objects.

The difference between Vertex Array and VBO is that: In vertex array mode, the vertex data are stored in your program and needed to transfer to render every frame, but in VBO mode, the data can be cached in high performance video memory and don't need to be re-sent every frame.

I think the first thing you do is: modify your 3ds loader in order to store its vertex data (vertex coords, color comp., normals, texture coords) into vertex array structure.




Thanks for the helpful solution. I wasn't sure if that was what I needed to do or not. So load all the vertex data from the .3ds file into a struct that holds all vertex data and then of course upload that to the VBO. Now for my IBO can I just use triangles and wind them in CCW/CW order 0,1,2,3 ect... or will I need more info to accomplish that? With the total number of vertices known all I should have to do is just loop through the total number of vertices and make a IBO as I stated above? Thanks for the patience with my question.

Share this post


Link to post
Share on other sites
you may want to experiment with using VBO's and also without. If your polygon count is not very high for each 3ds mesh you may find that using many small VBO's will actually give you worse performance than just using a standard array.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!