Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

implementing "subsurf-mode" for sculpties into client ?

Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
05-20-2009 02:15
Hi.

I just got this weird idea of using the sculpt-map content as "control-points" instead of using it as vertex-locations.

I came to this idea while playing with subsurf mode in blender. Imagine that the SL-object-editor gets an additional checkmark named "smooth mesh". When it is checked, the viewer adds intermediate mesh points and interpolates the locations forming a smooth surface (using the Catmull-Clark algorithm ?).

In addition the alpha-channel could be used to hold weight information about the level of influence assigned to the corresponding controlpoints (Crease?).

pro 1: sculpties can become much smoother
pro 2: would not break existing content (default setting: checkmark disabled)
con 1: enabling this feature would potentially add to lag (more mesh points).

Does it make sense to add this idea as enhancement request to Jira ?
Or are there backdraws which i do not see and which would turn this into a bad idea ?

Another related idea would be to keep the number of vertices, but use the alpha channel to add some sort of "displacement-weight along the vertex normal". so that the vertex can move slightly along the normal and allow more precise shapes. Probably no new idea i guess ?
Happyfish Infinity
blenderer
Join date: 29 Aug 2007
Posts: 1
05-20-2009 03:12
I've often thought it would be great to have other inworld modifiers. In addition to sub-surfing, being able to bend or taper, or to make cuts to show only portions of the sculptmap would add so much versatilty from a single map, which would surely save on resources...
Drongle McMahon
Older than he looks
Join date: 22 Jun 2007
Posts: 494
05-20-2009 05:38
First let's have a toggle for planar shading ... so we can really have sharp edges.

I thought the alpha channel was already slated for use to define flexiness (otherwise known as lagginess).

If not, it could be used either for varying shading control over the vertices, or, my favourite, use 2 bits x 3 for better accuracy of vertices, one for exclusion of unwanted vertices, and one for shading method toggle.

Of course you can have more alpha layers. the source code seems to use a variable to define the "components" of the map ... so I imagine that could be more than 4. Might not get through the image code though.
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
05-20-2009 15:16
From: Gaia Clary

pro 1: sculpties can become much smoother
con 1: enabling this feature would potentially add to lag (more mesh points).


I doubt that LL would go for anything that added more mesh points. Also, I think subsurf is best left to the modeling tool where you would have more control.

The Pro is that sculpties can become smoother, but there are two underlying factors that determine smoothness: the number of vertices and the precision with which they can be placed.

The subsurf idea increases smoothness by attacking both of these. It adds vertices and it increases precision.

But I think we have enough vertices in most cases, particularly with oblongs. The biggest impediment to smoothness appears to be low precision which is a consequence of encoding the pixels using only 24-bits.

So, I'm with Drongle. Give us more bits per pixel.
_____________________
Prim Composer for 3dsMax
-- complete offline builder for prims and sculpties in 3ds Max
http://liferain.com/downloads/primcomposer/

Hierarchical Prim Archive (HPA)
-- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools.
https://liferain.com/projects/hpa
Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
08-22-2009 02:04
From: Shack Dougall
I doubt that LL would go for anything that added more mesh points. Also, I think subsurf is best left to the modeling tool where you would have more control.

The Pro is that sculpties can become smoother, but there are two underlying factors that determine smoothness: the number of vertices and the precision with which they can be placed.

The subsurf idea increases smoothness by attacking both of these. It adds vertices and it increases precision.

But I think we have enough vertices in most cases, particularly with oblongs. The biggest impediment to smoothness appears to be low precision which is a consequence of encoding the pixels using only 24-bits.

So, I'm with Drongle. Give us more bits per pixel.


As you mention the main problem is the sculptmap resolution and getting more bits per pixel would be an option. On the other side i guess, that a "smooth" button (plus maybe a smoothing-slider, e.g. from 0 to 100 %) could be an option to actually save pixels instead of increasing pixel count... let me explain why:

As the allowed vertex locations are on a 256*256 grid we typically need to add a lot of work in order to "fit a sphere into a square". The best results are always achieved when the particular sculptie just "happens to be defineable within the grid". Now very often we do not need more vertices, we just need a finer control over the vertex locations. Here is an example:

The follwing 4 cylinders have been made out of meshes with 4, 8, 16 and 32 faces along the x axis:

So they pretty much look identical. The trick is: The vertex locations are calculated with floating point numbers.

Here is the mesh:



Now i have applied a vertex subdivision to all 3 cylinders, where i added 3 levels of subdivision to the lowest cylinder, 2 levels to the next higher cylinder and 1 level to the one just below the topmost cylinder:



It becomes very hard to see the differences...

So what is the conclusion:

1.) If we where allowed to place our vertices with higher precision, we would need less vertices to achieve smooth results. (Maybe better: We would need less work to arrange the vertices...)

2.) If we had a smoothing option, we would need less vertices to define the model.

3.) If we keep the current vertex position limitations, but add smoothing where the intermediate vertices could be placed outside of the sculptgrid limitations (precise calculation of the catmull-clark locations) we could possibly save half of the needed vertices (or even more).

Let me explain point 3.) : Assume, we had the low level model using only 4 faces along x (better said: 'U'). Then lets apply 1 level of smoothing. We would end with 8 faces in U. But due to the automatic fine placement of the calculated vertices we get rid of the so often seen jaggy surfaces of sculpties. Look at the first image above and there at the 2nd cylinder from the bottom. It is almost perfect! 8 faces compared to 32 faces used by a standard sculpty: 4 times less faces -> ~4 times less vertices for that dimension. If you apply the same thoughts to the other axis (V), you could easily end up in ~8 times less vertices with increased quality of appearance.

I know, this is a bit idealistic and needs more thinking. Especially it might be interesting to limit the subdivision mode to one axis (U or V) to avoid unnecessary creation of vertices where they are not at all needed.

Please feel free to take this contribution as a starting point for some more thinking. Maybe someone would even be able to add the subdivision mode to the viewer-sources just to play with it ? I don't know how to do that sort of programming :( but i am pretty sure, that adding such an option just on the viewer side could become very interesting without breaking the current implementation of sculpties at the backend side ;-)

thanks for your attention.

have a god time
Gaia
Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
08-22-2009 04:29
After doing a bit of dish cleaning i got the following vision :D

- Interpret the sculptmap as map of control points (see #1 above)
- Depending on the number of control points in the map, allow for subdivision:

Examples (-U- is number of X-Faces, -V- is number of Y-Faces):

-U- | -V- | effect on the sculpty
------------------------------------------------------------------
032 | 32 | keep as it is right now
064 | 16 | dito
128 | 08 | dito
256 | 04 | dito
-------------------------------------------------------------------
016 | 32 | allow one level of subdivision on x-faces
008 | 32 | allow 2 levels of subdivision on x-faces
004 | 32 | allow 3 levels of subdivision on x-faces
004 | 04 | allow 3 levels of subdivision on x and y
-------------------------------------------------------------------

Then add a "smooth slider" where:

smooth: 0 -> use simple (linear) subdivision (or define the level of "Crease" ?)
smooth: 100 -> use catmull-clark smoothing

And while i am driving wild now, here is my final phantasy :cool:

Add a selector "surface control":

none -> map is vertex map (today's behaviour)
smooth -> map is map of control points for Catmull-Clark calculation
NURBS -> map is map of control points for a NURBS (maybe hogwash?)

Summary

The proposal described here would allow to keep the maximum number of vertices as it is today. It will furthermore allow to use floatingpoint precision for the actual vertex points, while the sculptmap itself is "only" the control mesh. Furthermore it will give good reasons to use smaller mesh sizes when smooth sculpties are an issue.

The major modifications for such a development would probably have to take place on the viewer, while some control information would be needed on the backend side in order to propagate the sculpty-settings (surface control and number of subdivisions per uv axis) to the clients.