pelos Posted July 3, 2023 Share Posted July 3, 2023 i want to feed some points to a random, so i get a random value between 0-1 and feed that to a gradient, that way with the gradient i can tell what percentage of certain color i want. but i dont find anything like that. and if i use the normal random. the render complains =( Quote Link to comment Share on other sites More sharing options...
Atom Posted July 3, 2023 Share Posted July 3, 2023 (edited) That's a VOP, right? Why wouldn't that work with MaterialX? Just fetch in the result of your VOP which is Cd using the mtlxGeometryColorNode. You can always pickup a pre-randomzied attribute on the points inside using a mtlxGeometryPropertyValue. Another way is to used one of the mtlxNoise nodes with a signature of float. Read up on them. Some are in the range of 0,1 and others -1,1. Edited July 3, 2023 by Atom Quote Link to comment Share on other sites More sharing options...
pelos Posted July 4, 2023 Author Share Posted July 4, 2023 (edited) i thought when doing materialX you can only use mx materials or complains, for example the node "uv cords" and "mtlx Tex Cords" or "constant" and "mtlxConstant" Edited July 4, 2023 by pelos Quote Link to comment Share on other sites More sharing options...
ryew Posted July 5, 2023 Share Posted July 5, 2023 Yes, but you can still read in attributes form your geometry to work with, add noise, etc. Atom's tip on using the mtlxGeometryPropertyValue is something I use all the time in my MtlxX shaders to pass attributes from the SOP geometry into my shaders for masks, colors, etc. Just set whatever random value you want on your geometry and then read it into your MtlX shader 1 Quote Link to comment Share on other sites More sharing options...
malexander Posted July 5, 2023 Share Posted July 5, 2023 There are also Mtlx Noise VOPs that you can use to generate random values, though you need to feed them a seed that varies per pixel (like a uv or position). Quote Link to comment Share on other sites More sharing options...
pelos Posted July 5, 2023 Author Share Posted July 5, 2023 On 7/3/2023 at 2:24 PM, Atom said: That's a VOP, right? Why wouldn't that work with MaterialX? Just fetch in the result of your VOP which is Cd using the mtlxGeometryColorNode. You can always pickup a pre-randomzied attribute on the points inside using a mtlxGeometryPropertyValue. Another way is to used one of the mtlxNoise nodes with a signature of float. Read up on them. Some are in the range of 0,1 and others -1,1. thanks, my questions was more about if there a random node in materialX or if anyone had needed to create one before. (Thanks for the advice on how to bring geo attributes to the shader =) if we attach that attribute into geometry adding an additional attribute is adding more disc space when is not needed, will be a lot of geometry. yes i could add a random value to each prim. but is smarter to just do it on the shader instead. Quote Link to comment Share on other sites More sharing options...
pelos Posted July 5, 2023 Author Share Posted July 5, 2023 maybe this will provide an idea. the front row is what i want to get, but with materialX i get the back row materialX.hip Quote Link to comment Share on other sites More sharing options...
fencer Posted July 5, 2023 Share Posted July 5, 2023 2 hours ago, pelos said: maybe this will provide an idea. the front row is what i want to get, but with materialX i get the back row materialX.hip 1.01 MB · 1 download Mtlx doesn't have random function yet, you need to set random values on sop level or through noise as mention above, check an example. materialX_v02.hip Quote Link to comment Share on other sites More sharing options...
pelos Posted July 5, 2023 Author Share Posted July 5, 2023 that i know how to do, but it adds extra attributes to the geometry. and there will be a lot of geo to save to disk, and should be done at the shader we don't want to add another column of attribs since can be done with normal shaders should be able to do it with materialX Quote Link to comment Share on other sites More sharing options...
fencer Posted July 5, 2023 Share Posted July 5, 2023 54 minutes ago, pelos said: since can be done with normal shaders should be able to do it with materialX Strong statement Okay, how about noise on shader level? materialX_v03.hip Quote Link to comment Share on other sites More sharing options...
pelos Posted July 5, 2023 Author Share Posted July 5, 2023 magical!!!! not sure why i was not getting that, maybe i was using the 2d noise and should needed to be 3d? Fencer you rock! 1 Quote Link to comment Share on other sites More sharing options...
fencer Posted July 5, 2023 Share Posted July 5, 2023 20 minutes ago, pelos said: magical!!!! not sure why i was not getting that, maybe i was using the 2d noise and should needed to be 3d? Fencer you rock! Probably 2d noise required uv coordinates, value 0 to 1. You have 1,2,3... in incoming attribute. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.