In my never ending quest to learn a bit about CG I have had to delve into the mysterious world of geometry (damn, shoulda paid more attention in high school). At least for me this is no simple task, I’m a humanities major and math in general is about as easy as learning Greek. But I digress.

Anyway, writing the exporter for Structure Synth, I needed to get my head around transformations (world, local, etc), again no easy task. As SS doesn’t provide lighting info, I needed to come up with a suitable lighting solution that would fit as many situations as possible and still provide great renders.

So area lights were the way to go (for now, IBL to come). How the hell do I create area lights and position them to create a pleasing “studio” for the exports from SS? Procedurally, that’s how. But again, I had no idea how to do it. So the search began and this is one part of what I have learned that I thought I should document before I forgot it!

For a trianglemesh rectangle in Lux I needed to create it.

"integer indices" [0 2 1 0 3 2 ] "point P" [-30 -20 0 30 -20 0 30 20 0 -30 20 0 ] "normal N" [ 0 0 2 0 0 1 0 0 2 0 0 1]

For the love of God! What is this??

Each set of three numbers creates a triangle, that has three vertices: in this example 0, 2, 1 0, 3, 2

"integer indices" [0 2 1 0 3 2 ]

The value for each vertex can then be found in the Point P list.

So, the first triangle would be 0, 2, 1

index 0, has a vertex position of (-30 -20 0)

index 2, has a vertex position of (30 20 0)

index 1, has a vertex position of (30 -20 0)

Then the next triangle is 0, 3, 2 which would be

index 0, has a vertex position of (-30 -20 0)

index 2, has a vertex position of (30 20 0)

index 3, has a vertex position of (-30 20 0)

Now this is good but we still need the Normal info for each vertex.

This time, the value for each vertex can then be found in the Normal N list which follows the same format:

So, the first triangle would be 0, 2, 1

index 0, has a vertex position of (0 0 2)

index 2, has a vertex position of (0 0 2)

index 1, has a vertex position of (0 0 1)

Then the next triangle is 0, 3, 2 which would be

index 0, has a vertex position of (0 0 2)

index 2, has a vertex position of (0 0 2)

index 3, has a vertex position of (0 0 1)

And there you have it, the trianglemesh created. Now we need to position it!

Stay tuned!

You must be logged in to post a comment.