SDS Bug Findings

User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

SDS Bug Findings

Post by clintonman »

I always thought the SDS suffered from a corruption bug, but it may not be a corruption at all.

There are 3 separate pieces of information stored in the mesh for subdivision. The sds level which controls how much geometry is generated to make the mesh smooth. A higher SDS level is more quads and smoother geometry. Different parts of the mesh can have different sds levels which translates to various smoothing levels. The sds edge weight is similar to how other programs handle sds creasing effects. A higher value brings the sds closer to the defining cage mesh giving it a hard line look and lower values moves the sds further away for a softer appearance. The sds vertex weights are not as straight forward to use. Each vertex sds weight seems to have an effect relative to each other. If you increase or decrease all the vertex weights there is no change in the sds surface. Change only some sds vertices and there is a big change. I looked but couldn't find any other program with these vertex weights. Must be unique to tS.

Different parts of the mesh can have different sds levels, 0,1,2,3,4 ...
Here's the trick. As you remove SDS levels from the mesh it would be expected to reduce them down to zero, but that's not happening. It seems that the SDS levels with lower values are actually going into the negative values. So when adding SDS levels back in those negative values are increasing above zero and becoming visible again, one by one. Also when adding them back in the first add has no visible effect. Behind the scenes it adds an SDS Filter node to the object and then subsequent adds will bring back the SDS levels.

The reset SDS function will remove all the data by default, but only if at least one of the SDS levels is above zero. So to operate you have to bring back at least one of the hidden sds levels and then reset sds can be used. The only reason for this requirement is because the toolbar button is disabled when there are no sds levels above zero. If the restriction was removed from the button the reset will always be available to work. Removing the "sds" value from the toolbar button TagAlias would remove the restriction making it possible for the reset sds to reset the mesh, where all the sds data is stored, even though there is no sds filter node inside the object. It may be better to change the TagAlias to "this is a geometry object" tag, I can't remember the name that is actually used for that case though. Changing this button would make the Remove SDS button of the Geometry Selection Utilities aka Fix Bad Geometry, obsolete.

The issue only shows itself if the mesh has different subdivision levels assigned to different parts. You never see it if the mesh has only a single sds level value throughout. However, the mesh will always have sds data on it until the reset sds is run on it, even if the sds levels are brought down to a uniform 0 value, the data is still embedded in the mesh. Flatten history also will not clear out the sds data stored in the mesh.

So the "stuck" sds values isn't corruption but an ordinary bug which can be easily "fixed" by changing the toolbar button.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: SDS Bug Findings

Post by trueBlue »

From a visual perspective, I see trueSpace's SDS a little different with regards to the Mesh
When you apply SDS, the object's Mesh is hooked up to a SDS Filter and this SDS Filter stores the Level(s), Edge, and Vertex weights
As far as I can tell, the Mesh does not have any SDS information
SDS Filter.png
.
If you wanted to manually Remove ALL of the SDS, you could Reconnect the SDS Filter's Mesh to the Editable shape's Mesh
Remove all SDS.png
Remove all SDS.png (8.33 KiB) Viewed 465 times
.
trueSpace's Reset SDS toolbar button is dependent on the state of the Mesh Editor Settings - Reset SDS aspect's three attributes
Reset SDS Levels
Reset SDS Edge Weights
Reset SDS Vertex Weights

For instance, if Reset SDS Levels is unchecked, Reset SDS does not remove any Level information from the SDS Filter
So, it is possible to remove the Weights without removing the SDS Levels

trueSpace's Remove SDS toolbar button will remove the SDS Filter
trueSpace's Reset SDS toolbar button does not remove the SDS Filter
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: SDS Bug Findings

Post by clintonman »

trueBlue wrote: 17 Jul 2023, 12:27 From a visual perspective, I see trueSpace's SDS a little different with regards to the Mesh
When you apply SDS, the object's Mesh is hooked up to a SDS Filter and this SDS Filter stores the Level(s), Edge, and Vertex weights
As far as I can tell, the Mesh does not have any SDS information
...
The SDS is stored in the mesh. The SDS filter is only for display.

Create a cube.
Add one level of SDS.
Copy the cube
add more SDS levels to one of the cubes.
If the data was stored on the SDS filter you would be able to move the SDS filter from one to the other and they would be identical.

The result is no change, because the data is in the mesh.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: SDS Bug Findings

Post by trueBlue »

That does not seem like a very good example, they both have a SDS filter
Using your example, Insert one of the Cubes Editable shape node to a Library
Add a Sphere
PE
Exit PE
Replace the Sphere's Editable shape with the one from the Library
Results: Sphere is now a Cube with no SDS
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: SDS Bug Findings

Post by trueBlue »

Another Example
Add a Cube
PE
Exit PE
Insert Editable shape into a Library
Add SDS
Insert Editable shape into a Library
Both Editable shape(s) are 28 KB
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: SDS Bug Findings

Post by clintonman »

trueBlue wrote: 17 Jul 2023, 15:52 Another Example
Add a Cube
PE
Exit PE
Insert Editable shape into a Library
Add SDS
Insert Editable shape into a Library
Both Editable shape(s) are 28 KB
A cube doesn't have enough vertices to see any difference.

Add a Torus
Set Latitude and Longitude to 250
PE
Exit PE
save Editable shape
Add SDS
save Editable shape

first editable shape 5473 KB
second 5861 KB
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: SDS Bug Findings

Post by clintonman »

trueBlue wrote: 17 Jul 2023, 15:37 That does not seem like a very good example, they both have a SDS filter
Using your example, Insert one of the Cubes Editable shape node to a Library
Add a Sphere
PE
Exit PE
Replace the Sphere's Editable shape with the one from the Library
Results: Sphere is now a Cube with no SDS
It's a cube with sds and no sds filter to show it.

sdk docs
"IRdSSEdgeWeightsStream
Stores edge weights for each triangle that are used during computation of subdivision surface.
The stream is part of IRdMesh..."
Edge weights are stored in the mesh.

"IRdSSVertexStream
Specifies per-vertex subdivision and vertex weight.
Elements are stored in RtVertexSubdivInfo structure.
The stream is part of IRdMesh..."
subdivision level and vertex weights are stored in the mesh.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: SDS Bug Findings

Post by clintonman »

Here is a sample scene with 2 cubes:
one plain
one with several sds levels and no sds filter
they both look identical

The script will add an sds filter and hook it up on both cubes

Only the sds cube will show sds, because the sds filter will read the mesh sds data and display it
Attachments
SDS Demo.RsScn
(460.12 KiB) Downloaded 37 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: SDS Bug Findings

Post by trueBlue »

Okay, I get it!
Thanks for confirming!
This is what I am proposing in the next UU
Reset SDS
Add:
Show SDS faces
Uncheck:
Reset SDS edge weights
Reset SDS vertex weights
Add: Reset SDS button
Add: SDS Toolbar
Note: Reset SDS toolbar LMB command "Opens the Reset SDS aspect panel in the Stack
All other SDS toolbar button commands unchanged
Reset SDS panel.png
.
Reset SDS button script

Code: Select all

if(!Node.Exists(Node.FirstSelected() + '/SDS filter')) {
System.Alert(Node.ShortName(Node.FirstSelected()) + ' does not have SDS')
return
}
if(Node.Exists(Node.FirstSelected() + '/SDS filter')) {
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {Cmd:"MeshModifiers.ResetSds('',-1,-1,-1);"});Activity.Run("Scripts/CustomCommands/Guard")
}
Edit: Need to add Remove SDS button
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: SDS Bug Findings

Post by clintonman »

trueBlue wrote: 17 Jul 2023, 16:42 Okay, I get it!
Thanks for confirming!
This is what I am proposing in the next UU
Reset SDS
Add:
Show SDS faces
Uncheck:
Reset SDS edge weights
Reset SDS vertex weights
Add: Reset SDS button
Add: SDS Toolbar
Note: Reset SDS toolbar LMB command "Opens the Reset SDS aspect panel in the Stack
All other SDS toolbar button commands unchanged
Reset SDS panel.png
.
Reset SDS button script

Code: Select all

if(!Node.Exists(Node.FirstSelected() + '/SDS filter')) {
System.Alert(Node.ShortName(Node.FirstSelected()) + ' does not have SDS')
return
}
if(Node.Exists(Node.FirstSelected() + '/SDS filter')) {
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {Cmd:"MeshModifiers.ResetSds('',-1,-1,-1);"});Activity.Run("Scripts/CustomCommands/Guard")
}
Edit: Need to add Remove SDS button
99% of the time reset would be run with default values. LMB opening the panel is a waste of time.
remove sds isn't needed at all if the reset sds button toolbar is patched to not be restricted to sds. also don't need the reset sds on the panel anymore. both are adding unnecessary complexity. unless you're doing something very specific with edge and vertex weights the panel won't be used at all.
reset sds does not need a guard
Clinton Reese

http://clintons3d.com
Post Reply