Modeler plugin with Vertex Normal vmap related tools for LightWave
Modeler v9.5 or newer.
Currently this plugin is focused around smooth group functionality. It
provides commands to assign smooth groups to polygons and to
update/generate a vertex normal map with normals based on the assigned
smooth groups.
Commands provided by this plugin:
- PB Set Smooth Groups...
- PB Select By Smooth Group...
- PB Update VNormals
- PB Clear VNorms From Verts
- PB Clear VNorms On Surfs
Smooth Groups Overview
For proper normal generation the plugin assumes that polygons are
convex and planar, and it only processes polygons with at least 3 points. If
other polygons are involved then that may cause incorrect vertex
normals.
For smooth groups to apply between surfaces, there has to be
regular surface based smoothing between them. You can then control if
you actually want smoothing or not by smooth group
assignment. The other way around is however not possible. You can't
force smooth group based smoothing between polygons that wouldn't be
smoothed by LW's standard smoothing.
There are 16 smooth groups. However you'll notice that there are
two button rows, so each smooth group button has an upper and lower
half, similar to the layer buttons in Modeler. Using the upper half,
which hilights
the entire button, will work
as one would expect smooth groups to typically work. Those will be
referred to as "active" smooth groups.
The lower half are so called "passive" smooth groups. If a
polygon has a passive smooth group assignment it means that the polygon
will affect smoothing of vertex normals of adjacent polygons with
active smooth group assignment to the same group, but the active
polygons will not affect the normals of the passive polygon.
If
you only intend to use
"classic" smooth
group functionality then you can skip the remainder of this section, as
it's only relevant to understanding passive smooth groups.
What this means in practice
is that you can ensure a certain polygon remains flat, vertex normals
point
in the same direction as the polygon normal, while adjacent polygons
are smoothed to meet up with the flat polygon. As opposed to normal
smoothing between surfaces where the vertex normal ends up as an
average between the polygons.
It's also possible to have a set of polygons to have active smoothing
between them, while using that smoothed result to act as a passive
smoothing source of other actively smoothed polygons. More on that a
bit later.
In situations where several polygons, with a mix of passive and active
smooth groups, share vertices it can get a little complicated and take
some practice how to do assignments. It helps to roughly understand the
calculation process.
Normally, for active groups, all polygon normals in the same group are
averaged together to get a smoothed vertex normal. However if a
polygon with a passive group is involved, the vertex normal
will be "locked" to the passive contributor's normal, so that any
actively smoothed neighbor polygons will be smoothed to meet up with
the passive polygons.
Where it gets a bit complicated is that you may
want to some polygons to be smoothed between them, but then have that
resulting
smoothing act as a passive source towards other adjacent polygons.
Imagine a capsule
shape, where you'd like the cylinder part to be smoothed between the
cylinder polygons only, so that normals are flat along the cylinder
axis. But
you'd like the hemispherical caps to be smoothed so they meet up with
the cylinder portion.
This can be achieved by making the cylinder polygons be part of the
same active smooth group of a higher number, say 2, but also have a
passive group assignment of any lower number, in this case 1. The
hemispherical cap polygons are then actively assigned to group 1, which
makes them smooth between themselves but also makes sure that they
smooth towards the cylinder polygons where those are adjacent.
The way that works is because the groups are processed a bit like
layers or passes, where the higher the
group number, the higher the priority. During processing it starts with
the highest group number and works downward.
So in the capsule example above,
the active smoothing for group 2 is processed first. That makes the
cylinder polygons smooth circular around the axis, but with no
smoothing along the axis since the cap polygons don't interact with
group 2. Then during the next pass, group 1 is processed.When a cap
polygon with active smoothing is adjacent to a cylinder polygon, with
passive smoothing in group 1, the vertex normals from the previous pass
(i.e. group 2) are used.
Command: PB Set Smooth Groups...
Assign or remove smooth groups to selected polygons. If no polygons are
selected then the command applies to all polygons in the FG layers.
When the dialog displays, the initial button states will reflect the
smooth groups used by the current selection. In the image above this
would mean that all polygons in the selection have active group 1 and
passive group 3 assigned to them. For the groups 5 to 8 there are mixed
assignments, visualized by the light grey borders on the buttons. The
different mixed state visualizations (in above image) mean the
following:
Group
5 |
There are polygons with active
smooth group 5, and polygons without any assignment to group 5. |
Group
6 |
There are polygons with passive
group 6, and polygons without any assignment to group 6. |
Group
7 |
There are polygons with active
group 7, polygons with passive group 7, and polygons without any
assignment to group 7. |
Group
8 |
There are polygons with active
group 8 and polygons with passive group 8. There no polygons that without any group 8 assignment at all. |
Leaving mixed-state buttons unchanged, when clicking OK, will leave the
smooth group assignments for those particular groups unchanged in the
polygons as well. Using the above image as en example, if you were to
toggle the passive group 3 button off and the clicked OK, it would
remove the passive group 3 assigment from all polygons, but leave all
other group assignment as they were.
Keyboard hotkeys can also be used for the group buttons. They are the
same as the layer hotkeys in LW. The number keys 0 - 9 (not the numeric
key pad), hold SHIFT for passive groups. To access groups 11 - 16 you
have to hold the CTRL key.
Description of the other buttons in the dialog:
History
|
A list of the last couple of
smooth group assigments. Keyboard shortcut PageUp can also be used to
move up through the history.
The list looks like the one below for "Used", except it doesn't have
any polygon counts.
|
Used
|
A list of all smooth group
combinations that are in use, i.e. assigned, to all polygons in the FG
layers.
The entries consist of a list of active smooth groups followed by a
list of passive smooth groups, separated by "::". The values in parentheses at
the end are the number of polygons that use that
particular smooth group combo.
|
Clear
All
|
Clear all buttons.
|
Update
VNorms |
If enabled, automatically
performs the same task as the "PB Update VNormals" command when the
dialog is closed with OK.
|
Command: PB Select By Smooth Group...
Select polygons based on smooth group assignments.
"
Select" will select polygons
that have any matching group assigment(s), while "
Select SG Combo" will only select
polygons that have the exact same smooth group combination as specified.
This dialog only displays group buttons for groups that are actually
used by any polygons. If there are no smooth group assignments at all
to any polygon then all buttons will be disabled. The dialog will still
open and allow "Select SG Combo", which will select polygons without
any smooth groups.
Just like with the "PB Set Smooth Groups" group buttons, the upper half
of the buttons are active smooth groups and the lower half are passive
smooth groups. Except both active and passive can be selected
independently from eachother in this dialog, in order to make it
possible to specifically select passive and/or active groups.
If only a single polygon is selected, when invoking this command, then
the dialog will automatically set the group buttons to reflect the
group assignments of that polygon. Making it easier to quickly select
all
polygons that have the same smooth groups as the selected polygon.
The "
Used" button is the same
as for the "PB Set Smooth Groups" command.
If "
Clear Selection" is enabled
then any previous selection is cleared, otherwise any new selections
are
just added.
The "
A | P" button pairs are quick select buttons to set or clear all group buttons. Clicking the left
A set all active group buttons, and
P for all passive group buttons. The right A and P buttons clear all active or passive groups buttons.
The hotkeys for group buttons are the same as described for "PB Set
Smooth Groups", but there's additionally
CTRL+a which sets all passive and active group buttons, and
CTRL+i which inverts the buttons.
Command: PB Update VNormals
Update/Create the vertex normal map, named "
PB_VNormals", with vertex
normals based on smooth groups (and surface smoothing).
Automatically assigns the map to all involved surfaces that do not have
any "Vertex Normal Map" set yet. If a surface already has some other
map set, then you have to manually change it to "PB_VNormals" if you
want it to use that.
This command ignores polygon selections and updates all polygons in the
FG layers.
Command: PB Clear VNorms
From Verts
Works like the regular "Clear Map" command in Modeler, but operates on
the "PB_VNormals" vertex normal map.
Command: PB Clear VNorms
On Surfs
Sets "Vertex Normal Map" to "None" on all surfaces that are set to
"PB_VNormals".
Copyright Notice
Copyright © 2018 Georg Fischer
This software is provided 'as-is',
without any express or implied warranty. In no event will the
author be held liable for any damages arising from the use of this
software.
Permission is granted to anyone to use this software for personal
projects, commercial projects, and redistribute it freely, subject to
the following restrictions:
- The origin of this software must not be misrepresented; you must
not claim that you wrote the original software.
- This notice may not be removed or altered from any distribution.
- This software may not be sold individually or as a part of a
package.