Recent

Author Topic: GLScene hidden line removal in meshmode.  (Read 5503 times)

dicepd

  • Full Member
  • ***
  • Posts: 163
GLScene hidden line removal in meshmode.
« on: August 26, 2017, 09:32:08 pm »
I am trying to work out how to get hidden line removal working when showing a mesh in meshmode as seen in example screenshot, of my test app.



Peter
Lazarus 1.8rc5 Win64 / Linux gtk2 64 / FreeBSD qt4

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: GLScene hidden line removal in meshmode.
« Reply #1 on: August 27, 2017, 12:09:04 am »
A simple solution could be:
  • set up an array of 'lowest Y-coordinates'
  • sort all line segments by Y-coordates
  • start drawing from low Y to high Y, updating the array accordingly. Only draw line segments when above the 'lowest Y coordinate'
'Lowest Y' in this context means lowest on the screen.
« Last Edit: August 27, 2017, 12:13:57 am by eny »
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

dicepd

  • Full Member
  • ***
  • Posts: 163
Re: GLScene hidden line removal in meshmode.
« Reply #2 on: August 27, 2017, 08:12:05 am »
I really should use google for programming searches not DuckDuckMissed!

It appears the GLScene way of doing this is to use a shader on a material in a material library( shaders can only be attached to materials in libraries, not the material directly on the scene object) and use that material for your scene object.

Peter
Lazarus 1.8rc5 Win64 / Linux gtk2 64 / FreeBSD qt4

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: GLScene hidden line removal in meshmode.
« Reply #3 on: August 27, 2017, 10:01:19 am »
Hi you can simply using the TGLHiddenLine Shader component see samples\renderinglining demo or take a look in examples\editors\scenemaster


dicepd

  • Full Member
  • ***
  • Posts: 163
Re: GLScene hidden line removal in meshmode.
« Reply #4 on: August 27, 2017, 10:23:16 am »
Thats what I ended up doing after finding a very old mailing list post pointing to the multipass example. Though I have done it in code rather than using a component which I did not know existed. It's been 20 years since I did any GL in anger ( my Red Book is 1993 edition), much has changed since then, trying to catch up.

Ypu may be interested in this class, Jerome, its loosly based on your meshbuilder but handles quads and tris with no dup vertices except at edges. I am just adding edge reporting and display and will post it in this forum.

Peter 
Lazarus 1.8rc5 Win64 / Linux gtk2 64 / FreeBSD qt4

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 268
Re: GLScene hidden line removal in meshmode.
« Reply #5 on: August 27, 2017, 01:12:51 pm »
Thanks Peter, i'll add in GLScene if you are agree.

Quote
Thats what I ended up doing after finding a very old mailing list post pointing to the multipass example. Though I have done it in code rather than using a component which I did not know existed. It's been 20 years since I did any GL in anger ( my Red Book is 1993 edition), much has changed since then, trying to catch up.

Yep, and it's not finish. Actually i'm working on a new version of GLScene (Named GLZScene) it will only work under Lazarus at this stage it will use  OpenGL Core,  Vulkan and also  a little internal Software Render Engine. For now, i'm working hard on a Fast Bitmap replacement (merge with the GraphicEx loading/saving capacities, resample, fx....)
In the next, the 3D Objects will building from derivated of GLMeshObjectHelper unit. So It will be very useful  :) 8-)


 

TinyPortal © 2005-2018