i still doing a copy / stamping of some books to learn how to do it,
and i want to do a texture for the book itself and another texture for the cover text.
and how can i mix them? do i need to do 1 material with diferent layers?
or do i have to do a material with diferent nodes?
use a layered material and set each texture in a layer?. and then how or where do i put the stamp function? thanks guys.
how you stamp materials or textures?
16510 14 1- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
- tamte
- Member
- 8512 posts
- Joined: July 2007
- Online
you can use vex layered surface to mix different textures
then you can override texture parameters with attributes created in sops
you can just create primitive attribute to store texture ID
then after copy use material node and override desired texture parameter with expression using that attribute
eg.
create attribute named “textureID” with localvar “TEXTUREID” in left input tree from copy sop
stamp its value by an expression like stamp(“../copy1”,“cy”,0)
where “cy” is for example a stamp variable containing copy number
after copy add material sop set your material and override it's texture parameter let's say “book_texture” to something like this: $HIP/img/book_$TEXTUREID.png
you can of course use more direct way (but less versatile) and create “book_texture” primitive string attribute directly instead of “textureID”
then it would be something like this: $HIP/img/book_`stamps(“../copy1”,“cy”,0)`.png
if then the shader applied to this object has texture string parameter called “book_texture” the value in “book_texture” attribute will automatically override it
if you are using vex layered surface then the texture parameters are called “map_base”, “map2”, “map3”, …
so you can override them with attributes with the same names
then you can override texture parameters with attributes created in sops
you can just create primitive attribute to store texture ID
then after copy use material node and override desired texture parameter with expression using that attribute
eg.
create attribute named “textureID” with localvar “TEXTUREID” in left input tree from copy sop
stamp its value by an expression like stamp(“../copy1”,“cy”,0)
where “cy” is for example a stamp variable containing copy number
after copy add material sop set your material and override it's texture parameter let's say “book_texture” to something like this: $HIP/img/book_$TEXTUREID.png
you can of course use more direct way (but less versatile) and create “book_texture” primitive string attribute directly instead of “textureID”
then it would be something like this: $HIP/img/book_`stamps(“../copy1”,“cy”,0)`.png
if then the shader applied to this object has texture string parameter called “book_texture” the value in “book_texture” attribute will automatically override it
if you are using vex layered surface then the texture parameters are called “map_base”, “map2”, “map3”, …
so you can override them with attributes with the same names
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
thanks tomas, now i see what you mean, i do need to apply the stamp funtion at modeling level and not in the material or shader by itself,
ok, now how do i set up the atribute. the idea that i have is this,
have 2 or 3 titles of the books and 2 or 3 base textures so i can random them. plus the shape of the book.
i did create a vex layered material, and put it on the tree. and did 4 textures just to try that up and put each on a layer. and well there is where i got stuck. -
thanks for the help .
ok, now how do i set up the atribute. the idea that i have is this,
have 2 or 3 titles of the books and 2 or 3 base textures so i can random them. plus the shape of the book.
i did create a vex layered material, and put it on the tree. and did 4 textures just to try that up and put each on a layer. and well there is where i got stuck. -
thanks for the help .
- tamte
- Member
- 8512 posts
- Joined: July 2007
- Online
think of that layered shader as a material just for one book
you layer one book texture and one cover text texture on top of each other
those two textures will vary for each book
so now you just need to create 2 string overrides in Material SOP with following names
“map_base” for book texture and “map2” for cover texture because those are names of the parameters in material you want to override
be sure to append this Material SOP after Copy SOP to avoid unnecessary cooking since we will be using temp attributes to compute texture ID
since you want to vary book texture and cover text texture with different seed you can create 2 integer attributes for this and call it like “book_tex_ID” and “text_tex_ID”
1) you can either create those by copystamping in left input tree of Copy SOP (be sure to use Attribute Create SOP for this instead of just Attribute SOP)
2) or much simpler you can precompute them on the template points (right input tree of Copy SOP) and transfer them to copied books by checking Use Template Point Attributes in Copy SOP/Attribute tab and fill in the names or * in the field of specified field, best would be To Primitive for this case
look at the file
i have created some example textures(4 for book texture and 4 for text texture) and set up example workflow with 2) method
since you didn't have uvs, i created very simple one
i kept your color variation so it is multiplied with book texture in material
instead of Material SOP you can directly create parameters with the same names as the parameters you want to override in material as i mentioned in previous post
you layer one book texture and one cover text texture on top of each other
those two textures will vary for each book
so now you just need to create 2 string overrides in Material SOP with following names
“map_base” for book texture and “map2” for cover texture because those are names of the parameters in material you want to override
be sure to append this Material SOP after Copy SOP to avoid unnecessary cooking since we will be using temp attributes to compute texture ID
since you want to vary book texture and cover text texture with different seed you can create 2 integer attributes for this and call it like “book_tex_ID” and “text_tex_ID”
1) you can either create those by copystamping in left input tree of Copy SOP (be sure to use Attribute Create SOP for this instead of just Attribute SOP)
2) or much simpler you can precompute them on the template points (right input tree of Copy SOP) and transfer them to copied books by checking Use Template Point Attributes in Copy SOP/Attribute tab and fill in the names or * in the field of specified field, best would be To Primitive for this case
look at the file
i have created some example textures(4 for book texture and 4 for text texture) and set up example workflow with 2) method
since you didn't have uvs, i created very simple one
i kept your color variation so it is multiplied with book texture in material
instead of Material SOP you can directly create parameters with the same names as the parameters you want to override in material as i mentioned in previous post
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
thanks tamte for helping me with the books i appreciated a lot.
i was checking thie information on how to set up attributes,
http://www.vimeo.com/6803615 [vimeo.com]
as soon i get home i will check your files .
i was checking thie information on how to set up attributes,
http://www.vimeo.com/6803615 [vimeo.com]
as soon i get home i will check your files .
- Allegro
- Member
- 696 posts
- Joined: March 2006
- Offline
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
thanks allegro, i am downloading them right now,
now i see how you set it up, the texture is an attribute that we add. so we can use it from the material, i thought there was another way to link the material with it.
now i get it, what you did is cycle the number of the texture instead the complete name.
i am assuming if i want to stamp materials i have to do something similar and over right the material and not the texture.
the only thing i didnt understand is why you use the “Round” function,
and the values wich you multiply the rand$PT
Book_Text round(fit01( rand($PT*359.43) ,0,3) )
text_text round( fit01( rand($PT*-72.31) ,0,3) )
now i see how you set it up, the texture is an attribute that we add. so we can use it from the material, i thought there was another way to link the material with it.
now i get it, what you did is cycle the number of the texture instead the complete name.
i am assuming if i want to stamp materials i have to do something similar and over right the material and not the texture.
the only thing i didnt understand is why you use the “Round” function,
and the values wich you multiply the rand$PT
Book_Text round(fit01( rand($PT*359.43) ,0,3) )
text_text round( fit01( rand($PT*-72.31) ,0,3) )
- Allegro
- Member
- 696 posts
- Joined: March 2006
- Offline
pelos
round(fit01( rand($PT*359.43) ,0,3) )
The rand function generates a random number based on whatever value is entered into it. rand(0) will always return the exact same value. Therefore, it is common to multiply, or add by a “seed” value to help eliminate any patterns that may begin to emerge in your work. we multiply by 359.43 (an arbitrary number) simply so that our random numbers aren't based on an integer seed.
fit01() will stretch the values out so that the random numbers produced by rand() (which are values between 0 and 1) will now be values between 0 and 3. These values are not integer values, so you may have values such as 0.0394 or 2.394875473 being generated.
round() will make it so that your values will be integers. A value of less than 0.5 will round to 0. A value between 0.5 and 1 will round to 1, etc. This is necessary since your image names will likely be image1.jpg, image2.jpg etc.
Stephen Tucker
VFXTD
VFXTD
- tamte
- Member
- 8512 posts
- Joined: July 2007
- Online
pelos
…
the only thing i didnt understand is why you use the “Round” function,
and the values wich you multiply the rand$PT
Book_Text round(fit01( rand($PT*359.43) ,0,3) )
text_text round( fit01( rand($PT*-72.31) ,0,3) )
rand() function is described here http://www.sidefx.com/docs/houdini10.0/expressions/rand [sidefx.com] and also why i used values to multiply $PT, just to give it a different seed
round() is just for rounding the number
i have 4 numbers in texture names, 0,1,2,3
so i need to round any number produced by fit01( rand($PT*359.43) ,0,3) to be exactly 0,1,2 or 3
because i don't want it to produce name like Book_1.534.png which does not exist so it will round it to Book_2.png
EDIT: Allegro was slightly faster
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Allegro
- Member
- 696 posts
- Joined: March 2006
- Offline
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
- Allegro
- Member
- 696 posts
- Joined: March 2006
- Offline
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
- tamte
- Member
- 8512 posts
- Joined: July 2007
- Online
pelos
now i want to know who was he, lol
just check his name on the main page of that tutorial, I bet it will be familiar to you
pelos
i was cheking more stuff for staming stuff and i got this other way, i dont know if is recomended, but this can be use also with textures.
it can, but you need to create n materials instead of just one (unless you use overrides). it is fine for 4 texures but for 100 i wouldn't try to do it this way
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- pelos
- Member
- 614 posts
- Joined: Aug. 2008
- Offline
-
- Quick Links