Monthly Build 2019/03 – Dreamsent: The Hunger of Bekg

Hey, here’s the first build for this, it is VERY work-in-progress but hopefully you can start to see a glimpse of where I’m trying to get to with it?

Anyway as usual, I talk about it in the video above, and you can download it below. Thanks so much for your support!

Oh and don’t forget to grab the latest version of Sophie’s Dice 🙂

Update: Totally forgot I saidI was gonna add this link to the post, but it’s here now!

This content is available exclusively to members of this creator's Patreon at $1 or more.

Marble Dice Shader

Hey, so I was asked how I did the shaders in Sophie’s Dice, specifically the marbled effect, and I thought I’d make a post about it 🙂

The main thing I wanted to achieve with the marbled effect was mostly something that would work on any dice shape – early builds of the dice roller were HUGE because every dice had several materials each with several textures, so I wanted something which was more procedural to save memory. I thought about a tri-planar approach but I felt that would be both too expensive to render (especially for a lot of dice on mobile) and also too samey – every dice would appear to have almost the same whorls and blotches.

My biggest hope was that I could do something to specify a whole procedurally marbled space, and the surface of the dice would just be the value of marbling where the surface intersects that marbled space (just like, you know, real marbled surfaces :P)

Hopefully you can see, even though these dice all use the same noise texture (and have the same scale/rotation), the marbling appears distinct between them and not like the same pattern has been stamped across each one.

My first attempt to get this effect was to think “Right, I’ll have a noise texture, and use a gradient texture to look-up an offset of the noise texture – one gradient for each axis!”

The result was not… especially marble-y 😛

It wasn’t until I *really* tried to pull away from a tri-planar approach that I started having good results. I was sure if I just had one texture and used the local fragment XYZ co-ordinates I could define some marble-y space from which to sample surface values.

This marbling is achieved by pretty much three lines of code.

I sample the noise texture using the fragment’s local ZX position for UVs, and then sample it again in XY, but modifying the position based on the first sample and a _Marbling strength property. Then I use that sample to interpolate between the two marble colours.

put simply, it’s like a messy duo-planar (is that a thing? I don’t know if that is a thing) mapping. Noise determined by depth effects noise sampled in XY space – makes for a 3D noisy space and a marbled surface wherever it intersects.

The final (or at least “final” for now) code for the marbling became this (sorry for the switch to surface shader code from fragment shader, but it was necessary for me because I needed all that PBR goodness <3)

The maths is a little different, but the principle is the same. The main chainges are now most everything is determined by a _MarbleOffset vector so I can tweak per dice the marbling across each axis. (I mean, most dice shapes use the exact same settings and they are fine, but in the future I do plan to take advantage of this so that every dice looks as good as it can.)

That is pretty much the extent of the cool shader stuff for my dice, except for the glitter effect, which is mostly based on this example right here, though I couldn’t exactly replicate it, so I mostly banged my head on the desk for a few hours until I was about to give up and then found that I kind-of liked how this looked:

Don’t ask me how it works, I don’t remember, and I’m not sure I ever really knew in the first place. But I feel like that’s how a lot of shader stuff is, right? You just try a bunch of stuff until it kind-of works and then you try similar stuff until it works better.

I do still want to do other things for dice shaders (no transparent dice yet, I’m so ashamed!) but that is it for now. I hope this post has been helpful.

If there’s anything else you’d like to ask about WRT my games (or whatever, really) feel free to leave a messege in my patreon community. 🙂

o/

This content is available exclusively to members of this creator's Patreon at $1 or more.

Marble Dice Shader

Hey, so I was asked how I did the shaders in Sophie’s Dice, specifically the marbled effect, and I thought I’d make a post about it 🙂

The main thing I wanted to achieve with the marbled effect was mostly something that would work on any dice shape – early builds of the dice roller were HUGE because every dice had several materials each with several textures, so I wanted something which was more procedural to save memory. I thought about a tri-planar approach but I felt that would be both too expensive to render (especially for a lot of dice on mobile) and also too samey – every dice would appear to have almost the same whorls and blotches.

My biggest hope was that I could do something to specify a whole procedurally marbled space, and the surface of the dice would just be the value of marbling where the surface intersects that marbled space (just like, you know, real marbled surfaces :P)

Hopefully you can see, even though these dice all use the same noise texture (and have the same scale/rotation), the marbling appears distinct between them and not like the same pattern has been stamped across each one.

My first attempt to get this effect was to think “Right, I’ll have a noise texture, and use a gradient texture to look-up an offset of the noise texture – one gradient for each axis!”

The result was not… especially marble-y 😛

It wasn’t until I *really* tried to pull away from a tri-planar approach that I started having good results. I was sure if I just had one texture and used the local fragment XYZ co-ordinates I could define some marble-y space from which to sample surface values.

This marbling is achieved by pretty much three lines of code.

I sample the noise texture using the fragment’s local ZX position for UVs, and then sample it again in XY, but modifying the position based on the first sample and a _Marbling strength property. Then I use that sample to interpolate between the two marble colours.

put simply, it’s like a messy duo-planar (is that a thing? I don’t know if that is a thing) mapping. Noise determined by depth effects noise sampled in XY space – makes for a 3D noisy space and a marbled surface wherever it intersects.

The final (or at least “final” for now) code for the marbling became this (sorry for the switch to surface shader code from fragment shader, but it was necessary for me because I needed all that PBR goodness <3)

The maths is a little different, but the principle is the same. The main chainges are now most everything is determined by a _MarbleOffset vector so I can tweak per dice the marbling across each axis. (I mean, most dice shapes use the exact same settings and they are fine, but in the future I do plan to take advantage of this so that every dice looks as good as it can.)

That is pretty much the extent of the cool shader stuff for my dice, except for the glitter effect, which is mostly based on this example right here, though I couldn’t exactly replicate it, so I mostly banged my head on the desk for a few hours until I was about to give up and then found that I kind-of liked how this looked:

Don’t ask me how it works, I don’t remember, and I’m not sure I ever really knew in the first place. But I feel like that’s how a lot of shader stuff is, right? You just try a bunch of stuff until it kind-of works and then you try similar stuff until it works better.

I do still want to do other things for dice shaders (no transparent dice yet, I’m so ashamed!) but that is it for now. I hope this post has been helpful.

If there’s anything else you’d like to ask about WRT my games (or whatever, really) feel free to leave a messege in my patreon community. 🙂

o/

This content is available exclusively to members of this creator's Patreon at $1 or more.

Sophie’s Dice released!

Hey, today is my first public release of my dice roller! And you get this shiny new version because you’re great and I love you, but also as thanks for your support <3

You can grab it from itch.io by linking your patreon account here.

I really am especially thankful for your support whilst I’ve been working on this, I tend to use a very wide definition of “videogames” myself but this pushes even that, so I’m glad you stuck with me anyway 🙂

This content is available exclusively to members of this creator's Patreon at $1 or more.

Extra Stuff Patron Stream – Saturday

Hi! I’m going to try doing a monthly stream instead of a monthly video again. This should allow some Q&A and general chat so if there’s anything you want to talk about with me, drop by!

It will be on Saturday at 5pm BST. Here’s a link to check what that is in your timezone.

This content is available exclusively to members of this creator's Patreon at $1 or more.