[Closed] Challenge for a plugin Developer
Take a look at this thread…
http://muforums.org/forums/thread-119-post-715.html#pid715
The problem is, if you use procedural maps and want to apply this procedural to instanced geometry, the texture will look the same because its objectXYZ will be the same. You can switch to WorldXYZ instead but then if you animate these objects the textures will swim. You can make hundreds of copies of the material with different XYZ Offset values but this is also inefficient.
It would be good if there was an equivalent of an UVWXForm Modifier but for ObjectXYZ coordinates.
The other way of working with a mapping channel instead is fine unless youre working with CAD data for example.
Solving it with a UVWXForm is not problem.
- Add a UVWMap modifier to your object in XYZtoUVW mode.
- Change the 3D texture map to use Explicit Map Channel with the same channel.
- Add a UVWXForm as usual.
The real challenge is solving it without having to de-instance the objects, which as far as I can tell, can only be done at the texture map level.
Eric Craft suggested another work-around I couldn’t get the way you suggested to work.
Just using a Explicit Mapping channel and Planar mapping with real-world scale seems to work well. And to not de-instance the geometry you just use a ‘make reference’.
Something like this might work too, and you dont need to de-instance the nodes or to change their current mapping. Havent tested it too much, but works with the planes example.
(
delete objects
map = noise size:0.001 coords:(StandardXYZGen coordType:2)
mat = standardMaterial DiffuseMap:map
p1 = plane()
p1.material = mat
maxOps.CloneNodes p1 offset:[30,0,0] cloneType:#instance
select objects
max modify mode
uvwXform = UVW_Xform u_tile:0.01 v_tile:0.01
modPanel.addModToSelection uvwXform
for m in objects do (
InstanceMgr.MakeModifiersUnique m uvwXform #individual
m.uvwXform.u_offset = (random 0.0 10.0)
m.uvwXform.v_offset = (random 0.0 10.0)
)
)
Ive been looking to achieve the same but with 3D maps and here is a dirty workaround. The ideal solution would be a XYZ_XForm modifier or better yet a new parameter in the coordinates generator for each procedural map.
If your procedural map is a noise map, you could use BerconNoise which already has a parameter to do just this (Mapping->Variance).
(
fn RandomizeXYZCoords nodes offsetX offsetY offsetZ =
(
select (for node in nodes where iskindof node GeometryClass collect node)
max modify mode
xformmod = xform()
modPanel.addModToSelection xformmod
for node in nodes do (
InstanceMgr.MakeModifiersUnique node xformmod #individual
x = random (float -offsetX) (float offsetX)
y = random (float -offsetY) (float offsetY)
z = random (float -offsetZ) (float offsetZ)
node.modifiers[#xform].gizmo.position = [x,y,z]
node.objectOffsetPos -= [x,y,z]
addModifier node xformmod -- Not needed
)
)
-- TEST
delete objects
t1 = teapot()
t1.material = standardMaterial DiffuseMap:(noise type:2)
maxOps.CloneNodes t1 offset:[100,0,0] cloneType:#instance
RandomizeXYZCoords objects 20.0 20.0 20.0
)