Menu

Rendering both sides of a patch object and boolean operation of simple geometries

Help
FangQ
2018-01-27
2018-01-29
  • FangQ

    FangQ - 2018-01-27

    Dear GLScene experts,

    thanks for developing this incredibly useful library. I could write 3D rendering
    applications without delving into OpenGL, it is so much easier with GLScene.

    I do have a couple of questions related to object rendering.

    first, if I create a patch-like object, like TGLDisk or TGLPolygon, I could only render
    one side of it, but when rotating to the back-side, it is completely invisible.

    I posted my question at Lazarus forum, one of the users suggestd to change
    GLView.Buffer.FaceCurlling setting, this does help, but it causes other issues,
    such as showing internal segments in semi-transparent objects.

    You can see my original question in this forum thread:

    https://forum.lazarus.freepascal.org/index.php/topic,39823.0.html

    I am wondering if there is a better way to show a patch object? I can replace
    a disk with a short cylinder, but I am not sure how to replace TGLPolygon.

    the 2nd question is related to creating booleans of multiple simple geometries
    (such as TGLSphere, TGLGrid, TGLCylinder etc). I was able to locate the CGS example
    for the TGLMeshObject, but I am not sure how to convert simple geometries to
    MeshObject.

    I posted this question in another thread at the Lazarus forum,
    love to hear your opinion how to make this possible

    https://forum.lazarus.freepascal.org/index.php/topic,39708.0.html

    thanks

    Qianqian

     
  • Jerome.D (BeanzMaster)

    Hi Qianqian, sorry not saw your post on FreePascal forum. For making CSG from TGLSphere, TGLCube you need to transform those objects into mesh before. For making this transformation you can use TGLFeedBack (see in sample) But i recommend you build directly your TGLMeshObject like Dicepd suggest you. You can also take a look at this https://sourceforge.net/p/glscene/discussion/93606/thread/44c2c3b7/2f3b/attachment/glfreeformex.pas for building FreeForm. Take also a look, in GLMeshBuilder unit

    Cheers

     

    Last edit: Jerome.D (BeanzMaster) 2018-01-28
    • FangQ

      FangQ - 2018-01-29

      thank you Jerome, the example is very helpful. looks like the TGLFreeFormEx.BuildMeshObjectFrom() function is exactly what I need.

      on a related note, I have been working 2D/3D mesh generation for a quite while, I know that it has been really difficult to perform surface boolean operations on overlapping/degenerated surfaces. I have been using Cork in the recent year (https://github.com/gilbo/cork) but still it fails when merging two co-planar surfaces. The old GTS library fails in even more cases.

      I am curious what underlying library does GLScene use for surface boolean operations? is this library robust enough for rigirous mesh processing, or it is for rendering purposes only (thus small errors is acceptable)?

       
  • Jerome.D (BeanzMaster)

    Sorry only answer to one question.

    I am wondering if there is a better way to show a patch object?

    What do you call Patch ? Bezier Patch ? Spline Patch ? Edges like sillouhette ?

     
    • FangQ

      FangQ - 2018-01-29

      By a "patch", I meant the basic objects like TGLDisk, TGLPolygon, TGLPlane etc, where it is an open-surface (not like a closed surface such as a TGLSphere or TGLCylinder).

       
  • Jerome.D (BeanzMaster)

    Ok i understand better

    I am curious what underlying library does GLScene use for surface boolean operations?

    GLScene use internal code no external lib. After tell you if it's robust like you want, don't say you must do some test yourself.

    For two siding lighting see in GLSceneBuffer options (in TGLSceneViewer) (sorry i can't check atm, ihaven't got glscene installed (i'm working on the next update)

    I am curious what underlying library does GLScene use for surface boolean operations? is this library robust enough for rigirous mesh processing, or it is for rendering purposes only (thus small errors is acceptable)?

    from GLMeshCSG unit :

    The CSG system uses BSP to optimize what triangles it considers.
    Its kept on a mesh basis to simplyfy things, it allways generates new BSP's,
    even if the meshes allready had BSP optimization.

    So surely some minors errors, but depends of the complexity of your mesh

     

    Last edit: Jerome.D (BeanzMaster) 2018-01-29

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.