Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Apr 23, 2024 19:35

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 9 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: vbo considerations for glmodel
BeitragVerfasst: Sa Jan 02, 2010 16:34 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
With openg3 i need to supply a new rendering path to glmodel.
For now i started with updating the opengl 1.5 vbo path that is very broken.

With my old opengl 1.0 render path i just rendered the vertices etc in order and insterted glend/glbegin when a material change was needed. Now with buffers that is no option.

So what is the best way?
-a vbo per mesh object or a vbo per model. With a vbo per model i would loose the ability of enabling/disabling certain meshed so that is no option.
-but a vbo per mesh object is not enough as i am the unable to change materials(e.g. textures) inbetween.
-so i need multiple vbo's per mesh object, one per material.
That makes me wonder is there a limit to the number of vbo's i can use at once?

Next when i go implement a proper opengl3 path i need to find a way to replace the lighting and material way i use now. For just color i then would be able to use buffer again, but could the same also be used for changing textures, e.g. by providing texture id's in a buffer?

Or is there a different much better way i have not thought about yet?

Thanks in advance for thinking along with me.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: Sa Jan 02, 2010 17:03 
Offline
DGL Member

Registriert: Sa Mär 14, 2009 17:48
Beiträge: 99
Programmiersprache: D, Java, C++
Well, i use two different solutions, first one: Order your Vertices by Material, bind the Material and Draw just the part of your VBO (See: http://wiki.delphigl.com/index.php/glDrawArrays and http://wiki.delphigl.com/index.php/glDrawElements) that has the same material, then with the next Material the same thing. Second solution: Add a Material Index to your vertices (For example (Vertex Format): x,y,z,nx,ny,nz,material_index) and pass it to a shader, now bind - via uniform variables - your materials and render it there.

Hope i could help you.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: Sa Jan 02, 2010 19:07 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
So i can make one big vbo. And next i only render parts from it allowing to change material. Like you say the vbo should be filled so that vertices with the same material are in order. Also i should keep track where a material begins and ends in order to render the correct part of the buffer.

I keep your idea of storing material id's for the openg3 path. The only trouble i fear with this is changing textures?

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: Sa Jan 02, 2010 19:11 
Offline
DGL Member

Registriert: Sa Mär 14, 2009 17:48
Beiträge: 99
Programmiersprache: D, Java, C++
noeska hat geschrieben:
I keep your idea of storing material id's for the openg3 path. The only trouble i fear with this is changing textures?


Whats about texture-ids in the Vertices and uniforms for every Texture? But i would prefer this way: Take all your 2D Textures and generate a 3D Texture, instead of switching between all of your 2D Textures you can use the third dimension of the texture coordinates as an "Index" and you dont have to bind more than one texture to your shader.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: Sa Jan 02, 2010 19:46 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
Beware, there are also limitations how many layers a 3d texture can have.

I would say, you are better off with one index array per material containing the indicies („pointers“) of the vertices belonging to that material. So you only need one draw call per material and you can sort by materials. You can also place the vertices at any position in the vertex buffer you like.
If you need to disable each separate mesh you would need an index array per material per mesh of course.

Also you should consider that different materials may have different shaders (Phong vs. Blinn e.g. or even water shaders) and you should really avoid an „uber-shader“ which handles any material.

good luck ;)

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: So Jan 03, 2010 00:45 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Lord Horazont hat geschrieben:
good luck ;)

Thanks i need that, because for now i totaly fail at creating indices per mesh per material... :( Am i supposed to keep alle the vertex data in one buffer or do i also need to split that up per material?

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: So Jan 03, 2010 11:27 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
No, you can keep the data in one VBO. You even need to have the vertices which are referenced by one index array also in one vbo.

greetings

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: So Jan 03, 2010 14:02 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
The problem is that i appear to missing some vertices for certain materials making a mess of the endresult. If you want you may want to look at latest version of glmodel in svn the files that matter are the ones is glvbomesh.pas ... I must be doing something very wrong but i cannot see it for now :-(

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: vbo considerations for glmodel
BeitragVerfasst: So Jan 03, 2010 16:10 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Made some progress now the static meshes work, but i am having some problems with updating when bone and skin with animation is applied ... So milkshape ascii models dont work for now with the vbo render path.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 9 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 27 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.127s | 17 Queries | GZIP : On ]