[x3d-public] v4 > PointProperties
GPU Group
gpugroup at gmail.com
Fri Apr 17 14:28:00 PDT 2020
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD1/
- v4 > draft 1 > Shape Component > PointProperties
I implemented draft PointProperties in freewrl.
-Doug Sanden
my experience implementing v4 Draft PointProperties in freewrl:
Results:
http://dug9.users.sourceforge.net/web3d/tests/points/screenshot_pointproperties_polypoint2d.jpg
http://dug9.users.sourceforge.net/web3d/tests/points/pp_polypoint2D.x3d
http://dug9.users.sourceforge.net/web3d/tests/points/screenshot_paintproperties_pointset.jpg
http://dug9.users.sourceforge.net/web3d/tests/points/pp_pointset.x3d
Implementation
It was a lot like ParticleSystems sprites, which freewrl implemented a few
years ago, and basically:
- instead of GL_POINTS you send a little quad -2 triangles GL_TRIANGLES-
with normals and texture coords
- then go into a loop over vertices and update the vertex shader with the
vertex position via a uniform and draw()
And when there's a color node, or fogCoords node, I treat it like I do the
vertices - send one at a time in the loop via uniform, to the vertex shader.
But that loop seems a little inefficient if someone has a massive amount of
points to render and all they want is something simple. so I put some
effort into thunking to GL_POINTS when no PointProperties node.
SPEC COMMENT >>>>>
I found it an easier transition (from LineProperties linewidthScaleFactor
to PointProperties pointSizeScaleFactor) if colorMode default was
POINT_COLOR instead of TEXTURE_AND_POINT_COLOR
- then the other defaults can be ignored except pointsizeScaleFactor
- otherwise if there's no way/trigger/signal to ignore pointSizeMinValue
pointSizeMaxValue then you may have to change those 2 from defaults 1,1
every time you change your pointSizeScaleFactor
<<< SPEC COMMENT
Internally I have 4 methods for drawing points:
0 - default GL_POINTS method
1 - SCREEN SCALE - simplified, ignores pointsizeMinValue,pointSizeMaxValue
(no clamping) and ignores attenuations
2. OBJECT SCALE - interprets pointSizeScaleFactor in object space, so
points look smaller in the perspective distance
3. ATTENUATION SCALE - uses attenuations and min/max clamping in screen
scale
methods 1,2,3 use the particle system sprite method
if we have a PointProperties node, then it does one of method 1,2,3 else
method 0.
I work out which method based on some logic with min,max and attenuation
settings
https://sourceforge.net/p/freewrl/git/ci/develop/tree/freex3d/src/lib/scenegraph/Component_Shape.c
L.1182 in compile_PointProperties
ScreenScale: attenuation == 1 0 0 and minScale == maxScale
ObjectScale attanuation == 0 1 0 and minScale << maxScale
AttenuationScale - everything else
Then in the vertex shader I do if else on this to get slightly different
scaling formula
https://sourceforge.net/p/freewrl/git/ci/develop/tree/freex3d/src/lib/opengl/Compositing_Shaders.c
L.884 in POINTP block
The frag shader needed a bit of work to get the logic the specs wanted.
L1560 in POINTP block
It took me 4 days to implement PointProperties in freewrl.
- that doesn't count 13 days to improve FillProperties and LineProperties
which were under-developed
https://sourceforge.net/p/freewrl/mailman/message/36970701/
- fillproperties notes
https://sourceforge.net/p/freewrl/mailman/message/36980373/
- lineProperties notes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200417/e4bef519/attachment.html>
More information about the x3d-public
mailing list