View unanswered posts | View active topics It is currently Fri Nov 24, 2017 7:26 am



Reply to topic  [ 8 posts ] 
 FoxWorks Aerospace Simulator Editor 
Author Message

Joined: Fri May 10, 2013 12:34 pm
Posts: 5
Post FoxWorks Aerospace Simulator Editor
I'm working on aerospace simulator, I also need a tool to enter data into it (parametric data). I've previously wrote a simple custom renderer, but now I'm switching over to using GLC_lib.

I want to use this thread to log my progress, maybe there will be some neat screenshots eventually.

This is my custom renderer, I need to end up with same look from GLC_lib, but it must run faster:
Image

This is what I've got so far (I have just started):
Image

Already more high quality image! Now I will just need to port my old shading code and FXAA to GLC_lib, and lots of internal changes in the way editor handles rendering.

Question: can I update GLC_Mesh in realtime? I provide coarse mesh right away after object was edited, but there's a background thread which will only supply high quality mesh in some time. I need to update GLC_Mesh and add new HQ LOD's to it once they arrive - do I need to re-create entire object, or there's some nicer way?


Fri May 10, 2013 8:55 pm
Profile
Site Admin

Joined: Sun Jan 03, 2010 4:27 pm
Posts: 390
Post Re: FoxWorks Aerospace Simulator Editor
Hello,
Impressive project. ;)
BlackPhoenix wrote:
Question: can I update GLC_Mesh in realtime? I provide coarse mesh right away after object was edited, but there's a background thread which will only supply high quality mesh in some time. I need to update GLC_Mesh and add new HQ LOD's to it once they arrive - do I need to re-create entire object, or there's some nicer way?

You need to re-create entire mesh. GLC_Mesh are design for static mesh. Not dynamic one...

A+


Sun May 12, 2013 10:49 pm
Profile

Joined: Fri May 10, 2013 12:34 pm
Posts: 5
Post Re: FoxWorks Aerospace Simulator Editor
Image

Started re-adding shaders. The scene is anti-aliased using FXAA - multisampling doesn't work on my laptop so I don't want to rely on it.

I have submitted a pull request on github, just minor problems I noticed.


Sat May 18, 2013 12:29 pm
Profile
Site Admin

Joined: Sun Jan 03, 2010 4:27 pm
Posts: 390
Post Re: FoxWorks Aerospace Simulator Editor
BlackPhoenix wrote:
I have submitted a pull request on github, just minor problems I noticed.

Thanks. Your changes have been quickly tested and incorporated into GLC_lib next branch.
:)
I like buttons into your OpenGL view. Can you tell me more about the technique you used to do that ?

@+


Sat May 18, 2013 12:51 pm
Profile

Joined: Fri May 10, 2013 12:34 pm
Posts: 5
Post Re: FoxWorks Aerospace Simulator Editor
laumaya wrote:
BlackPhoenix wrote:
I have submitted a pull request on github, just minor problems I noticed.

Thanks. Your changes have been quickly tested and incorporated into GLC_lib next branch.
:)
I like buttons into your OpenGL view. Can you tell me more about the technique you used to do that ?

@+


I can both tell and show! In fact, after I finished adding those buttons I looked into your next branch and realized that your example10 solved same problems I had before.

These buttons are simply widgets that are part of the QGraphicsScene. They are placed on a panel with custom geometry set for it, and background property set to transparent (see https://github.com/FoxWorks/FWE/blob/ma ... lscene.cpp)

Creation code:
Code:
   panel_control = new QWidget();
   panel_control->setWindowOpacity(0.7); //Makes this transparent
   panel_control->setLayout(new QHBoxLayout);
   panel_control->layout()->setSpacing(0); //All buttons placed together, no extra margins
   panel_control->layout()->setMargin(0);
   panel_control->setStyleSheet("#glview_ui_panel { background: transparent } QPushButton { min-width: 24; min-height: 24; }"); //I need 24x24 sized buttons
   panel_control->setObjectName("glview_ui_panel"); //Maybe there's some nicer way to do this, I didn't think of it yet
   scene->addWidget(panel_control);


Resize code (simply makes the panel minimum size possible and centers it):
Code:
void GLScene::geometryChanged(const QRectF &rect) {
   QSize minSize = panel_control->layout()->minimumSize();
   panel_control->setGeometry(rect.width()/2 - minSize.width()/2,rect.y()+4,
      minSize.width(),minSize.height());
}


There must be a nicer way to do this (maybe link own "sceneRectChanged" to "geometryChanged"), but I have just hacked it in for now. I think I want to customize the buttons so they don't pop out so much in the view...

Question: do you think it would be an interesting idea to add some sort of screen-wide shader support into GLC? It's a little piece of trivial code that essentially draws entire scene into 1-3 framebuffers, here's what it can be used for:
  • Fast anti-aliasing via FXAA - works on any machine, doesn't require any resources (it's a smart blur that removes aliased edges)
  • Outlines rendering - see my first screenshot. Outlines are rendered based on "triangle groups" or "smoothing groups" that are part of the mesh - each group is simply an array of triangles with same material (or added with one AddTriangles call). There must be a special rendering mode added which encodes each triangle group with an unique color - the outline shader is a simple edge detection filter.
  • Shader-based background - simply looks nicer and more smooth than a PNG image
  • Dynamic shadow like in SolidWorks - I can add a blurred shadow under the model, this only requires model to be rendered transformed into a quarter-size framebuffer. A shader will take care of the rest (blur).


Sat May 18, 2013 6:04 pm
Profile

Joined: Fri May 10, 2013 12:34 pm
Posts: 5
Post Re: FoxWorks Aerospace Simulator Editor
I have started working on this for GLC_lib, not sure if you'll find use in it. I hope you will!

This is how the model is rendered with the new flag I added - "glc::OutlineSilhouetteRenderFlag":
Image

Every smoothing group/triangle group is encoded uniquely through triangle group ID and the mesh ID. A simple edge detection shader then runs on this output, and this is what gets drawn to screen:
Image

Simply put, the shader puts two pixels everywhere, where neighboring pixels have different colors (sometimes subtly!). The X shape on the rectangle is simply a defect of my tessellation mechanism.

Additionally, later, the shader will also run a depth test (because right now some outlines which must be drawn according to rules would be omitted, e.g. in concave objects).

My plan is to add a (possibly) new element into GLC - something like "GLC_ScreenFramebuffer" or whatever. It's main goal will be merely drawing a screen quad with a user-defined shader OR with one of the predefined shaders (outline being one of them). What do you think? I would like your input on this, since you're the author.

Edit: I have later noticed you have already implemented pretty much what I want with rendering objects for selection - although I'm not really sure on how to proceed as it seems the code I want is buried underneath a lot of layers of other things. And that code does not include object ID into consideration, so outline is not drawn between some of the groups.

I really want to hear your opinion, as I'm thinking of leaving the "OutlineSilhouetteRenderFlag" flag OR maybe adding some mode to select primitives of any objects in the viewport? (if I'm not mistaken, right now it's only possible to select primitives of just one body). The latter would probably be more code, but would also be useful I suppose?

Edit 2: The functionality of outline silhouette is not same as that of selection rendering. For silhouette the scene must be rendered twice - first the front faces, then the back faces, it must include ID information of both primitives and the mesh that holds them, and the ID must be different for front and back faces to render convex meshes or cross-sections.

Here's what I got so far (this is all GLC_lib):
Image

Later this evening I have also added shadow shader (it's not very high quality yet, can be made more HQ):
Image


Sun May 19, 2013 12:06 am
Profile
Site Admin

Joined: Sun Jan 03, 2010 4:27 pm
Posts: 390
Post Re: FoxWorks Aerospace Simulator Editor
laumaya wrote:
Question: do you think it would be an interesting idea to add some sort of screen-wide shader support into GLC? It's a little piece of trivial code that essentially draws entire scene into 1-3 framebuffers, here's what it can be used for:
Fast anti-aliasing via FXAA - works on any machine, doesn't require any resources (it's a smart blur that removes aliased edges)
Outlines rendering - see my first screenshot. Outlines are rendered based on "triangle groups" or "smoothing groups" that are part of the mesh - each group is simply an array of triangles with same material (or added with one AddTriangles call). There must be a special rendering mode added which encodes each triangle group with an unique color - the outline shader is a simple edge detection filter.
Shader-based background - simply looks nicer and more smooth than a PNG image
Dynamic shadow like in SolidWorks - I can add a blurred shadow under the model, this only requires model to be rendered transformed into a quarter-size framebuffer. A shader will take care of the rest (blur).

Yes, I think that adding these new shader would be great.

A+


Tue May 21, 2013 7:53 am
Profile

Joined: Fri May 10, 2013 12:34 pm
Posts: 5
Post Re: FoxWorks Aerospace Simulator Editor
laumaya wrote:
Yes, I think that adding these new shader would be great.

A+


I will work on this then! In the meantime, here are some more screenshots:
Image

Image
Image
Image
Image
Image

I will think of some way to add this into GLC nicely. Maybe make an extension to viewport, or something like that.


Tue May 21, 2013 10:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.