• Register
Post news Report RSS Glowing Gems

In which development of a research-puzzle continues; level five sees some changes and refinement; crystal lights are added; and a crystal shader is developed.

Posted by on

Greetings and salutations!

This week's screenshot shows a light-fitting for level five, its central crystal alas dim and inoperative:

Screenshot from 2020 07 04 18 44

The week just past was a bit of a slow one--but nevertheless, a number of things did get done:

To start with, work continued in the week just past on the research-interactions central to level five--and indeed, I believe that I have a handle on it now!

In particular, I've expanded out the process of searching the lower shelves, building it into a matter of chasing down references from author to author. It won't be extensive, but I'm hoping that it'll be interesting. (And along the way, there will likely be some foreshadowing to stumble upon, and perhaps even some lore...)

Furthermore, I've begun the work of implementing these interactions: I've added the relevant colliders and script-functions, albeit that they do little of interest as yet.

(To this end I ended up slightly extending my level-importation logic, such that it now allows me to specify script-methods and action-names in the level-model.

The level itself saw modifications in the week just past, too.

Perhaps most saliently, I felt that it was a little too big as I previously had it, and so scaled it down. This, of course, incurred a few other changes, such as modifications to the central tables and the removal of a few shelves. Overall, I'm rather happier with its new layout, I do believe!

On a more minor note, I also worked on the form and texturing of the central tables.

Screenshot from 2020 07 04 18 46 1

Screenshot from 2020 07 04 18 46

In addition to that, and as shown above, I started fitting the level with the lights that would have illuminated the place when, once, it was an active, working archive.

Screenshot from 2020 07 04 18 44 1

These lights are magical in nature, their radiance coming from enchanted crystals. Furthermore, I have it in mind that crystals will likely appear later in the game. Thus in the week just past I set about building a crystal shader--a task that I had expected to work on as part of this project, but not quite so soon!

For the most part this shader is very much like the standard player-light shader--it enforces full shininess and doesn't bother with changes to lightness or saturation, but otherwise it's pretty much the same.

Where it primarily differs is in the implementation of an "internal glow" within the crystals.

Now, a fairly accurate method to rendering this might be to first render the depth-values of the crystal's back-faces, followed by rendering the front-faces. The difference between the depths of the two passes could then be used to determine the thickness of the crystal at that point, and from that the intensity of the glow.

However, my rendering arrangement isn't really set up in a way that makes that easy, and in any case doing so may incur a performance cost. Thus I set about thinking of a way to create a similar effect with the elements that I had to hand already.

What came to me was this:

In modelling a crystal, I use a simple script to write its normals to vertex colours. Importantly, this can be done with the crystal in a near-spherical conformation, allowing the effect to "stretch" with it should it be extended into a more-pointed gem.

In the shader, I then reconstitute the colours into a vector, which is dot-producted with the light-direction. The resultant value is further offset using the standard lighting dot-product, such that faces angled away from the viewer (i.e. with a near-zero dot-product) are offset more greatly, thus somewhat suggesting refraction.

That value is then used to add a bit of colour to the rendered fragment, and further to slightly affect the transparency of the surface.

The results aren't all that obvious in the cylindrical lighting-crystals shown above, so I worked with some test-crystals while developing the shader. You can see some of the results here:

Screenshot from 2020 07 04 18 48

That then is all for this week--stay well, and thank you for reading! ^_^

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: