following on from above.... a another scripted plugin cylinder (with proper mapping not the generic max stuff that fucks up the seams) with an added uv shearing for twisting effects
any for anyone interested.....
-- basic scripted cylinder without the uv seam issue and uv shearing
local incr = 360.0/sides; cs = for s = 0 to sides - 1 collect ( u = incr * s; [cos u, sin u]; )
-- create the geometry
mesh.NumVerts = nverts; mesh.NumFaces = nfaces;
local vi = 1, fi = 1, cap_seg_size = radius/capsegs, side_seg_size = height/sidesegs;
-- base cap verts
if cap_base then ( setvert mesh vi [0,0,0]; vi += 1; for seg = 1 to capsegs do ( r = cap_seg_size * seg; for s = 1 to sides do ( setvert mesh vi [r * cs[s].x , r * cs[s].y, 0]; vi += 1; ) ) )
-- side verts
local vsegbegin = if cap_base then 1 else 0; -- if base cap we already have the first set of side verts for seg = vsegbegin to sidesegs do -- side verts ( z = side_seg_size * seg;
for s = 1 to sides do ( setvert mesh vi [radius * cs[s].x, radius * cs[s].y, z]; vi += 1; ) )
-- top cap verts
if cap_top then ( for seg = capsegs - 1 to 1 by - 1 do ( r = cap_seg_size * seg; for s = 1 to sides do ( setvert mesh vi [r * cs[s].x , r * cs[s].y, height]; vi += 1; ) ) setvert mesh vi [0,0,height]; vi += 1; )
-- build the faces
local vi_offset = 1; if cap_base then -- base cap faces ( for s = 1 to sides do -- inner ring of triangles ( a = vi_offset + s; b = a + 1; if s == sides then b -= sides; -- wrap around
setface mesh fi [b,a, vi_offset]; setEdgeVis mesh fi 1 true; setEdgeVis mesh fi 2 true; setEdgeVis mesh fi 3 true; setFaceMatID mesh fi 1; setFaceSmoothGroup mesh fi 2; fi += 1; )
for seg = 2 to capsegs do -- all the following sidesegs are quads ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; if s == sides then b -= sides; -- wrap around c = a + sides; d = b + sides;
setface mesh fi [a,d,c] setEdgeVis mesh fi 2 true; setEdgeVis mesh fi 3 true; setFaceMatID mesh fi 1; setFaceSmoothGroup mesh fi 2; fi += 1;
setface mesh fi [a,b,d] setEdgeVis mesh fi 1 true; setEdgeVis mesh fi 2 true; setFaceMatID mesh fi 1; setFaceSmoothGroup mesh fi 2; fi += 1; ) vi_offset += sides; ) )
-- side faces
vi_offset = if cap_base then sides * (capsegs - 1) + 1 else 0; for seg = 1 to sidesegs do ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; if s == sides then b -= sides; -- wrap around c = a + sides; d = b + sides;
setface mesh fi [a,d,c] setEdgeVis mesh fi 2 true; setEdgeVis mesh fi 3 true; setFaceMatID mesh fi 3; setFaceSmoothGroup mesh fi 1; fi += 1;
setface mesh fi [a,b,d] setEdgeVis mesh fi 1 true; setEdgeVis mesh fi 2 true; setFaceMatID mesh fi 3; setFaceSmoothGroup mesh fi 1; fi += 1; ) vi_offset += sides; )
if cap_top then -- top cap faces ( for seg = 2 to capsegs do -- all the following sidesegs are quads ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; if s == sides then b -= sides; c = a + sides; d = b + sides;
setface mesh fi [a,d,c]; setEdgeVis mesh fi 2 true; setEdgeVis mesh fi 3 true; setFaceMatID mesh fi 2; setFaceSmoothGroup mesh fi 2; fi += 1;
setface mesh fi [a,b,d]; setEdgeVis mesh fi 1 true; setEdgeVis mesh fi 2 true; setFaceMatID mesh fi 2; setFaceSmoothGroup mesh fi 2; fi += 1; ) vi_offset += sides; )
for s = 1 to sides do -- last inner ring of triangles to finish off ( a = vi_offset + s; b = a + 1; if s == sides then b -= sides;
setface mesh fi [a,b,nverts]; setEdgeVis mesh fi 1 true; setEdgeVis mesh fi 2 true; setEdgeVis mesh fi 3 true; setFaceMatID mesh fi 2; setFaceSmoothGroup mesh fi 2; fi += 1; ) )
-- create the mapping verts and faces
sidesp1 = sides + 1; -- uvs don't wrap so it 1 extra for the seam ntverts = (sidesegs + 1) * sidesp1; if cap_base then ntverts += sides * capsegs + 1; if cap_top then ntverts += sides * capsegs + 1;
vi = 1; -- reset vert indexer local side_seg_uv_size = 1.0/sidesegs, cap_seg_uv_size = 0.5/capsegs;
if cap_base then -- base cap tverts ( setTVert mesh vi [0.5,0.5,0.0]; vi += 1; for seg = 1 to capsegs do ( r = cap_seg_uv_size * seg; for s = 1 to sides do ( setTVert mesh vi [0.5 + r * cs[s].x * cap_utile, 0.5 + r * cs[s].y * cap_vtile, 0.0]; vi += 1; ) ) )
shear = ushear as float/(sides * sidesegs); for seg = 0 to sidesegs do -- side tverts ( vshear = shear * seg; v = side_seg_uv_size * seg * sides_vtile; for s = 0 to sides do ( setTVert mesh vi [sides_utile * (vshear + s as float/sides as float), v, 0.0]; vi += 1; ) ) if cap_top then -- top cap tverts ( for seg = capsegs to 1 by - 1 do ( r = cap_seg_uv_size * seg; for s = 1 to sides do ( setTVert mesh vi [0.5 + r * cs[s].x * cap_utile, 0.5 + r * cs[s].y * cap_vtile, 0.0]; vi += 1; ) ) setTVert mesh vi [0.5,0.5,0.0]; vi += 1; )
-- uv faces
fi = 1; -- reset face indexer vi_offset = 1; if cap_base then -- base cap tfaces ( for s = 1 to sides do -- inner ring of tris ( a = vi_offset + s; b = a + 1; if s == sides then b -= sides; -- wrap around setTVFace mesh fi [b,a,vi_offset]; fi += 1; ) for seg = 2 to capsegs do -- any more sidesegs as quads ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; if s == sides then b -= sides; -- wrap around c = a + sides; d = b + sides; setTVFace mesh fi [a,d,c]; fi += 1; setTVFace mesh fi [a,b,d]; fi += 1; ) vi_offset += sides; ) )
-- sides tfaces
vi_offset = if cap_base then 1 + sides * capsegs else 0; for seg = 1 to sidesegs do ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; c = a + sidesp1; d = b + sidesp1; setTVFace mesh fi [a,d,c] fi += 1; setTVFace mesh fi [a,b,d] fi += 1; ) vi_offset += sidesp1; ) vi_offset += sidesp1; -- skip over last line of side tverts
if cap_top then -- top cap tfaces ( for seg = 2 to capsegs do -- any more sidesegs as quads ( for s = 1 to sides do ( a = s + vi_offset; b = a + 1; if s == sides then b -= sides; -- wrap around c = a + sides; d = b + sides; setTVFace mesh fi [a,d,c]; fi += 1; setTVFace mesh fi [a,b,d]; fi += 1; ) vi_offset += sides; )
for s = 1 to sides do -- inner ring of tris ( a = vi_offset + s; b = a + 1; if s == sides then b -= sides; -- wrap around setTVFace mesh fi [a,b,ntverts]; fi += 1; ) ) update mesh; )
on update do build_mesh(); on buildmesh do build_mesh(); )
I'm building a simple tool in python for maya to select edges two ways:
- select edges included between a minimum and maximum angle
- select hard edges in the mesh.
I think it can be useful to combine these two functions in the same ui. I modify a bit the constraints that are present in maya to make it easy to use.
i think it's a faster and easier way to select the edges you need than with the tools maya provide.
nice, i've done something similar as a mod in max, one additional feature you can add is the option to replace/add/subtract from the current selection (also an invert the selection can be sometimes useful).
some weekend twiddling led to 2 semi-scripted plugins (rely on some compiled code) for 2 different discs/cylinder ends with a more constant face density, one uses a regular grid fill the other a radial fill.
I figured out how to get Maya to name multiple objects correctly when parented or grouped and also not add an extra zero after 10 and 99 objects etc. I also put a name matching feature in for baking. Full video here if you're interested
Maya Scene Converter is a python-based Qt tool for converting scenes from a render engine to another in Maya, it is not a perfect conversion and it depends on rules files and how good they are but gives you a great head start.
Features
Creates rules to convert from a source render engine to a target render engine
Easy UI to create, save and load the rules
Supports all shading related nodes: Materials,Textures,Utilities and Lights
Converts all the scene or selected objects
Scans the scene for any node or only what belongs to the source engine
Some ready examples of rules files (not very precise but very functional)
Prints info about all conversions
Tested with Windows only but could work on other operating systems
Tested with Maya 2018+ but could work on previous versions
finished a script for maya i was working on some time ago. I think it could be useful in hard-surface workflows as it makes easier to select edges by an angle or other characteristics and then apply a crease that can be selected and uncreased. here's a demo of the script: https://youtu.be/pONjlLcJVBU
Hey folks, any of you had luck with exporting consistent Vector Displacement Maps from Zbrush, Blender(or others) to Unity or Unreal? Zbrush seems really inconsistent, even with their test scene; Blender is a bit troublesome, can't seem to get it working right.
We're exploring VDM's at Amplify with Amplify Shader Editorin Unity and, so far, it seems that Mudbox gives out the best results with the "Absolute Tangent" mode. You can really do some cool stuff with this when you couple it with Tessellation, even use it on skinned characters! Off course you can always do some pretty cool stuff with regular displacement, this is more of an alternative technique.
This is an exaggerated effect with an animated Tessellation amount, in a real world case you'd probably want to use a low poly base mesh closer to the mushroom in order to cut down on the Tessellation. The cool thing is that you pretty much get LOD control for free.
Here's how to set it up with Mudbox for Unity using Amplify Shader Editor(or any other shader/editor capable of handling the process), it even works with overlapping objects such as the mushroom patch bellow.
For those who don't know what's the big deal, here's a simplified comparison.
VDM is the shit in Mudbox, but I always found the limitation that to create the VDM you have to sculpt it out of a perfect tessellated quad to start makes the tool not really useful. If it was like a normal map or height map where you could bake an arbitrary mesh or collection of meshes onto a quad with different topology that would be very powerful.
VDM is the shit in Mudbox, but I always found the limitation that to create the VDM you have to sculpt it out of a perfect tessellated quad to start makes the tool not really useful. If it was like a normal map or height map where you could bake an arbitrary mesh or collection of meshes onto a quad with different topology that would be very powerful.
Yeah it's pretty cool!
That's the downside, it needs your subdiv levels so it can compare the lowest with the highest when baking the VDM; it would be awesome if we could just project a bunch of stuff. However, you should be able to use other meshes, just as long as you have the base level in Mudbox as well.
A cool trick is to create several VDM files and actually use them inside Mudbox to create more complex objects.
Yeah, fun to play with. For this one we went from quad to mushroom, carefully pushing/pulling the geometry to the center so it would have a decent amount to work with; somewhat worked but in hindsight probably should have used a low poly mesh . For the next one for sure.
AmplifyCreations: cool shader! There is a workaround for the VDM creation . Create the object first however you want it is. Then wrap the plane around the object and project the details. You can use shrinkwrap deformer in maya or conform to project. You can even use quad draw to make it conform manually.
I made a simple Maya script for a very particular situation tonight :P Something like this might be floating around somewhere but I wasn't able to find anything.
The script reads the current scenes grid, and saves it to user prefs. It also let's you see the changes immediately in the viewport and grid options box. This gif shows an example where the grid originally reads size = 24, spacing = 24 & divisions = 2. After the script is run, the options box updates to the scenes units which are size = 500, spacing = 500 & divisions = 2.
scratched an itch that been bugging me since about 2003 a Simple Line Shape.... it has length & number of segments and linear or smooth options and you can set the axis the knots are distributed along and the pivot position (either end or center). Sometime the built in "complex" editable line is overkill and is tricky to generate some stiuff and the rollout can be slow and clunky.
it was relatively quick and painless to implement.
scratched an itch that been bugging me since about 2003 a Simple Line Shape.... it has length & number of segments and linear or smooth options and you can set the axis the knots are distributed along and the pivot position (either end or center). Sometime the built in "complex" editable line is overkill and is tricky to generate some stiuff and the rollout can be slow and clunky.
it was relatively quick and painless to implement.
yay! my 50th max modifier (christ I need to get out more!)
CapSpline that works a bit better than the built in max one (edit mesh mod applied to the A on the left, mine of the right). Obviously showing the worst case for the built in max functionality
yay! my 50th max modifier (christ I need to get out more!)
CapSpline that works a bit better than the built in max one (edit mesh mod applied to the A on the left, mine of the right). Obviously showing the worst case for the built in max functionality
Congrats!
There are so many things in max that is not working appropriately, and most of them not even complicated to fix. I'll never understand why aren't they fix them. Like this one.
But anyway. It's so much better to look at the good one...
yay! my 50th max modifier (christ I need to get out more!)
CapSpline that works a bit better than the built in max one (edit mesh mod applied to the A on the left, mine of the right). Obviously showing the worst case for the built in max functionality
I want this more than I wanted toilet paper in March
seems like old ground and it is in a way created an Outliner interface to better integrate some of my tools.... basically anything with an "outline" mesh, spline or modifier can be can be used as a "cutter",
seems like old ground and it is in a way created an Outliner interface to better integrate some of my tools.... basically anything with an "outline" mesh, spline or modifier can be can be used as a "cutter",
a plane in plane
I'm still rooting for you Klunk Awesome to see something like this progressing. What do you think the performance of this would be on a 20k mesh with multiple cutters? Trying my hand at making a modifier that does something similar but with decals, still in progress. This sort of thing has so many applications . Thanks for continuing this work and posting, thought it might be a dead end since your post a while back lol.
Klunk, you could literally save people's lives, time and energy if you end up releasing this, even for a price. I'm sure the interest would be high. Hope it eventually happens, fantastic work by the way!
the trouble is it works well in application it's designed for and reasonably robustly at the moment, it doesn't work as well in a broader sense so too speak and to make it robust enough as a universal tool is still a lot of work
as for perfornance, it's wasn't programmed with it in mind but it does ok
max 2010 on a 6600 @ 2,4ghz and geforce 8800 gts
as you can see a few bugs to iron out on the A and e
In the context of game meshes it would be rare for one "cutter" to span an entire mesh and cross potentially thousands of tris. Instead details would be fairly local, with the exception of seams which i would handle differently than just projecting an outline. 20k is a good estimate for hero items like vehicles and large structural items or even first person weapons. If you're lucky to be able to use deferred rendering for a project you can take advantage of all the deferred decal awesomeness seen in star citizen/doom, but not all of us are that fortunate :P Which is why i'm so interested in the ability to cut into the mesh instead of floating
I've worked in deferred rendering for many years as an artist, it's still expensive to do lots of decals, I was surprised to see the amount of mesh decals in Star Citizen and Doom. When we were working on Gears 5 deferred decals were a per pixel cost so the more you have on screen the higher the cost, perhaps SC/Doom figured out an optimized mesh decal shader that helped them render so many?
I've worked in deferred rendering for many years as an artist, it's still expensive to do lots of decals, I was surprised to see the amount of mesh decals in Star Citizen and Doom. When we were working on Gears 5 deferred decals were a per pixel cost so the more you have on screen the higher the cost, perhaps SC/Doom figured out an optimized mesh decal shader that helped them render so many?
interesting. Given your experience what would you say is a reasonable amount of decals per scene? Sucks to hear it's that limited I'm not holding out hope of using deferred decals on our project any time soon tho, so we'll still be cutting in much of our detail.
It's just a matter of how many pixels they take up in screen space, so one huge decal will kill the performance. We were told to use them sparingly, I think in the hundreds per area not the thousands like I've seen in Doom. Alpha is really expensive in Unreal.
Getty creative with Vector Displacement Mapping, I wish we had better tools but I think we're making some progress with Mudbox and Zbrush. Obviously not for every project but it's super fun to play with. We now include a sample with our shader editor, really looking forward to see what ppl build.
Here's a sneak peak of another possible use, still a bit rough.
Multi layered impact decal/damage.
Tessellation can be taxing on older systems but the fact that LOD control is pretty much free is quite handy.
Sorry, one more! I promise it's the last one on VDM This time with a guide.
We were trying to create some more practical, a real-world example of sorts, so we went for wall damage but this could very well be adapted to other type of stuff, even using a cutout with some fancy shader to render it over something else. The cool thing about this is that you have multiple levels of debris, unlike regular displacement you extrude it on all axis, negative and positive directions.
We used Mudbox, Substance Painter and Amplify Shader Editor with Unity; we would love to see other ppl experiment with this as it can be done in other engines/tools.
another variant of one of my spline fill modifiers for max.... this time using a lofted spline.
been wanting to implement it for a while, but was put off by having to implement the control gizmo and not too keen on using another scene node. Then it struck me just add the lofting spline to the spline being filled and bobs yer uncle.... there's few more things I had to be wary of, it needs a kdtree to keep a min distance where the loft wants to bunch the verts (also good as it eliminates the chance of duplicate points which the delaunay triangulation code doesn't like)
scratched another itch.... reworked normalize spline to work on number of segments not (knot to knot length) also lets you only change just one curve in a shape (or all or selected)... there's some accumulation errors when segment count is high and it's quite a bit slower than the original but I can live with that.
scratched another itch.... reworked normalize spline to work on number of segments not (knot to knot length) also lets you only change just one curve in a shape (or all or selected)... there's some accumulation errors when segment count is high and it's quite a bit slower than the original but I can live with that.
Good stuff.. i feel like it wouldnt be too hard to adjust tangents to better match the original shape. Then again, might be missing the point
Nice! I should Google that algorithm - I implemented a version of this in ue4 a while back and never felt like it was done the right way - certainly wasn't elegant 😁
I have begun writing a pixel painter in the most unnecessarily awkward way i could think of (python, openGL and the pixels are generated with a geometry shader). You can't tell from the screengrab but the pixels are slowly spinning which is nice cos it makes your eyes go funny
I'm mainly doing this so i can better understand data transfer between bits of the rendering pipeline - not cos i want a pixel painter.
Future plans include switchable geometry and fragment shaders, saving images and one day a 3d view (cos why not complicate matters further). first things first though - it needs an eraser
cracked the fixed corners/bezier corners in my resample spline modifier
bloody infuriating sometimes working in max..... why would you set a bezier corner out vector to effectively a zero length vector why ? why ? it's not only making my life difficult but it makes it bloody tricky to edit for anyone else....
*and relax*
it works so well I'm going to have to add the max's length option to mine. A note about anyone using the Curve Fit code I mentioned previously you probably only need the least squares generate Bezier routine for this application theres very little to be gained from using the newton raphson reparameterization.
Replies
plugin simpleObject bcylinder
name:"bcyl"
classID:#(0x66e26f46, 0x18e211dc)
category:"Scripted"
(
parameters main rollout:params
(
height type:#WorldUnits default:25.0 ui:ui_height;
radius type:#WorldUnits default:25.0 ui:ui_radius;
sides type:#integer default:16 ui:ui_sides;
sidesegs type:#integer default:5 ui:ui_sidesegs;
capsegs type:#integer default:1 ui:ui_capsegs;
cap_top type:#boolean default:true ui:ui_cap_top;
cap_base type:#boolean default:true ui:ui_cap_base;
sides_utile type:#float default:1 ui:ui_sides_utile;
sides_vtile type:#float default:1 ui:ui_sides_vtile;
cap_utile type:#float default:1 ui:ui_cap_utile;
cap_vtile type:#float default:1 ui:ui_cap_vtile;
ushear type:#integer default:0 ui:ui_ushear;
)
rollout params "Params"
(
spinner ui_height "Height:" range:[0, 1e9, 0] fieldwidth:64 type:#WorldUnits align:#right;
spinner ui_radius "Radius:" range:[0, 1e9, 0] fieldwidth:64 type:#WorldUnits align:#right;
spinner ui_sides "Sides:" range:[3, 128, 5] fieldwidth:64 type:#integer align:#right;
spinner ui_sidesegs "Side Segs:" range:[1, 128, 5] fieldwidth:64 type:#integer align:#right;
spinner ui_capsegs "Cap Segs:" range:[1, 128, 5] fieldwidth:64 type:#integer align:#right;
checkbox ui_cap_base "Cap Base" align:#right vi_offset:[-5,0]; across:2
checkbox ui_cap_top "Cap Top" align:#right vi_offset:[10,0];
spinner ui_sides_utile "Sides U Tiling:" range:[0, 1e9, 1] fieldwidth:64 type:#float align:#right scale:0.01;
spinner ui_sides_vtile "Sides V Tiling:" range:[0, 1e9, 1] fieldwidth:64 type:#float align:#right scale:0.01;
spinner ui_cap_utile "Cap U Tiling:" range:[0, 1e9, 1] fieldwidth:64 type:#float align:#right scale:0.01;
spinner ui_cap_vtile "Cap V Tiling:" range:[0, 1e9, 1] fieldwidth:64 type:#float align:#right scale:0.01;
spinner ui_ushear "U Shearing:" range:[-2048, 2048, 0] fieldwidth:64 type:#integer align:#right;
)
tool create
(
on mousePoint click do
case click of
(
1:
(
nodeTM.translation = gridPoint;
height = radius = 0.0;
)
3: #stop
)
on mouseMove click do
case click of
(
2: radius = amax (abs gridDist.y) (abs gridDist.x);
3: height = gridDist.z
)
)
-- build a cylindrical mesh
fn build_mesh =
(
-- compute the number of verts and faces
local nverts = sides * (sidesegs + 1)
local nfaces = sidesegs * sides * 2;
if cap_base then
(
nverts += sides * (capsegs - 1) + 1;
nfaces += (1 + 2 * (capsegs - 1)) * sides;
)
if cap_top then
(
nverts += sides * (capsegs - 1) + 1;
nfaces += (1 + 2 * (capsegs - 1)) * sides;
)
-- cache the xy cos sin values
local incr = 360.0/sides;
cs = for s = 0 to sides - 1 collect
(
u = incr * s;
[cos u, sin u];
)
-- create the geometry
mesh.NumVerts = nverts;
mesh.NumFaces = nfaces;
local vi = 1, fi = 1, cap_seg_size = radius/capsegs, side_seg_size = height/sidesegs;
-- base cap verts
if cap_base then
(
setvert mesh vi [0,0,0];
vi += 1;
for seg = 1 to capsegs do
(
r = cap_seg_size * seg;
for s = 1 to sides do
(
setvert mesh vi [r * cs[s].x , r * cs[s].y, 0];
vi += 1;
)
)
)
-- side verts
local vsegbegin = if cap_base then 1 else 0; -- if base cap we already have the first set of side verts
for seg = vsegbegin to sidesegs do -- side verts
(
z = side_seg_size * seg;
for s = 1 to sides do
(
setvert mesh vi [radius * cs[s].x, radius * cs[s].y, z];
vi += 1;
)
)
-- top cap verts
if cap_top then
(
for seg = capsegs - 1 to 1 by - 1 do
(
r = cap_seg_size * seg;
for s = 1 to sides do
(
setvert mesh vi [r * cs[s].x , r * cs[s].y, height];
vi += 1;
)
)
setvert mesh vi [0,0,height];
vi += 1;
)
-- build the faces
local vi_offset = 1;
if cap_base then -- base cap faces
(
for s = 1 to sides do -- inner ring of triangles
(
a = vi_offset + s;
b = a + 1;
if s == sides then b -= sides; -- wrap around
setface mesh fi [b,a, vi_offset];
setEdgeVis mesh fi 1 true;
setEdgeVis mesh fi 2 true;
setEdgeVis mesh fi 3 true;
setFaceMatID mesh fi 1;
setFaceSmoothGroup mesh fi 2;
fi += 1;
)
for seg = 2 to capsegs do -- all the following sidesegs are quads
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
if s == sides then b -= sides; -- wrap around
c = a + sides;
d = b + sides;
setface mesh fi [a,d,c]
setEdgeVis mesh fi 2 true;
setEdgeVis mesh fi 3 true;
setFaceMatID mesh fi 1;
setFaceSmoothGroup mesh fi 2;
fi += 1;
setface mesh fi [a,b,d]
setEdgeVis mesh fi 1 true;
setEdgeVis mesh fi 2 true;
setFaceMatID mesh fi 1;
setFaceSmoothGroup mesh fi 2;
fi += 1;
)
vi_offset += sides;
)
)
-- side faces
vi_offset = if cap_base then sides * (capsegs - 1) + 1 else 0;
for seg = 1 to sidesegs do
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
if s == sides then b -= sides; -- wrap around
c = a + sides;
d = b + sides;
setface mesh fi [a,d,c]
setEdgeVis mesh fi 2 true;
setEdgeVis mesh fi 3 true;
setFaceMatID mesh fi 3;
setFaceSmoothGroup mesh fi 1;
fi += 1;
setface mesh fi [a,b,d]
setEdgeVis mesh fi 1 true;
setEdgeVis mesh fi 2 true;
setFaceMatID mesh fi 3;
setFaceSmoothGroup mesh fi 1;
fi += 1;
)
vi_offset += sides;
)
if cap_top then -- top cap faces
(
for seg = 2 to capsegs do -- all the following sidesegs are quads
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
if s == sides then b -= sides;
c = a + sides;
d = b + sides;
setface mesh fi [a,d,c];
setEdgeVis mesh fi 2 true;
setEdgeVis mesh fi 3 true;
setFaceMatID mesh fi 2;
setFaceSmoothGroup mesh fi 2;
fi += 1;
setface mesh fi [a,b,d];
setEdgeVis mesh fi 1 true;
setEdgeVis mesh fi 2 true;
setFaceMatID mesh fi 2;
setFaceSmoothGroup mesh fi 2;
fi += 1;
)
vi_offset += sides;
)
for s = 1 to sides do -- last inner ring of triangles to finish off
(
a = vi_offset + s;
b = a + 1;
if s == sides then b -= sides;
setface mesh fi [a,b,nverts];
setEdgeVis mesh fi 1 true;
setEdgeVis mesh fi 2 true;
setEdgeVis mesh fi 3 true;
setFaceMatID mesh fi 2;
setFaceSmoothGroup mesh fi 2;
fi += 1;
)
)
-- create the mapping verts and faces
sidesp1 = sides + 1; -- uvs don't wrap so it 1 extra for the seam
ntverts = (sidesegs + 1) * sidesp1;
if cap_base then ntverts += sides * capsegs + 1;
if cap_top then ntverts += sides * capsegs + 1;
meshop.setMapSupport mesh 1 true;
SetNumTVerts mesh ntverts;
buildTVFaces mesh; -- create our texture faces
-- uv verts
vi = 1; -- reset vert indexer
local side_seg_uv_size = 1.0/sidesegs, cap_seg_uv_size = 0.5/capsegs;
if cap_base then -- base cap tverts
(
setTVert mesh vi [0.5,0.5,0.0];
vi += 1;
for seg = 1 to capsegs do
(
r = cap_seg_uv_size * seg;
for s = 1 to sides do
(
setTVert mesh vi [0.5 + r * cs[s].x * cap_utile, 0.5 + r * cs[s].y * cap_vtile, 0.0];
vi += 1;
)
)
)
shear = ushear as float/(sides * sidesegs);
for seg = 0 to sidesegs do -- side tverts
(
vshear = shear * seg;
v = side_seg_uv_size * seg * sides_vtile;
for s = 0 to sides do
(
setTVert mesh vi [sides_utile * (vshear + s as float/sides as float), v, 0.0];
vi += 1;
)
)
if cap_top then -- top cap tverts
(
for seg = capsegs to 1 by - 1 do
(
r = cap_seg_uv_size * seg;
for s = 1 to sides do
(
setTVert mesh vi [0.5 + r * cs[s].x * cap_utile, 0.5 + r * cs[s].y * cap_vtile, 0.0];
vi += 1;
)
)
setTVert mesh vi [0.5,0.5,0.0];
vi += 1;
)
-- uv faces
fi = 1; -- reset face indexer
vi_offset = 1;
if cap_base then -- base cap tfaces
(
for s = 1 to sides do -- inner ring of tris
(
a = vi_offset + s;
b = a + 1;
if s == sides then b -= sides; -- wrap around
setTVFace mesh fi [b,a,vi_offset];
fi += 1;
)
for seg = 2 to capsegs do -- any more sidesegs as quads
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
if s == sides then b -= sides; -- wrap around
c = a + sides;
d = b + sides;
setTVFace mesh fi [a,d,c];
fi += 1;
setTVFace mesh fi [a,b,d];
fi += 1;
)
vi_offset += sides;
)
)
-- sides tfaces
vi_offset = if cap_base then 1 + sides * capsegs else 0;
for seg = 1 to sidesegs do
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
c = a + sidesp1;
d = b + sidesp1;
setTVFace mesh fi [a,d,c]
fi += 1;
setTVFace mesh fi [a,b,d]
fi += 1;
)
vi_offset += sidesp1;
)
vi_offset += sidesp1; -- skip over last line of side tverts
if cap_top then -- top cap tfaces
(
for seg = 2 to capsegs do -- any more sidesegs as quads
(
for s = 1 to sides do
(
a = s + vi_offset;
b = a + 1;
if s == sides then b -= sides; -- wrap around
c = a + sides;
d = b + sides;
setTVFace mesh fi [a,d,c];
fi += 1;
setTVFace mesh fi [a,b,d];
fi += 1;
)
vi_offset += sides;
)
for s = 1 to sides do -- inner ring of tris
(
a = vi_offset + s;
b = a + 1;
if s == sides then b -= sides; -- wrap around
setTVFace mesh fi [a,b,ntverts];
fi += 1;
)
)
update mesh;
)
on update do build_mesh();
on buildmesh do build_mesh();
)
EDIT: included link to script
https://github.com/mhdmhd/MayaSceneConverter
Maya Scene Converter is a python-based Qt tool for converting scenes from a render engine to another in Maya, it is not a perfect conversion and it depends on rules files and how good they are but gives you a great head start.
Features
Since i made the Megascan Link Plugin for Substance Designer i decided to the same for Substance Painter.
With the Megascan Link for Substance Painter plugin you can import Megascan Assets directly into an opened project or create one if you export from Quixel Bridge a Megascan Asset with a 3D mesh.
The plugin is completely Free and OpenSource, you can Download it here and you can find the complete Documentation here.
I think it could be useful in hard-surface workflows as it makes easier to select edges by an angle or other characteristics and then apply a crease that can be selected and uncreased.
here's a demo of the script:
Zbrush: Manual VDM Reference
Blender - Cycles - Tangent Vector & Scalar Displacement Map Baking Tutorial
We're exploring VDM's at Amplify with Amplify Shader Editor in Unity and, so far, it seems that Mudbox gives out the best results with the "Absolute Tangent" mode. You can really do some cool stuff with this when you couple it with Tessellation, even use it on skinned characters! Off course you can always do some pretty cool stuff with regular displacement, this is more of an alternative technique.
This is an exaggerated effect with an animated Tessellation amount, in a real world case you'd probably want to use a low poly base mesh closer to the mushroom in order to cut down on the Tessellation. The cool thing is that you pretty much get LOD control for free.
Here's how to set it up with Mudbox for Unity using Amplify Shader Editor(or any other shader/editor capable of handling the process), it even works with overlapping objects such as the mushroom patch bellow.
For those who don't know what's the big deal, here's a simplified comparison.
That's the downside, it needs your subdiv levels so it can compare the lowest with the highest when baking the VDM; it would be awesome if we could just project a bunch of stuff. However, you should be able to use other meshes, just as long as you have the base level in Mudbox as well.
A cool trick is to create several VDM files and actually use them inside Mudbox to create more complex objects.
The script reads the current scenes grid, and saves it to user prefs. It also let's you see the changes immediately in the viewport and grid options box. This gif shows an example where the grid originally reads size = 24, spacing = 24 & divisions = 2. After the script is run, the options box updates to the scenes units which are size = 500, spacing = 500 & divisions = 2.
<div>import maya.cmds as cmds</div><br><div>S = cmds.grid( q = True, s = True)</div><div>SP = cmds.grid( q = True, sp = True)</div><div>D = cmds.grid(q = True, d = True)</div><br><div>#converting grid values to a string for UI.</div><div>currGrid = ('Size = ' + str(S) + '\nSpacing = ' + str(SP) + '\nDivisions = ' + str(D))</div><br><div># create dialog window</div><div>updateGrid = cmds.confirmDialog(</div><div> title='Save Grid Settings',</div><div> message= 'Scene Grid Settings:' + '\n' + currGrid + '\n' + '\nPress OK to save these settings to User Preferences\n ',</div><div> button=['OK', 'Cancel'],</div><div> defaultButton='OK',</div><div> cancelButton='Cancel')</div><br><div># Store scene settings in the user prefs file.</div><div>if updateGrid == 'OK':</div><div> cmds.optionVar(fv=('gridSpacing', S))</div><div> cmds.optionVar(fv=('gridDivisions', D))</div><div> cmds.optionVar(fv=('gridSize', S))</div><div> </div><div> cmds.savePrefs(g = True) # Without this maya won't save above changes until restart.</div><br><div> print '\nSaved!!!'</div><div>else:</div><div> print '\nOperation Aborted'</div>There are so many things in max that is not working appropriately, and most of them not even complicated to fix. I'll never understand why aren't they fix them. Like this one.
But anyway. It's so much better to look at the good one...
I'm still rooting for you Klunk
Here's a sneak peak of another possible use, still a bit rough.
Multi layered impact decal/damage.
Tessellation can be taxing on older systems but the fact that LOD control is pretty much free is quite handy.
We were trying to create some more practical, a real-world example of sorts, so we went for wall damage but this could very well be adapted to other type of stuff, even using a cutout with some fancy shader to render it over something else. The cool thing about this is that you have multiple levels of debris, unlike regular displacement you extrude it on all axis, negative and positive directions.
We used Mudbox, Substance Painter and Amplify Shader Editor with Unity; we would love to see other ppl experiment with this as it can be done in other engines/tools.
I'm mainly doing this so i can better understand data transfer between bits of the rendering pipeline - not cos i want a pixel painter.
Future plans include switchable geometry and fragment shaders, saving images and one day a 3d view (cos why not complicate matters further).
first things first though - it needs an eraser