Jump to content

GDTF Forum

RKS: Defining prism facets


Petr Vanek - Robe

Recommended Posts

Prisms in GDTG are part of the Wheel and in particular, they are inside of what is called a Wheel Slot. Prisms definitions in GDTF allow precise definition of each of the prism facet and it is done by using transformations represented by Rotation matrices. There are many resources on rotation matrixes, for example this Wikipedia article and also many game engine related tutorials and articles, like this one, which is useful for our 2D prism definitions.

In the GDTF Builder, there is a really nice Prism editor which can do some of the math for you, like rotations and transformation (movement):

image.thumb.png.db7882ff18084a5039d85f95cfbfaa54.png

The editor also allows you to visualize multiple facets at the same time and show a circular view, which is useful for checking the final result. Here you can see linear and circular prism represented by the Rotation matrix and also visualy:

514156784_Peek2021-03-2711-44b.thumb.gif.aa410dc7da4b45e03f26b0664e2775c9.gif

1319875171_Peek2021-03-2711-44.thumb.gif.cd43a6cd3cb7eece1d75eb1567f9700f.gif

When defining prisms/prism facets, it is good to know how the Rotation matrix works or at least what each field means. Here i labeled the fields important for prism definition:

image.png.ac6ef3c22788920472fb3f6da81d2534.png

It is important to know what are the units used for the transformation. For the sake of simplicity, we can say here that the unit used in the matrix is "the radius of the unaltered beam". This sounds weird, so lets make an example:

Let's say, that we wont to define a linear prism, which looks like this:

image.png.716eaa77a251b6bf4a49fffcbf0f7684.png

We need to define three beams.

First one in an unaltered form, so horizontal and vertical scale are 1, and there is no rotation and no offset (translation):

image.thumb.png.89f6ba8d8bbdbc5021a6191ef541cf9c.png

Now we define one facet to the left, touching the first beam. As the translation is to the left (negative) and it it 2x the radius of the unaltered beam, we enter -2 into the Horizontal translation field:

image.thumb.png.b662b270129efb9e7cda7d9c135e7062.png

Now, we define the facet to the right, just touching the first beam. As the translation is 2x the radius of the unaltered beam, we enter 2 into the Horizontal translation field:

image.thumb.png.6934ba278795b643f5ce2deda6c71f2e.png

So anytime we want to move the beam from the original position, we simply use the original beam as the reference. Of course, in real life, we will need to do a bit of math, here is a practical example:

Linear 4-facet prism

Measured projection on a wall:

Unaltered beam diameter: 53
Offset of beam centers from center of unaltered beam, facets 1,2,3,4: -99, 30, 30, 99

Vertical translation:

facet 3: 30/53*2 = 1.1320754716981132

facet 4: 99/53*2 = 3.7358490566037736

facet 1: negative value of facet 4

facet 2: negative value of facet 3

Horizontal and vertical Scale:
If the altered beam was different, for example 55: 55/53=1.0377358490566038

Resulted preview:

image.png.b52b0cfe7ee9663771731c512a607a23.png

And the definition:

image.thumb.png.89f22b26b47c44916773312bfe1e9a23.png

Circular prisms

The Builder Prism facet editor contains a handy tool to define what is the offset of the facets from the center and will calculate parameters for the desired number of facets placed in a circle around the center:

image.png.953d88f8cc3c6e842b34cce8cc140ff7.png

Here is the initial generated result (preview):

image.png.f5269f1874ca931324f0a919e0ed61ec.png

And the definition:

image.png.85573f083ff97a22ddd3dae650b7f8df.png

But you must pay attention also to the rotation of each facet. The above example shows us that some facets are actually rotated:

image.png.f96228b54c6670f7708fdd3cb2ef8bd2.png

Which we must adjust by using the Rotate tool on each of the facets where this is required (-90, -180, -270):

image.png.2d0dbca93a93844aa36500d3079d7660.png

To achieve our final look:

image.png.9126548e2113549ec9c2d4bd17325738.png

And definition:

image.png.907548913b2c8d5dc08d79dec2cc56e6.png

Hope this helps

Petr

 

See all Robe Knowledge Sharing Articles.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.