Books and more books

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  02 February 2013
Books and more books

Hey guys another fun and collaborative tool here. I figured why not!
I've recently come across some cool book shelve filling tools, but sadly there were all seemingly missing basic features/controls that I'd expect to see. Aside from that, some cost way to much $$$ which we all know, not many of us have lying around waiting to get spent on a little mxs.

Any who lets get to it.
I've gone ahead and began to hard code a basic book layout tool.
The script creates a plane as a shelf, then distributes the books according to the settings.

For now I'm just hard-coding everything like I have in the past and then I'll develop a UI once this gets far enough along. I'd love to take in everyones contributions and ideas to make this tool like many past ones, a solid tool that users can find useful.

Now for the task lists

Things Completed
- Books distribute randomly from the back of the shelf to the front base on desired settings
- Struct implementation to store the node and its dimensions.

Things To Do!
- Add a random rotation with a range control for Y
- Along with the random Y rotation, adjust books to fit snug against one another
- Allow for random number of books to be placed lying flat on the shelf, face down
- Add 'N' number of books until the shelf is full

The next thing to tackle is figuring out how to aligns books against one another whom have a varying Y rotation on them.

delete objects

shelf = plane length:20 width:60 pos:[0,0,10] wirecolor:[150,215,230] 

struct bookData (node, thick, depth, height)
curBooks = #()

for i = 1 to 20 do 
	mybook = box width:(random 0.5 3.0) height:(random 8.0 20.0) length:(random 8.0 15.0) pos:[(-3*i),0,0] wirecolor:[150,230,90]
	bb = nodeLocalBoundingBox mybook
	thick = abs (bb[1].x - bb[2].x)
	depth = abs (bb[1].y - bb[2].y)
	height = abs (bb[1].z - bb[2].z)
	append curBooks (bookData node:myBook thick:thick depth:depth height:height)

/*Start the calculating*/
bb = nodeLocalBoundingBox shelf
shelfWidth = abs (bb[1].x - bb[2].x)
shelfDepth = abs (bb[1].y - bb[2].y)

offset = 0.0

for b = 1 to curBooks.count do 
	book = curBooks[b]
	shelfCorner = [bb[1].x,bb[2].y,shelf.pos.z] --back left corner of shelf

	book.node.pos = shelfCorner + [(book.thick/2.0),-(book.depth/2.0),0] --place book in furthest back corner of shelf
	--now adjust books position so there is no collision with previously placed books
	book.node.pos.x += offset
	--now adjust the books position depth wise based on the backFront 
	backFront =( random 0.0 1.0) -- 0.0:back 1.0:front
	book.node.pos.y -= (backFront*(shelfDepth-book.depth))

	offset += book.thick --continue to count offset from previous books
____________ ___ __ _
John A. Martini
  02 February 2013
no, no, no... not again... why does this idea so excite young developers?
  02 February 2013
Haha, it's something I've personally never done.
I'd be more than glad to work on something that someone would find useful, that wouldn't be a book script.

I'm open to any suggestions for new tools that would be unique and different from anything previously created.
____________ ___ __ _
John A. Martini

Last edited by JokerMartini : 02 February 2013 at 01:27 AM.
  02 February 2013
Originally Posted by JokerMartini: I'm open to any suggestions for new tools that would be unique and different from anything previously created.

i can sell you an idea...
all stars in the space are most known by position. our forefathers defined constellations. but... today we can 'pseudo randomly' generate the new ones. and name them! is it not cool? pointless? probably. but much better than do 'how to put books to shelves making them look that you've read them'
  02 February 2013
So in short a galaxy of stars creator? with constellations?
____________ ___ __ _
John A. Martini
  02 February 2013
Originally Posted by JokerMartini: So in short a galaxy of stars creator? with constellations?

yes! be God!
  02 February 2013
Here is something I've been wanting to do for awhile. It would allow for quickly throwing down hills for proxy placement in environments.

A mesh object that has a spinner for radius and then another spinner which would control the height.

As the height increases the loops between the center point and the outer ring would move in the fashion of an arch.
You'll see in the background a read object which is incorrect. That method's verts are moving linearly which is not what I'd want. You can look at the oilTank it's similiar to what I'm talking about.


You could have 3 spinners
1 for radius
2 for center height
3 for controller the interpolation from the outer ring to the center point.

So users could make it linear or arch/curved.
____________ ___ __ _
John A. Martini

Last edited by JokerMartini : 02 February 2013 at 02:00 AM.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:17 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.