Quick #gamedev #gameart trick.
When you use the alpha clip method of transparency it is binary- on/off. You either render the pixel, or you skip it.

However, your alpha channel is not binary. It is a float from 0.0 to 1.0.

This gives you a nifty trick...
See, to convert the alpha channel to on/off you set a mask clipping value. A value of 0.5 basically says only draw a pixel if the alpha is 0.5 or higher.
What that means is you can assign different values for different parts of your texture, and use the mask clipping value to reveal them bit by bit, or randomise them.

Say, a short moustache, a long moustache, a goatee and a full beard, all using the same texture.
So the alpha would be something like this.

(Alpha value)
(0.0) no beard.
(0.25) small moustache.
(0.5) full moustace.
(0.75) goatee
(1.0) full beard

As the clip value goes up they will disappear one by one.
This trick can also be used for dissolving characters. You can bake the models vertical world space value into the alpha, highlighting bits that you want to linger... like skeletons :)
It's a classic technique that can be used in many ways, and I am still coming up with things that leverage this trick.
Remember at the end of the day, textures are just arrays of numbers- red, green, blue and alpha are just four grids of values from (usually) 0 to 1.
You can use that data in a heap of ways... I have even seen object animations stored in textures as you can store positions in colours (r,g,b = x,y,z).
A classic alpha mask trick is to take all the posters on a wall and store each one as a different value on the alpha- anything above, say 0.05 is solid, so that gives you all that data above to use for stuff like masks.
You can then say "okay, anything in the alpha from 0.06 upwards, tint color A- anything from 0.25 upwards, tint color B, and anything above 0.5 tint color C.

You can then randomise those colors with a script.
And that means the poster texture is different each time you use it.
One last trick- is "super black" clipping.

This uses your color texture map WITHOUT an alpha channel to get the exact same results.

You make the texture slightly brighter than black in photoshop, then paint out the bit you want transparent pure black (0,0,0)
In the shader, you take the colour output for, say, red. And you step this so anything above 0.01 is white, everything below is black. Plug this into your opacity mask.

Voila. Alpha clipping with no alpha channel.
Now you sure ensure that your values are enough that Mip mapping won't screw this up, but on the whole it works pretty good for dark rimmed objects- so if you use cartoon shaders with inked edges, super black is a great saving for alphas.
Okay, that's two tricks and I have to sleep now.

As always, I appreciate if you shout me coffees for my time here...

ko-fi.com/dellak

And my forthcoming book will have this stuff with sexy diagrams and example renders :D

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Delaney King 👩🏻

Delaney King 👩🏻 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @delaneykingrox

Mar 21
So, in closing... the real question isn't which Doctor Who has fucked their respective incarnation of The Master/Missy, the question is which Doctor is the bottom in each incarnation.

Thank you for coming to my lecture.
Bottom
Bottom.
Read 29 tweets
Mar 21
For the HD version of Stellaris, our team had to create all new high detail icons as the original ones looked too muddy when scaled up to 4k.

I used big blocks of colour, dark lining and sharp contrast so when the paintings were scaled down they would be crisp and clean. ImageImage
Here is another painting from that project- again, big blocks with dark outlines so they would scale down and become crisp, easy to read icons. Image
I think Jack and I did like a few hundred? It was a lot.
Read 7 tweets
Mar 20
A quick #gamedev question about texture arrays...

So texture arrays are brilliant for reducing draw calls and state changes by gathering up a bunch of textures in one go in the shader...
Texture coordinates work from 0,0 (left,bottom) to 1,1 (right, top).

Note this is not based on texture resolution. So the middle of a 256x256 and the middle of a 1024x1024 image is the same... it's always (0.5, 0.5).
When you go outside of the zero to one space, what happens? Well, the default behaviour is called "tiling" the texture repeats off into infinity and beyond in all directions.

If you set your texture to "clamp" any UV that goes outside the zero to one space is black.
Read 53 tweets
Mar 20
Social justice warrior isn't an insult.

'Social justice' is ensuring our society has justice. 'Warrior' means you are fighting.

Pretty much every hero on TV or in comics fights for justice.

Social Justice Warrior just means hero.
When someone attacks you for being a social justice warrior, they are stating that you are fighting for a society they do not want. They are happy with the injustices, because they benefit from them.

Social justice warrior is a term used by people who fight for injustice.
As a game developer and someone with a social media platform, I am frequently attacked online.

Invariably it is from people who are angry that I oppose the privileges they benefit from. They feel attacked because they value that privilege, and think I want to remove it-
Read 7 tweets
Mar 20
Here is how big game companies work. Everyone doing the work get paid like regular jobs, they don't have shares in the profit.

So, once a product ships if you buy it or not doesn't "support" those developers.

They have already been paid. Many have already been laid off.
The money goes to investors, publishers and the IP owners.

If the project tanks because, I dunno, a huge amount of people don't want to support transphobia or bad working environments or politics, well that's a shame.

Because the companies can write off the loss for tax.
At worst, the fat cats around the shareholders meeting will get angry and some management will get shuffled around, meaning some rich bastard will get a golden parachute payout or be shuffled off to a less active role or be given a shitter project.
Read 9 tweets
Mar 18
#gamedev #gameart advice. I see a lot of students making levels as one big mesh in 3d apps.
Environments are usually made up from what are usually called "kits" of modular pieces.
Here is some of the kits for Hitman taken from their talk (link shortly).
Learning to plan out and make modular kits is super important part of your skill set. Designing modules that are reusable and reskinnable makes a huge difference to your workflow.

You can buy various kits on asset stores that you can look at to get ideas.
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(