← Back to team overview

kicad-developers team mailing list archive

Re: New 3D Viewer options patch

 

Hi Andrew,

I will not be available currently to directly support you, but after some recent analyse of 3DViewer and how it works regarding the "redraws" I have some suggestions and they are not "model cache" related.

Background:
Right now, after 3d viewer open and load everything, my main concern is that if you change some option (show 3d.. fill.. tickness.. textures..whatever) in some cases.. it will have to reload _everything_ again.
It happen also if you trying to just change the position of a 3D model (in pcbnew E module properties) after change it, it will reload again _everything_.. as same as open first time 3D viewer.

That happen because, it is rendering somehow all the things in big openGL call lists.
some thing like:

glBegin BIG_OBJECTS_LIST
for all objects
push matrix
gl apply object transformations
render object model
pop matrix
end all objects
glEnd BIG_OBJECTS_LIST

So every time you change something object.. (position in pcbnew..whatever) it will have to do everything again.

So.. I think before we start implementing some cache model mechanism.. we should first change the way 3D Viewer is generating the things for openGL

Proposal:
I propose something like:

for all objects
glBegin object_list_ID
// DO NOT apply object (3d module options.. module position.. etc) transformations!!
render object model
glEnd object_list_ID
end all objects

This way, we just have to make the render more dynamic and every time we render the object we will apply the transformations for that module (glTranslate.. glScale.. etc)
So there is no need to reload everything again..

I do believe something like this can be made for copper layers.. etc.. so every time we change something in one layer it will quick change in 3D viewer..

Here there are two ideas.. If we think 3D viewer just as a viewer, we can speed up drawing updates... because right now, 3D viewer is a bit mix of viewer.. and 3D "exporter" :S (in the way it try to compute all layer and it is processing it in big poly data)
If we can use the information data and split it as much as possible in openGL, just caching (with openGL lists) what is "fixed" then we will have a better rendering management that will speed up everytime we make small changes in pcbnew (or rendering options).

I do believe that this changes will be good move then to go into a model file cache system...
If we do correctly what I propose, then, without model cache it will just take time the first time we open 3D viewer.. then everything will be openGL cached (or dynamic updated just what is needed) while it is up and running. 

btw.. I have an idea that the other $$ EDA $$ software $$ packages (e.g: altium) are able to view in real time the 3D board while you are editing the traces on pcb board... that is a big goal to archive ;)

Regards,
MarioLuzeiro
________________________________________
From: Andrew Zonenberg [azonenberg@xxxxxxxxxxxxxxx]
Sent: 18 August 2014 10:59
To: Mário Luzeiro
Cc: jp charras; kicad-developers@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Kicad-developers] New 3D Viewer options patch

I am interested in working on the model cache system (I was the one who
originally proposed it) but won't have the time to work on it for
another week or so.

If anyone else is interested in getting started in the meantime please
coordinate with me so we don't duplicate efforts, if not I'll let you
guys know after I find a day or so to spend coming up with a solid
design.

Follow ups

References