Introducing Aion Surf

Miner are the backbone of the blockchain space. They secure the networks, and without security, well, there is no decentralization. Mining pools, by extension, are also crucial as they reduce and…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Iridescent shader breakdown

I recently made an iridescent shader in Unity using shaderlab and hlsl. I decided to apply it to my illustration of the seven of swords tarot card. Here’s a breakdown of how I made it.

Shiny Oshawott Pokemon card

So from a quick wikipedia search I got a simple definition of irridescence.

That’s great because we can easily access the view angle and angle of illumination in a shader. Since I wasn’t going to be moving the camera, I decided to try just using the light direction and normal direction to decide the colour.

First I wanted to get the worldspace normal. We can do this easily in the vert shader using one of Unity’s built-in functions.

Then we can pass this to the frag shader. I used the dot product of the light direction and worldspace normal to achieve this shadow effect.

Next, I wanted to add colour that changes depending on the dot product result, for this I decided to use a gradient ramp texture. I mapped a gradient texture using the result of the dot product as the UV co-ordinates.

That gave me a nice gradient that moved depending on the light/ normal direction.

I tried out several gradients to see how they looked and settled on this gradient as I felt it gave me the effect I was going for.

Perlin noise normal map

I simply added this to the normalised worldspace normals.

Then, as before, I used the result as the UV co-ordinates for the ramp texture. That gave it this great warped effect.

As a final touch, to make it more like a sparkly collectable card, I also added a voronoi noise normal map on top of the perlin noise normal map and it looked like this:

Finally, to add it to the tarot card, I made a black and white mask texture and used that to ensure the effect only shows up on the swords.

The final effect on the tarot card

Add a comment

Related posts:

Amateurs Focus on Outcomes More than Process

People want to know the hack, the shortcut, the friend who can “hook them up.” It’s often about making money or having a successful business or being the most viewed writer in the galaxy, full of…

Final Course Analysis

This course has taught me a lot about my writing techniques and styles that i prefer to write and ones I do not prefer. I took the comments given to me very seriously over this course, and really…

5. I believe God love to kill and see suffering.

Why did the people have to be set free from Egypt? I believe your God wanted to show them his power to destroy. No love or forgiveness, as your savior Jesus said, only his great power to destroy…