scaling procedural shaders for primitive and vertex objects?

Does anyone have tips on the simplest way to do this? What I find on initial experimentation is that procedural shaders change scale if you change the size of a primitive or vertex object. And there doesnt seem to be a way to change a primitive size without its scale values changing.

So what I end up doing, I guess, is inserting a projection mapping shader node above the multilayer shading mode and manually copying the primitive or vertex scale values from the assembly room which seems pretty awkward to me. Is there a simpler way? Also, the projection, cylindrical etc mapping shaders are not documented in the reference, and someone mennioned somewhere the cylindirical mapping is broken.

 

Comments

  • YofielYofiel Posts: 204
    edited October 2015

    As illustration, curently I am building up a rope texture for a torus primitive. Here I show the 'caution' pattern for simplicity. What I plan to do is use a repeating color gradient at the 45-degree angle as shown, with fine-grained anisotropic cellular perturbation, or noise-factory on global-space coordinates, to get continuously changing bump and highlight, if I can figure out the right scaling for those too. It's not clear to me if the cellular and random values work across a 3d space, or are flat 2d shaders. Its also not clear to me how scale varies for each shader component, or the best way to ge tthe color gradient to repeat on one axis and wrap around the object, I will have alot of trial-and-error testing to do.

    For this simple example, I can get the ring angle correctly wrapping if I set projection mapping to the front face and turn on 'ignore normals,' which is not what I would expect. Here are the proportions that work for this torus primitive, but I have to change them if I resize it, and I have no idea what the scaling or sides or anything actualloy refers to, because there is no documentation on it, but by putting the scaling ABOVE the multichannel mixer, it applies to all channels of course so now, theoretically, all the presets can look the same on all objects. Yay! I am just puzzled there is not a simpler say to do it.

    Maybe because it is a primitive there is only one normal defined for the object.

    torus shade.PNG
    1326 x 676 - 318K
    torus shade2.PNG
    727 x 484 - 92K
    Post edited by Yofiel on
  • DiomedeDiomede Posts: 15,125
    edited October 2015

    1)  I'm not sure

    2) I am going to offer a guess anyway.

    In general, I think shaders are "local" meaning referenced to the object itself.  Thus, a checker pattern in the shader tree will stretch with the primitive. Similarly, a vertex object that has been uvmapped still has its vertexes on specificplaces on the specific uvmap, so if a polygon is scaled up, the texture map stretches with it.  There are many situations where that is the preferred result.  Not sure I would want the default changed.

    However, there are a few shader parameters which can be set to "global" and thus would change as the object moved or stretched through the coordinates of the assemble room.  For example, some of the fractal noises have a "global" tab.  Similarly, the formula functions might be helpful for specific situations.  I'm not sure which the other shader functions have a global option.

     

    Hopefully, someone else has better informaton for you.

    Post edited by Diomede on
  • YofielYofiel Posts: 204

    Thanks for the answer. I forgot the torus primitve is actually an add-on, I forget where from, and when I tried to convertit to a vertex model it crashed. So I made a spline torus as described here: http://www.daz3d.com/forums/discussion/53634/torus-primitive and it shades entirely differently, I cant get the the stripes to wrap at all. This really is much more difficult than it should be.

    torus shade3.PNG
    573 x 533 - 118K
  • YofielYofiel Posts: 204

    picture:

    torus shade3.PNG
    573 x 533 - 118K
  • evilproducerevilproducer Posts: 9,050
    Hmmm.... I may have to try and see what I can come up with, but it may be tomorrow before I get a chance to try anything.
  • YofielYofiel Posts: 204

    So now I was able to convert the spline torus to a vertex object, and now I can get the parametric mapping to work (but not the flat mapping) without seams on the default size settings if I set the angle in the parametric mapping to 80 degrees for some reason. But with other angles there are seams from the procedural shader, as shown here. Is there any guidance on how to stop these seams?

    torus shade4.PNG
    1335 x 477 - 240K
  • YofielYofiel Posts: 204
    edited October 2015

    diomede said:

    In general, I think shaders are "local" meaning referenced to the object itself.  Thus, a checker pattern in the shader tree will stretch with the primitive. Similarly, a vertex object that has been uvmapped still has its vertexes on specificplaces on the specific uvmap, so if a polygon is scaled up, the texture map stretches with it.  There are many situations where that is the preferred result.  Not sure I would want the default changed.

    Hopefully, someone else has better informaton for you.

    Well you are definitely right with UV image maps! But for all other procedures, I cant think one does want it to scale by default. For stone or bricks or any architectural element, one wants to change the size of a cube primitive or other object, and have the texture remain the same. 

    Post edited by Yofiel on
  • YofielYofiel Posts: 204
    edited October 2015

    ...parametric mapping does not work on the bump channel. It does work on the displacement channel. It's necessary to enter fractional values for the angle, which do work but don't show up in the interface at all....

    Post edited by Yofiel on
  • YofielYofiel Posts: 204

    The other thing that occurs to me is that the order of the shift, scale, and rotatiion operations in the transformation matter. There's no way to set them, and presumably they are from top to bottom, but in manty cases one wants the rotation first, so probably one needs multiple nodes for that too. That's it for me today )

  • DUDUDUDU Posts: 1,945
    Yofiel said:

    I forgot the torus primitve is actually an add-on, I forget where from, ...

    If my memory is well, I think it's a free Fenric's plugin: "Insert Primitive".

    http://fenric.com/wordpress/downloads/

  • DUDUDUDU Posts: 1,945

    Oops, HeadWax confirm it in another thread !

  • YofielYofiel Posts: 204

    no, it'snot fenric's its another. But I get crashes with it anyway when converting to vertex, or rendering with displacement maps. Slowly making progress...I added hair to the rope fiber, but currently it only renders grey for some reason, and displacement maps aren't happy if they render on an object which isnt closed at edges of shading domains.

    port2.png
    1200 x 675 - 800K
  • DiomedeDiomede Posts: 15,125

    Now that I see what you are trying to do, the following thread shows several different ways to make rope.  You will probably be most interested in Varsel's about halfway down the first page.

    http://www.daz3d.com/forums/discussion/60434/carrara-challenge-19-above-and-beyond-wip-thread/p1

     

    However, I had my own method which is also in that thread.  I used the vertex modeler to create a spiral rope mesh in a tall column.  I then rigged it with bones so that it could be coiled.  You can get tighter/smoother coils by using more bones per meter.  My shader is a procedural shader with a fractal gradient in the color channel and a modified marble function in the bump channel.

     

     

    rope 1 mesh.JPG
    914 x 799 - 42K
    rope 2 boned and posed.JPG
    1270 x 728 - 165K
    rope 3 rendered.jpg
    640 x 480 - 14K
    Rope 4 shader tree.JPG
    702 x 701 - 67K
  • YofielYofiel Posts: 204

    Well,I tried cripeman's method for the ship, but there is no obvious equation tocalculate the length and width for a given shape, and the ship has many long yardlines for which I made a very short segment and then used replicator to extend it. The bones method may be helpful for ropes on the deck, but I think I finished the rope ring for the dock. Now though I am trying to use the tilerws to create wood planks with veloute, but its stillo a trial and error method, I have no idea what any of the scales actually do. 

  • YofielYofiel Posts: 204

    ...I have actually found something quite useful for this on renderosity: 

    scale material size script

    https://www.renderosity.com/mod/freestuff/scale-material-size-script/58253

  • YofielYofiel Posts: 204
    edited October 2015

    And on further extensive experimentation, I can add the following information:

    * For fixed scaling, PROCEDURAL shaders expect PARAMETRIC mapping on the GLOBAL shader, and if thus set for any number of faces on any rectiliinear object, then the number of boxes, wires etc in the shader parameters are the number that fit in 10 FEET. Changing display units has no effect, that is, to understand what the layout will look like, set the scene's display units to FEET rather than METERS or CM or whatever.  But if you set a prcedural shader direclty on a shading domain, rather than on the global shader, then it changes scale when you rescale the object. You have no idea how long it took me to figure that out.   

    * For IMAGE MAPS on rectiliear objects, it only scales to fit a flat shape with FLATprojection mapping on the global shader with a FLAT projection node with image map attached to it for *each separate face.* That sets the image map to fit exactly on each face. If you dont do that, the image map is scaled to wrap around the entire object, even if you are displaying only one face via shading domains or otherwise for it, and the image map is otherwise distorted.

     

    Post edited by Yofiel on
Sign In or Register to comment.