Build a book case in houdini
14199 27 3- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
- vleermeneer
- Member
- 245 posts
- Joined: Sept. 2011
- Offline
Ofcourse there are many ways to do this in Houdini.
What I would do is first measure what the total width of your of your shelf, and somehow place a line in there.
Then you can measure your first prop's width and carve that section out from the curve using the carve sop resample that piece so theres 3 points, and then remove point 0 and 2 that should give you a single point which hold the location of your first prop.
Repeat this step for the next prop, you can repeat all of this using a switch for multiple objects and a foreach SOP to do the line carving and such..
What I would do is first measure what the total width of your of your shelf, and somehow place a line in there.
Then you can measure your first prop's width and carve that section out from the curve using the carve sop resample that piece so theres 3 points, and then remove point 0 and 2 that should give you a single point which hold the location of your first prop.
Repeat this step for the next prop, you can repeat all of this using a switch for multiple objects and a foreach SOP to do the line carving and such..
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Clever solution!
I have the bounds of where the books can be placed so placing the line should be quite easy.
On my own I used a stamp expression with a copy SOP to create boxes of random sizes. I've been trying to measure the width of each one and move it so that it is flush with the neighboring one.
I'll give your method a shot!
I have the bounds of where the books can be placed so placing the line should be quite easy.
On my own I used a stamp expression with a copy SOP to create boxes of random sizes. I've been trying to measure the width of each one and move it so that it is flush with the neighboring one.
I'll give your method a shot!
- vleermeneer
- Member
- 245 posts
- Joined: Sept. 2011
- Offline
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Yeah Copy SOP hits limits here. This sort of thing can make for a nice in-road to getting used to Python.
In the attached hip I've drawn two points to fit the width of a shelf, and in python grabbed the points to get the area to fill, destroyed them and created new points with an array of book sizes along the length, storing the sizes in a BOOKWIDTH attribute. Once you get that, it's easy to add additional attributes to keep on mixing it up.
It's quite a fun subject, as there's lots of opportunity to explore chaotic, lifelike distribution in a small sample space. Orderly book shelves are boring - now I've started I think I'll have a play at getting something more like my own shelves (i.e. the attached). See what you started.
In the attached hip I've drawn two points to fit the width of a shelf, and in python grabbed the points to get the area to fill, destroyed them and created new points with an array of book sizes along the length, storing the sizes in a BOOKWIDTH attribute. Once you get that, it's easy to add additional attributes to keep on mixing it up.
It's quite a fun subject, as there's lots of opportunity to explore chaotic, lifelike distribution in a small sample space. Orderly book shelves are boring - now I've started I think I'll have a play at getting something more like my own shelves (i.e. the attached). See what you started.
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Nice file Adam!
It is not exposed what the python node does, I've never used that node before.
I've attached my latest attempt at building a single shelf and I'm quite happy with it. To take it further I could delete one random book and do an RBD sim to get the chaotic look. Also placing horizontal books and magazines is on the to-do list. And of course, being able to input multiple curves.
Cheers,
Elias
It is not exposed what the python node does, I've never used that node before.
I've attached my latest attempt at building a single shelf and I'm quite happy with it. To take it further I could delete one random book and do an RBD sim to get the chaotic look. Also placing horizontal books and magazines is on the to-do list. And of course, being able to input multiple curves.
Cheers,
Elias
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Smart, that's working nicely as well.
Yep, throwing in some RDB to shake it up should work great - even some flexible magazines flopping down slightly where they overhang.
The python code btw is in bookshelf_populator1 … RMB->Type Properties, Code tab. Probably should have used an inline python sop so it's visible on the node's interface panel…something to remember.
Looking forward to seeing your final results!
Yep, throwing in some RDB to shake it up should work great - even some flexible magazines flopping down slightly where they overhang.
The python code btw is in bookshelf_populator1 … RMB->Type Properties, Code tab. Probably should have used an inline python sop so it's visible on the node's interface panel…something to remember.
Looking forward to seeing your final results!
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Soldiering on…
Now I have a book case that builds itself dynamically in a non chaotic fashion. Quite pleased. A limitation is that it only can be built along the x axis, this is something I'll have to solve. Maybe each profile could be rotated before anything is built on it, then rotated back into place.
Next hurdle to get over is build a book and magazine that can be built procedurally. Their texture assignment would need to be linked to the size of the book to avoid stretching. I'm not sure how to do this yet.
Nicely commented code by the way!
Now I have a book case that builds itself dynamically in a non chaotic fashion. Quite pleased. A limitation is that it only can be built along the x axis, this is something I'll have to solve. Maybe each profile could be rotated before anything is built on it, then rotated back into place.
Next hurdle to get over is build a book and magazine that can be built procedurally. Their texture assignment would need to be linked to the size of the book to avoid stretching. I'm not sure how to do this yet.
Nicely commented code by the way!
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Smart. I'd just position it with a Copy sop at the end.
Haven't really done any more here, but I did replace the float parameters with ramps to sculpt the flow, and added support for “book series”, to get a more natural output, as one of the things about bookcases, we tend to stack like-size and serials of books together. I've got props in as well, but it's fairly rudimentary.
I might come back to this later and do some more fancy stuff - too much on atm!
Haven't really done any more here, but I did replace the float parameters with ramps to sculpt the flow, and added support for “book series”, to get a more natural output, as one of the things about bookcases, we tend to stack like-size and serials of books together. I've got props in as well, but it's fairly rudimentary.
I might come back to this later and do some more fancy stuff - too much on atm!
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Great file Adam.
I've been rethinking how I'm going about this a bit. I think I would prefer to populate the shelf with books of known sizes as it would make matching books with textures a lot simpler. I made a little quick file that creates a very simple book from a texture, setting up the textures would be a manual process anyhow.
Currently the simple book isn't textured, that's on the to-do.
I've been rethinking how I'm going about this a bit. I think I would prefer to populate the shelf with books of known sizes as it would make matching books with textures a lot simpler. I made a little quick file that creates a very simple book from a texture, setting up the textures would be a manual process anyhow.
Currently the simple book isn't textured, that's on the to-do.
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Cool - and pretty much approaching it in a similar way as I would, building from actual jackets.
Yeah, without turning a book into a deep HDA project all of it's own, the bigger picture is a lot more manageable with book presets - and I like that you've pulled the book jacket off the web; it would be great if you have a nice database of book jackets available (and better again if they came with dimensions ).
Yeah, without turning a book into a deep HDA project all of it's own, the bigger picture is a lot more manageable with book presets - and I like that you've pulled the book jacket off the web; it would be great if you have a nice database of book jackets available (and better again if they came with dimensions ).
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Yeah, I've gone ahead and built some book geometry, just the book jackets to have some real sized objects to work with. Sadly they don't provide dimensions, they are simply built using the size in pixels. Then I just scale them to a reasonable size.
At this point I'm using textures straight from the net. I'm thinking it would be good to localize them to $HIP/pic/ I guess it could be done with a little python scripting.
This is what I have so far:
At this point I'm using textures straight from the net. I'm thinking it would be good to localize them to $HIP/pic/ I guess it could be done with a little python scripting.
This is what I have so far:
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Looks great Elias.
Although, for some reason I'm getting 15-30fpm (that's frames per minute…) in the viewport, which is quite weird because the cook times are fine, and there's only 93 prims/248 points.
Looking a bit closer, the Switch SOP is where it's slowing down - even with just 2 segments/books, it's at 2fps, whereas a book selected on it's own is 140fps.
I take it you don't have any slowdown there?
Edit: Narrowed it down to the Op call to the Cops subnet (op:`opfullpath('../crop_texture/texture_OUT')`)
Seems the call itself is enough - disabling the texture import and crop cop doesn't change anything. (this could all just me on my machine of course ).
Although, for some reason I'm getting 15-30fpm (that's frames per minute…) in the viewport, which is quite weird because the cook times are fine, and there's only 93 prims/248 points.
Looking a bit closer, the Switch SOP is where it's slowing down - even with just 2 segments/books, it's at 2fps, whereas a book selected on it's own is 140fps.
I take it you don't have any slowdown there?
Edit: Narrowed it down to the Op call to the Cops subnet (op:`opfullpath('../crop_texture/texture_OUT')`)
Seems the call itself is enough - disabling the texture import and crop cop doesn't change anything. (this could all just me on my machine of course ).
- edward
- Member
- 7773 posts
- Joined: July 2005
- Offline
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Yeah, I've had being quite slow to cook at times, guessing it's because the textures are online. I also ran out of memory one time (8GB) but havn't had again since I restarted houdini.
I guess the best thing to do would be to add a COP output driver and a file node referencing the same path. That way the textures would be localized and processed/pre-cropped. And of course a switch to change between the inputs.
I guess the best thing to do would be to add a COP output driver and a file node referencing the same path. That way the textures would be localized and processed/pre-cropped. And of course a switch to change between the inputs.
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
Well, it's fully understandable that referencing a COP network would require it to cook and that it would be slower than loading from disk. But it seems like it's slower than it could have been. As Edward said.
In this case I can partially get around it possibly, but I run into one big problem. Houdini can't render COP images to disk in the full resolution, but is limited to 700x400 something. On the ROP file output node I can set it to 1/8 resolution and bake the images out. A possible solution would be to have that parameter switch to 1/1 at render time?
This is a bit problematic as I would like to have this HDA work in the non-commercial version as well. I figure that Houdini have a global limit on the resolution it can output to disk, I would be nice if COP was excluded?
In this case I can partially get around it possibly, but I run into one big problem. Houdini can't render COP images to disk in the full resolution, but is limited to 700x400 something. On the ROP file output node I can set it to 1/8 resolution and bake the images out. A possible solution would be to have that parameter switch to 1/1 at render time?
This is a bit problematic as I would like to have this HDA work in the non-commercial version as well. I figure that Houdini have a global limit on the resolution it can output to disk, I would be nice if COP was excluded?
- AdamT
- Member
- 184 posts
- Joined: June 2010
- Offline
Yeah, only Apprentice HD can output any size from COPs.
HD can't use Render COPs either as they can't read .picnc. Not a huge deal perhaps, but it does hedge some ability to explore things. Perhaps some of this will change if Houdini Engine in Unity etc. makes a big splash: generating textures is a big deal in games.
HD can't use Render COPs either as they can't read .picnc. Not a huge deal perhaps, but it does hedge some ability to explore things. Perhaps some of this will change if Houdini Engine in Unity etc. makes a big splash: generating textures is a big deal in games.
- Elias Ericsson Rydberg
- Member
- 41 posts
- Joined: April 2013
- Offline
-
- Quick Links