Jump to content

[Solved] Calculating offsets

Recommended Posts

In Anastasia Opara's talk at SIGGRAPH 2017, she mentions a procedure for generating a line of books leaning on one another (28:26).

I have managed to replicate most of the steps (her explanations are excellent), except for the last step, in which Ana describes calculating the offset for a case in which the height of the current book is shorter than the distance from the top right corner of the previous book to the point used to instance the current book, at about 29:10 in the video.

As proof of my attempt, here is my current progress:


I am encountering the exact problem she describes, where the books appear to be floating due to the height differences.

Her solution, in essence, was to take the top left corner of the book and measure its distance from the previous book's bottom right corner (or right bounds, this was not explained as clearly), but it seems to me that would only work for the first/second books, since the bottom right corner of the first book shares the same x-value as its xmax bound.

I could not achieve the same result as demonstrated in the video.


Failing to replicate the offset calculations, I then tried calculating a ray from the top left corner of the current book towards the previous iteration. This seemed to work until I ran through the random seed value and discovered that this method was not effective either.

Would anyone have any idea of how to calculate this offset amount, or an explanation of how Ana's method works?


Share this post

Link to post
Share on other sites


After rewatching the video (for the umpteenth time) and paying extremely close attention to Ana, I finally understand what she meant.

I'm happy to announce that I have solved my problem!

Share this post

Link to post
Share on other sites
4 hours ago, konstantin magnus said:

Why dont you publish your solution? :P

Why not, indeed?


I apologize in advance if any of the code appears sloppy, I might have done some things in a more roundabout way than was required...

Of course, credit for the procedure should go to Anastasia Opara, I merely reverse engineered it following her presentation!

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now