Noob to Pro Shader writing in Unity 4

Hi Guys!
We’ve teamed up with Alex Telford to bring you a new “Noob to Pro Shader writing in Unity 4” series!

This multi-part multi-series series is aimed at taking your skills from flat color fragment shaders, to full on DirectX-11 uber-shaders!
And of course, it’s aimed at artists, not programmers so it’s all human readable code :wink:

We will be learning how to write clean, well formatted vertex/fragment shaders from scratch without the need for any surface shaders or cgincludes, while explaining everything from what a float variable is to controlling shaders with scripts and even creating custom image effects!

So here’s a sneak peak at some of the shaders, and we are open for suggestions if you want to learn anything specific.

And as an added bonus:
Maya/Max users - these shaders are written in the same language as the viewport CGFX shaders so you will have the knowledge to write shaders in both unity and maya/max!

I’m super excited to get this underway so I hope you’re excited too!
If you have any questions feel free to ask them here!

Good stuff!

How about,

  • Terrain shaders
  • Water!!
  • Shield fx?
  • Clouds (animated)
  • Sky (day night cycle?)

Hi mgear,

Terrain and Water - there seems to be a lot of requests for these, I’ll add it to Alex’s list and see if he can come up with something epic
Shield fx - Can you link to an example? (movie or game, just helps us see what you mean)
Clouds - We are covering volumetrics in the advanced portion
Sky - This is as easy as a rotating sphere (top half has Day cube map, bottom half has night) or a color lerp. we will learn the techniques for this in the introduction portion :wink:

Thanks for the feedback!

I’ve been meaning to learn to write shaders for a while. This seems like it’ll be a great series. I don’t have any shaders to request, though.

Sounds very interesting. Looking forward to see it.

nice. i know this is for artist, but I would love to see some actual CG code thrown in…so the skills will be more easily transferable outside of unity. I think both programmers and artist would benefit from that.

Hi Kablammyman, The way CG shaders are written are like this:

//Software Specific Interface stuff (interface stuff, culling etc)
//CG Shader
//Closing Tags and Fallbacks

The CG Shader part will work in any software with the exception of things like _World2Object has a different name in other software. We also have a 3DS Max site where Alex may come in and do some conversion tutorials for max and maya after the series.

This looks great! when are you thinking this will be avalible for viewing?

Hi Erica, sorry for the late reply, the series is finished and just pending review so should be out in the next couple of days :slight_smile:

The series is now online!
http://cgcookie.com/unity/cgc-series/noob-to-pro-shader-writing-for-unity-4-beginner/

lol nice post. I’ll take a look, thanks

All of those shaders require you to be artistic and create them your self.

Those tutorials were absolutely awesome, but is there any on how to take these shaders into maya and use them in there?

It’s kinda hard to design for a custom shader in another package without seeing what it will look like once the in-game shader is applied.

Cheers

Would anyone be willing to make a shader tutorial focused on creating negative light sources? I keep hearing that “it’s possible with shaders”, but no one’s really explained how, and I don’t really need shaders for anything else, so I don’t want to have to learn the ins and outs of shader coding. Is that lazy? Probably. But I don’t want to have to wade through the tutorials looking for a way to do one small thing.

Still kind of pisses me off that Unity doesn’t support simple negative light sources.

tried something similar while ago,
this one uses shader with custom lighting on the object, with basically inverted light…

Where could I find the 3rd pard of tutorials(Advanced series)?