July 2020 donation progress: $0.00/$250 (0%). Click to learn more...
close
Hello! Thank you for using yiff.party!

We hope you enjoy using it. yiff.party operates on a non-profit basis, and as such, all the server expenses are paid by our users. We don't want to run ads or infect you with crypto miners. We depend on users like you to keep the site running, and to preserve years and terabytes of amazing content—some of which is no longer available from its original creators!

Because of the nature of the site, many users are reluctant to donate. That's OK! yiff.party was created so everyone can enjoy the content we host without any restrictions or paywalls. But if you value the service we provide, and are able to, we—and our users—would be tremendously grateful if you considered making a donation.

Donation progress for July 2020

So far, approximately $0.00 has been raised out of our target of $250.00. We're about 0% of the way there! Please note: this tracker is updated manually—don't worry if your donation doesn't show up immediately!

yiff.party's server costs are due on the last day of each month. So, we need to meet this goal before 31 July!

How to donate?

At this time, yiff.party can only accept donations in numerous cryptocurrencies. Please select a currency below to display the relevant donation address.

Bitcoin (BTC)
Bitcoin Cash (BCH)
Ethereum (ETH)
Ethereum Classic (ETC)
Litecoin (LTC)
Why can't I donate through other means (eg. PayPal)?

Due to the nature of sites like yiff.party, it is very difficult to find payment processors who will accept clients like us. If we were to accept donations via PayPal, it wouldn't take more than a day for someone to submit an abuse report and get our account frozen. Until a viable way of accepting monetary donations becomes available, cryptocurrency will remain the only option.

There are many resources available on how to purchase crypto. For Bitcoin, check out bitcoin.org's page on buying Bitcoin for a list of methods. For beginner Bitcoin users, yiff.party recommends using an escrow service such as LocalBitcoins.

close
Enjoying catlikecoding's content?

Creators like catlikecoding work hard to produce the content you are viewing on yiff.party for free. If you like what you see, consider supporting catlikecoding on Patreon to encourage them to create more great content!

Custom SRP: Point and Spot Shadows
Custom SRP: Point and Spot Shadowsmore_vert
2020-06-30T14:42:07+00:00
Post file flag
Custom SRP: Point and Spot Shadows 2020-06-30T14:42:07+00:00close

Point and spot lights should get realtime shadows too! Now they do.

Unfortunately I haven't yet figured out how to stop Unity from switching the cull mode for point light shadows. It becomes a non-issue when universally rendering two-sided shadows, but it's not ideal.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Point and Spot Shadows

Description
Perspective Shadows Mix baked and realtime shadows for point and spot lights. Add a second shadow atlas. Render and sample shadows with a perspective projection. Use custom cube maps. I've upgraded to Unity version 2019.4.1f1 and Core RP Library version 7.3.1, so some of the editor UI visuals have changed.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/point-and-spot-shadows/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/point-and-spot-shadows/tutorial-image.jpg
Movement: Swimming
Movement: Swimmingmore_vert
2020-06-23T20:01:37+00:00
Post file flag
Movement: Swimming 2020-06-23T20:01:37+00:00close

It's summer. High time we teach our sphere how to swim!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Swimming

Description
Moving through and floating in Water The previous tutorial failed to factor the time delta into the downward force when standing still. The code in MovingSphere.FixedUpdate should be as follows: else if (OnGround && velocity.sqrMagnitude < 0.01f) { velocity += contactNormal * (Vector3.Dot(gravity, contactNormal) * Time.deltaTime); } I've upgraded to Unity to version 2019.4.1f1 and ProBuilder to version 4.2.3, so some of the visuals have changed.

URL
https://catlikecoding.com/unity/tutorials/movement/swimming/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/swimming/tutorial-image.jpg
Comments (2)
user avatar
User #2998159 - 23 Jun 20 21:38
Legend. Thanks, Jasper!
user avatar
catlikecoding - 24 Jun 20 10:48
You're welcome!
Custom SRP: Point and Spot Lights
Custom SRP: Point and Spot Lightsmore_vert
2020-05-31T11:51:12+00:00
Post file flag
Custom SRP: Point and Spot Lights 2020-05-31T11:51:12+00:00close

We finally move beyond only supporting directional lights, including point and spot lights as well! This tutorial covers realtime, baked, and shadow mask for those other light types. Realtime shadows will come later.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Point and Spot Lights

Description
Lights with Limited Influence Support more light types than only directional. Include realtime point and spot lights. Bake lighting and shadows for point and spot lights. Limit rendering to max 8 other lights per object. We've only worked with directional lights so far because those lights affect everything and have unlimited range.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/point-and-spot-lights/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/point-and-spot-lights/tutorial-image.jpg
Movement: Climbing
Movement: Climbingmore_vert
2020-05-26T18:40:43+00:00
Post file flag
Movement: Climbing 2020-05-26T18:40:43+00:00close

Our sphere keeps evolving. It has now gained the ability to climb!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Climbing

Description
Besides walking and running, climbing is often an option, though the degree of freedom varies from only on ladders to wherever you want. As our movement is based on physics we'll support climbing on all surfaces that we deem climbable. So the first step is to detect when we're in contact with such surfaces.

URL
https://catlikecoding.com/unity/tutorials/movement/climbing/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/climbing/tutorial-image.jpg
Custom SRP: Complex Maps
Custom SRP: Complex Mapsmore_vert
2020-04-30T16:38:18+00:00
Post file flag
Custom SRP: Complex Maps 2020-04-30T16:38:18+00:00close

It's time to add support for some more complex materials to our RP's shader!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Complex Maps

Description
Masks, Details, and Normals Create a circuitry-like material. Add support for a MODS mask map. Introduce a secondary detail map. Perform tangent-space normal mapping. Although the code was fine, the shader compiler kept incorrectly complaining about some potentially uninitialized values. This is sometimes causes by mid-function return statements.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/complex-maps/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/complex-maps/tutorial-image.jpg
Movement: Moving the Ground
Movement: Moving the Groundmore_vert
2020-04-25T13:23:51+00:00
Post file flag
Movement: Moving the Ground 2020-04-25T13:23:51+00:00close

Our sphere is not the only thing that can move. What it's standing on can move as well, and the sphere should react accordingly. In this tutorial we make sure that happens.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Moving the Ground

Description
There are multiple ways to make geometry move. We could create a script that adjust an object's transformation. We could use Unity's animation system to animate it instead. We could also program our own playable graph and create an animation that way.

URL
https://catlikecoding.com/unity/tutorials/movement/moving-the-ground/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/moving-the-ground/tutorial-image.jpg
Comments (2)
user avatar
User #9260390 - 26 Apr 20 13:42
This character controller is coming along very nicely! Do you have a roadmap for the upcoming tutorials in this series? I'm very curious what's next to come!!!
user avatar
catlikecoding - 26 Apr 20 17:50
A little more movement stuff before we transition to avatar animation.
Custom SRP: LOD and Reflections
Custom SRP: LOD and Reflectionsmore_vert
2020-03-30T17:59:28+00:00
Post file flag
Custom SRP: LOD and Reflections 2020-03-30T17:59:28+00:00close

This time we extend our custom RP with support for LOD groups and reflections. We keep the reflections simple, specifically one probe per object, no box projections.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
LOD and Reflections

Description
Adding Details Use LOD Groups. Cross-Fade between LOD levels. Reflect the environment by sampling a reflection probe. Support optional Fresnel reflections. Many small objects add details to a scene and make it more interesting. However, details that are too small to cover multiple pixels degrade into indistinct noise.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/lod-and-reflections/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/lod-and-reflections/tutorial-image.jpg
Comments (2)
user avatar
User #32959968 - 3 Apr 20 08:22
I love this series. Such a complex topic and it could not be better explained <3
user avatar
catlikecoding - 3 Apr 20 09:44
Glad you like it!
Movement: Complex Gravity
Movement: Complex Gravitymore_vert
2020-03-27T14:56:00+00:00
Post file flag
Movement: Complex Gravity 2020-03-27T14:56:00+00:00close

Walking on a sphere isn't cool enough. So we add support for planes and boxes as well. Still not enough? What about multiple gravity sources at the same time? Have fun jumping from sphere to sphere to box!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Complex Gravity

Description
Gravity Planes, Spheres, and Boxes Support multiple gravity sources. Limit the range of gravity. Make gravity decrease with distance. Create planar, spherical, and box-shaped gravity sources. If you only ever need the same gravity source then the approach introduced in the previous tutorial can suffice.

URL
https://catlikecoding.com/unity/tutorials/movement/complex-gravity/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/complex-gravity/tutorial-image.jpg
Comments (4)
user avatar
User #33807001 - 18 Apr 20 12:43
Thank you so much for this series! Just FYI this exact tutorial made me your patron ;)
user avatar
catlikecoding - 18 Apr 20 13:50
Glad to be useful!
user avatar
User #31679756 - 14 Apr 20 16:50
This is incredible. Thank you Catlike! Now to make an outerwilds lookalike for a game jam... hehehe
user avatar
catlikecoding - 15 Apr 20 11:10
You're welcome!
Custom SRP: Shadow Masks
Custom SRP: Shadow Masksmore_vert
2020-02-27T17:32:14+00:00
Post file flag
Custom SRP: Shadow Masks 2020-02-27T17:32:14+00:00close

This time we deal with the truly mixed lighting modes: those that mix realtime lighting and shadows with baked shadows!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Shadow Masks

Description
Baking Direct Occlusion Bake static shadows. Combine realtime lighting with baked shadows. Mix realtime and baked shadows. Support up to four shadow mask lights. The advantage of using a light map is that we're not limited to a max shadow distance. Baked shadows don't get culled, but they also cannot change.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/shadow-masks/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/shadow-masks/tutorial-image.jpg
Comments (4)
user avatar
User #22944615 - 27 Feb 20 17:48
Thanks a lot, very useful tutorial series, with rare and non-trivial information!
user avatar
catlikecoding - 28 Feb 20 21:53
My pleasure!
user avatar
User #6136435 - 11 Mar 20 20:25
I can only second that. How did you learn all of this yourself? Unity documentation is very fragmented. Do you read its source code?
user avatar
catlikecoding - 11 Mar 20 22:04
Yes. Most of the info for this tutorial came from the built-in RP shaders and include files, plus experimentation.
Movement: Custom Gravity
Movement: Custom Gravitymore_vert
2020-02-22T16:30:59+00:00
Post file flag
Movement: Custom Gravity 2020-02-22T16:30:59+00:00close

In this tutorial we leave the limitations of uniform gravity behind and make it possible to walk on the outside of a sphere. Or on the inside of it.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Custom Gravity

Description
Walking on a Sphere The Orbit Camera tutorial changed a bit. Section 1.3 Responsiveness became 1.3 Focus Radius and 1.4 Centering the Focus was added. It's now easier to configure and frame-rate independent. I also added section 4.3 Focus Radius and included diagrams. Support arbitrary gravity. Work with a variable up axis.

URL
https://catlikecoding.com/unity/tutorials/movement/custom-gravity/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/custom-gravity/tutorial-image.jpg
Custom SRP: Baked Light
Custom SRP: Baked Lightmore_vert
2020-01-31T14:54:03+00:00
Post file flag
Custom SRP: Baked Light 2020-01-31T14:54:03+00:00close

This time we cover baking light in the Custom SRP series. Light maps, light probes, and light probe proxy volumes. We also consolidate the shader input in a single file so we don't have to redefine it for each pass, as we now also need a meta pass.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Baked Light

Description
Light Maps and Probes I reduced the culling factor in Shadows.RenderDirectionalShadows a bit, to avoid some corner cases where shadows could disappear in cascade transition zones: float cullingFactor = Mathf.Max(0f, 0.8f - settings.directional.cascadeFade); Bake static global illumination. Sample light maps, probes, and LPPVs. Create a meta pass. Support emissive surfaces.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/baked-light/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/baked-light/tutorial-image.jpg
Comments (4)
user avatar
User #29270359 - 2 Feb 20 08:51
Thank you, I will learn and wait for more about this series.
user avatar
catlikecoding - 2 Feb 20 12:19
You're welcome!
user avatar
catlikecoding - 2 Feb 20 12:19
You're welcome!
Movement: Orbit Camera
Movement: Orbit Cameramore_vert
2020-01-26T14:00:55+00:00
Post file flag
Movement: Orbit Camera 2020-01-26T14:00:55+00:00close

This time we pull back from the sphere a bit and instead concern ourselves with the camera. We'll create a third-person orbit camera that focuses on the sphere. We also adjust the sphere so we control its movement relative to the camera's point of view.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Orbit Camera

Description
Relative Control Create an orbiting camera. Support manual and automatic camera rotation. Make movement relative to the camera. Prevent the camera from intersecting geometry. A fixed point of view only works when the sphere is constrained to an area that is completely visible. But usually characters in games can roam about large areas.

URL
https://catlikecoding.com/unity/tutorials/movement/orbit-camera/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/orbit-camera/tutorial-image.jpg
Custom SRP: Directional Shadows
Custom SRP: Directional Shadowsmore_vert
2019-12-30T18:12:27+00:00
Post file flag
Custom SRP: Directional Shadows 2019-12-30T18:12:27+00:00close

We wrap up 2019 with part 4 of the SRP series, and it is massive! All of our directional lights get cascaded shadow maps in one large atlas, with filtering up to PCF 7x7, cascade blending, semitransparent shadow casters, and more. Enjoy!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Directional Shadows

Description
Cascaded Shadow Maps Render and sample shadow maps. Support multiple shadowed directional lights. Use cascaded shadow maps. Blend, fade, and filter shadows. When drawing something the surface and light information is enough to calculating lighting. But there could be something in between both that blocks the light, casting a shadow on the surface that we're drawing.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/directional-shadows/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/directional-shadows/tutorial-image.jpg
Movement: Surface Contact
Movement: Surface Contactmore_vert
2019-12-12T16:45:29+00:00
Post file flag
Movement: Surface Contact 2019-12-12T16:45:29+00:00close

Part 3 of the movement series is here! Dive in to make your sphere stick to the ground, navigate stairs, escape from crevasses, and wall jump!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Surface Contact

Description
Staying in Touch Stick to the ground instead of launching off a ramp. Perform a raycast. Configure multiple layers and their interaction. Navigate stairs. Make use of steep contacts. When our sphere reaches the top of a ramp it goes flying, due to its upward momentum. This is realistic, but might not be desirable.

URL
https://catlikecoding.com/unity/tutorials/movement/surface-contact/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/surface-contact/tutorial-image.jpg
Comments (4)
user avatar
User #14134674 - 12 Dec 19 17:15
I am so happy about these physics tutorials! Thank you for great job. So worth it :-)
user avatar
catlikecoding - 12 Dec 19 18:50
You're welcome!
user avatar
User #2998159 - 12 Dec 19 22:38
Each time I get the email about a new tutorial in this Movement series I get unreasonably excited! Thanks, Jasper!
user avatar
catlikecoding - 13 Dec 19 10:17
I guess you really like to move it!
Custom SRP: Directional Lights
Custom SRP: Directional Lightsmore_vert
2019-11-30T16:23:40+00:00
Post file flag
Custom SRP: Directional Lights 2019-11-30T16:23:40+00:00close

The third Custom SRP tutorial dives into lighting. We limit ourselves to directional lights only, but that's already a lot of ground to cover. It works through topics that got covered by multiple tutorials of the old SRP series, besides using a new approach.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Directional Lights

Description
Direct Illumination Use normal vectors to calculate lighting. Support up to four directional lights. Apply a BRDF. Make lit transparent materials. Create a custom shader GUI with presets. If we want to create a more realistic scene then we'll have to simulate how light interacts with surfaces.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/directional-lights/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/directional-lights/tutorial-image.jpg
Comments (2)
user avatar
User #3493630 - 24 May 20 21:17
Thank you for the awesome tutorials! I think BRDF.hlsl:L39 "float normalization = brdf.roughness * 4.0 + 2.0;" disagrees with the specular strength formula in paragraph 3.9 that says n = 4r - 2? I believe the code is correct and the formula should say n = 4r + 2.
user avatar
catlikecoding - 25 May 20 10:11
Good catch! The text is wrong, it's 4r + 2. Fixed it.
Movement: Physics
Movement: Physicsmore_vert
2019-11-19T17:11:47+00:00
Post file flag
Movement: Physics 2019-11-19T17:11:47+00:00close

The second Movement tutorial is here! We're diving into the world of physics, handing control of our sphere to PhysX while still pushing it toward a desired velocity.

It's also #ThankYouPatrons day. Hey! Thank you all for making it possible to create these tutorials!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Physics

Description
Pushing a Sphere Around Control the velocity of a rigidbody sphere. Support vertical movement via jumping. Detect the ground and its angle. Use a ProBuilder to create test levels. Move along slopes. In the previous tutorial we constrained our sphere to remain inside a rectangular area.

URL
https://catlikecoding.com/unity/tutorials/movement/physics/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/physics/tutorial-image.jpg
Comments (9)
user avatar
User #10772213 - 4 Feb 20 20:47
Just played around with the project for a bit and noticed a few things: * The sphere sticks to walls too much. If I'm trying to pass by the right side of a box and run into the corner, I can't just keep pressing up+right to shimmy past it . * If you run and jump the air acceleration will add to the speed you already gained from running. This feels weird. I'm guessing this is an unintended side-effect of being able to change direction in mid air? btw: I'm not criticizing, I'd just love to see good solutions to these issues! Making a good character controller is hard, yet it's one of the most important things in any game. I'll definitely keep a close eye on this one!
user avatar
catlikecoding - 4 Feb 20 22:22
* The velocity component going straight into the wall gets eliminated, absorbed by the collision (assuming the wall is immovable, otherwise it'll get pushed). So if you steer into a wall at 45 degrees you'll slide along at ~70% speed. That's the nature of physics. If you want to maintain maximum speed even when deflected you could project the desired velocity on the wall's contact plane and rescale, like we already do for the ground. You'll have to deal with shenanigans from multiple concurrent contact types though. * Yes, air acceleration applies when not on the ground, always. The weirdness comes from low acceleration. Typically, player acceleration is very high and max speed is reached real quick, so air acceleration doesn't change speed anymore after jumping.
user avatar
User #2998159 - 19 Nov 19 21:12
I've just skimmed through this tutorial but I'm so excited to see the things you've covered. I'm sure this will become the "Bible" for any future character movements for me! Will you by chance be covering things like input buffering (pressing jump a few frames before being grounded) and ghost jumping (pressing jump a few frames after leaving an edge)? Those are two things I'd also enjoy seeing your approach too as your solutions are always so thorough and well considered! Looking forward to working through this one and can't wait for the next. Thanks heaps, Jasper!
user avatar
User #2998159 - 19 Nov 19 21:14
One suggestion to the formatting: Would it be possible to have a collapsible linked Contents to the headings in each page? They're quite long and it would make repeat trips to the page a much nicer UX and also provide a nice overview. (Keeping it collapsed by default would ensure it didn't take up a heap of space unless you need it)
user avatar
catlikecoding - 20 Nov 19 11:13
I'm focusing on the movement itself first. After that I can add in more specific control techniques input buffering and ghost jumping.
user avatar
catlikecoding - 20 Nov 19 11:14
I'll look into adding a table of contents when I'll find time for it.
user avatar
User #2998159 - 24 Nov 19 21:59
Sounds great! Look forward to the next one.
user avatar
catlikecoding - 7 Feb 20 21:02
You got your contents! It should appear at the top right of tutorial pages (except really old ones). Looks like the "switch theme" toggle but on the right, expanding to a table of contents.
user avatar
User #2998159 - 7 Feb 20 21:34
That's awesome, thanks, Jasper! Hopefully people don't miss it and find it useful like I do.
Custom SRP: Draw Calls
Custom SRP: Draw Callsmore_vert
2019-10-31T15:05:19+00:00
Post file flag
Custom SRP: Draw Calls 2019-10-31T15:05:19+00:00close

We continue building our custom SRP, this time creating an unlit shader and figuring out how to draw things efficiently. It's covering old ground from the previous SRP series, including a crash-course of writing shaders because some people today have only used the shader graph. But it goes fast and has enough new stuff to keep you on your toes, including the SRP batcher and drawing a thousand meshes at once!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Draw Calls

Description
Shaders and Batches White a HLSL shader. Support the SRP batcher, GPU instancing, and dynamic batching. Configure material properties per object and draw many at random. Create transparent and cutout materials. To draw something the CPU has to tell the GPU what to draw and how. What is drawn is usually a mesh.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/draw-calls/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/custom-srp/draw-calls/tutorial-image.jpg
Movement: Sliding a Sphere
Movement: Sliding a Spheremore_vert
2019-10-25T15:36:38+00:00
Post file flag
Movement: Sliding a Sphere 2019-10-25T15:36:38+00:00close

A new series has begun! It's a beginner-level series about character movement. We start simple, by sliding a sphere around on a plane. This involves changing position, velocity, and acceleration. We also make the sphere bounce off edges. This experience prepares us for more complex movement in the future.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Sliding a Sphere

Description
Player-Controlled Motion Put a sphere with a trail on a plane. Position the sphere based on player input. Control velocity and acceleration. Limit the sphere's position and make it bounce off edges. Many games are about a character that has to move around to accomplish some goal.

URL
https://catlikecoding.com/unity/tutorials/movement/sliding-a-sphere/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/movement/sliding-a-sphere/tutorial-image.jpg
Comments (2)
user avatar
User #2998159 - 25 Oct 19 21:23
I'm super-excited to see you return to a beginner series, Jasper! I can't wait to see what this leads up to. Thanks heaps!
user avatar
catlikecoding - 26 Oct 19 20:04
Cheers! It's going to be fun.
Custom Render Pipeline
Custom Render Pipelinemore_vert
2019-09-26T13:26:40+00:00
Post file flag
Custom Render Pipeline 2019-09-26T13:26:40+00:00close

Here is the first part of Custom SRP, my new series covering the scriptable render pipeline in Unity 2019 and later.

This first installment is mostly an upgrade from the old experimental API to the current one. But it also introduces a dedicated camera-renderer, segregates code more, uses partial classes, and covers rendering with multiple cameras.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Custom Render Pipeline

Description
Taking Control of Rendering I have another tutorial series covering the scriptable render pipeline, but that one uses the experimental SRP API which only works with Unity 2018. This series is for Unity 2019 and later. This series takes a different and more modern approach but will cover at lot of the same topics.

URL
https://catlikecoding.com/unity/tutorials/custom-srp/custom-render-pipeline/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/image-quality/tutorial-image.jpg
Tower Defense: Animation
Tower Defense: Animationmore_vert
2019-09-19T13:43:07+00:00
Post file flag
Tower Defense: Animation 2019-09-19T13:43:07+00:00close

The final part of the Tower Defense series is about animating enemies. We record our own animations and play them by creating a playable graph. Then we also import an existing model and animations from the asset store and make those work as well.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Animation

Description
Lively Enemies Record animations. Create playable graphs to animate enemies. Mix animations to transition between them. Use existing models and animations. Up to this point our enemies simply slide across the board. This can be fine for an abstract game that uses cubes and spheres for enemies, but even such enemies can be made more interesting by making them move in a more organic way.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/animation/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/animation/tutorial-image.jpg
Comments (8)
user avatar
User #4200785 - 19 Sep 19 14:47
What are the advantages of using Playables and Playable Graph over the Animator Controller?
user avatar
catlikecoding - 19 Sep 19 15:29
The animation controller has a lot more going on to support complex state machines, while at the same time being fixed as designed. Our custom animator is lightweight and works with a variable animation configuration. So we don't have to create a dedicated controller per animation set. It would also be easy to include sounds, which the animation controller would have to do via event messages.
user avatar
User #4200785 - 19 Sep 19 15:30
I understand, thank you!
user avatar
User #8027618 - 21 Sep 19 07:21
Any hints on the next tutorial series? It would be awesome to see more large projects like the Hex Map.
user avatar
catlikecoding - 21 Sep 19 15:51
Some people are gonna be happy! But not, it won't be as large as Hex Map. That one took more that two years to complete.
user avatar
User #2998159 - 19 Sep 19 22:03
Hey Jasper, I just want to say thank you for these tutorials, despite them being too advanced for me. They're god-tier for presentation and I hope one day you can do some more beginner to intermediate tutorials.
user avatar
catlikecoding - 20 Sep 19 10:26
Just take 'em slow and steady! You can do this one after the basics and object management series.
user avatar
User #2998159 - 22 Sep 19 23:17
If I'm completely honest about my skill level, I feel like I need more in the beginner series. Even some of those are testing of my understanding of Unity and maths (which is fine because that's how you learn) but there's a pretty big gap between those and the other series for a newbie programmer! Regardless, I look forward to seeing what you come up with next and I'm happy there are such great tutorials available for other, more advanced game devs.
SRP: Image Quality
SRP: Image Qualitymore_vert
2019-08-31T16:44:39+00:00
Post file flag
SRP: Image Quality 2019-08-31T16:44:39+00:00close

The final installment of the SRP series deals with render scale, MSAA, and HDR to make our images as pretty as possible.

The last installment? Yes. I end the current SRP series here. I will follow it up with a new modern SRP series that will both upgrade everything to Unity 2019 and also introduce new techniques that will make it worthwhile to go through it again. This isn't a simple API upgrade, it's much more! I have a lot in the pipeline but still have to work out how exactly to approach this, because it turns out to be quite modular.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Image Quality

Description
Render scale, MSAA, and HDR Adjust the render scale. Support MSAA. Enable HDR, with optional tone mapping. The camera determines the width and height of the image that gets rendered, that's out of control of the pipeline. But we can do whatever we want before rendering to the camera's target.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/image-quality/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/image-quality/tutorial-image.jpg
Comments (2)
user avatar
User #22944615 - 2 Sep 19 08:59
OK, I'll wait impatiently for new posts about SRP/HDRP/URP. A difficult and very necessary topic.
user avatar
catlikecoding - 2 Sep 19 18:55
There is indeed still lots more to cover!
Tower Defense: Scenarios
Tower Defense: Scenariosmore_vert
2019-08-22T15:02:09+00:00
Post file flag
Tower Defense: Scenarios 2019-08-22T15:02:09+00:00close

It's getting rather cozy on the board, because we're spawning waves of enemies! Small, medium, big, cubes and spheres, all spawned according to a scenario. Survive all waves and win the game! Unless it's a survival scenario and it goes on until your unavoidable demise.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Scenarios

Description
Waves of Enemies Support small, medium, and large enemies. Create game scenarios with multiple enemy waves. Separate asset configuration and gameplay state. Begin, pause, win, lose, and speed up games. Make scenarios repeat and go on forever. Always spawning the same blue cube enemy isn't very interesting.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/scenarios/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/scenarios/tutorial-image.jpg
SRP: Post-Processing
SRP: Post-Processingmore_vert
2019-07-31T13:42:11+00:00
Post file flag
SRP: Post-Processing 2019-07-31T13:42:11+00:00close

Unity has multiple post-processing solutions. There's the old OnRenderImage approach, there's the PPV2 stack, and there's the upcoming new stacks specific to the LW/Universal and HD render pipelines. And now we're going to make our own.

Post-processing solutions can be quite complex, but for this series we keep it as simple as possible, to give you an idea of how to set one up yourself. We make a separate stack asset, allow configuration per camera, and create example blur and depth stripes effects.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Post-Processing

Description
Full-Screen Effects Create a post-processing stack asset. Use render textures. Draw a full-screen triangle. Apply a multi-step blur effect and depth-based stripes. Configure a stack per camera. I have removed the reliance on VPOS from the previous tutorial. I recommend that you revisit it if you went through it while VPOS was still used.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/post-processing/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/post-processing/tutorial-image.jpg
Comments (2)
user avatar
User #22523341 - 1 Aug 19 01:36
Can you write some article about ue4?
user avatar
catlikecoding - 1 Aug 19 09:56
Maybe in the far future.
Tower Defense: Ballistics
Tower Defense: Ballisticsmore_vert
2019-07-21T18:37:39+00:00
Post file flag
Tower Defense: Ballistics 2019-07-21T18:37:39+00:00close

We expand our game with support for mortar towers. This involves calculating ballistic trajectories so we know how to launch our explosive shells. So there's a bunch of math, safely hidden away in asides for those who are curious.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Towers

Description
Lobbing Explosives Support more than one tower type. Create a mortar tower. Calculate parabolic trajectories. Launch explosive shells. Laser aren't the only kind of weaponry that we could mount on a tower. In this tutorial we'll add a second tower type that lobs shells that explode on impact and damage all nearby enemies.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/ballistics/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/ballistics/tutorial-image.jpg
SRP: Level of Detail
SRP: Level of Detailmore_vert
2019-06-28T18:36:57+00:00
Post file flag
SRP: Level of Detail 2019-06-28T18:36:57+00:00close

In this part of the SRP series we're taking a look at LOD groups. We add support for cross-fading LOD levels by clipping with a screen-space blue noise bias. Once that's done we implement shader variant stripping to limit how many shader variants get included in builds, because each feature we add that depends on a multi-compile keyword creates lots more variants.

In other news, Unity is working on that one bug, but they're no longer displaying assigned priories and release schedules in the public issue tracker. So let's see how long it takes.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Level of Detail

Description
Cross-Fading Geometry Design regular and additive LOD groups. Cross-fade LOD levels. Apply screen-space dithering. Use an animated dither pattern. Strip unused shader variants. Ideally, we render as little as possible. The fewer gets rendered, the less strain there is on the GPU, which means that we can get a higher frame rate and require less energy to render the scene.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/level-of-detail/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/level-of-detail/tutorial-image.jpg
Tower Defense: Towers
Tower Defense: Towersmore_vert
2019-06-22T11:37:10+00:00
Post file flag
Tower Defense: Towers 2019-06-22T11:37:10+00:00close

Our tower defense game gets its titular element! Put towers on the board, have them acquire a target, track it, and apply the heat with a laser beam.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Towers

Description
Shooting Enemies Put towers on the board. Target enemies with the aid of physics. Keep track of them for as long as possible. Shoot them with a laser beam. Walls only slow enemies down by increasing the length of the path that they have to travel.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/towers/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/towers/tutorial-image.jpg
Comments (1)
user avatar
catlikecoding - 22 Jun 19 14:11
I wasn't happy about tracking so I changed it from using a fixed 0.5 bias to taking the enemy scale into account.
Vote on SRP Unity Bug 2019-06-18T14:59:07+00:00

During the process of upgrading the SRP series to Unity 2019 I have encountered a Unity bug that I consider a showstopper. In short, all light indices beyond the fourth per object are broken.

The issue has been reproduced and is in the issue tracker. It currently has a low priority. I'd like to get it fixed before publishing the upgrade. Please vote on the issue to get Unity Technologies to focus on it. Let's see how many votes it can get!

flag

Embed data

Provider
Unity3d

Provider URL
Unity3d

Subject
Unity IssueTracker - [SRP] unity_LightIndices[1] are identical to every object and are set per frame

Description
How to reproduce: 1. Open the attached "case_1155879-LightIndices" project 2. Move around the Scene and inspect how the spheres are ...

URL
https://issuetracker.unity3d.com/issues/srp-unity-lightindices-1-are-identical-to-every-object-and-are-set-per-frame

HTMLplay_arrow

None
Comments (18)
user avatar
User #2313917 - 18 Jun 19 15:13
You have my bow.
user avatar
catlikecoding - 18 Jun 19 15:20
Excellent! I'll shoot for the stars.
user avatar
User #10274295 - 19 Jun 19 05:11
Now 80 votes! Your patrons are unified.
user avatar
catlikecoding - 19 Jun 19 09:22
Yes! 90+ and currently most-voted of the active issues.
user avatar
User #6830964 - 18 Jun 19 15:53
Done
user avatar
catlikecoding - 18 Jun 19 18:36
Superb!
user avatar
User #10418361 - 18 Jun 19 15:22
done~
user avatar
catlikecoding - 18 Jun 19 15:45
Cheers!
user avatar
User #5365943 - 18 Jun 19 15:38
You have my vote! Hope this gets resolved soon!
user avatar
catlikecoding - 18 Jun 19 15:45
Thanks! Me too.
user avatar
User #9884021 - 18 Jun 19 15:01
Done!
user avatar
catlikecoding - 18 Jun 19 15:07
Thanks! That's ten already.
user avatar
User #289908 - 18 Jun 19 17:11
Reached 41 !!!
user avatar
catlikecoding - 18 Jun 19 18:36
50+!
user avatar
User #3955691 - 18 Jun 19 17:12
done
user avatar
catlikecoding - 18 Jun 19 18:36
Thanks man.
user avatar
User #10493745 - 18 Jun 19 23:27
Voted. Could we also take a look on this bug project :D? (seems no download link for users on issue tracker page)
user avatar
catlikecoding - 19 Jun 19 09:21
Public issues are written by Unity Technologies themselves, referring the original bug report, which remains private. In this case it's a stripped-down part of the SRP series.
Baked Shadows
Baked Shadowsmore_vert
2019-05-31T15:50:41+00:00
Post file flag
Baked Shadows 2019-05-31T15:50:41+00:00close

We move on from global illumination to mixed lighting, which means combining realtime lighting with baked shadows. Or the other way around, in case of subtractive lighting.

This tutorial is still for Unity 2018. The upgrade of the SRP series to 2019 is progressing, but not finished yet. It's a lot of work not only due to API changes but also because I'm adding and improving some stuff along the way.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Baked Shadows

Description
Mixed Lighting Fade realtime shadows. Apply a shadowmask and shadow probes. Use up to four baked shadows per object. Choose between normal and distance shadowmask mode. Support subtractive lighting. Realtime lighting with shadows is expensive to render. Baked lighting is much cheaper, but doesn't contain specular reflections and cannot change at runtime.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/baked-shadows/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/baked-shadows/tutorial-image.jpg
Comments (2)
user avatar
User #10493745 - 31 May 19 16:36
Even though I have realized it in my project, I found that I'm not doing well in all parts after going through your tutorial. Thank you for the thoughtful consideration coding this part :3
user avatar
catlikecoding - 1 Jun 19 10:23
Glad to help!
Tower Defense: Enemies
Tower Defense: Enemiesmore_vert
2019-05-11T18:49:50+00:00
Post file flag
Tower Defense: Enemies 2019-05-11T18:49:50+00:00close

The second tower defense installment is here, and it introduces enemies! Their movement starts simple but we gradually make it more interesting.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Enemies

Description
Moving Through a Maze Place spawn points. Make enemies appear and move across the board. Create smooth motion with constant speed. Vary enemy size, speed, and placement. Before we can spawn enemies we need to decide where to place them on the board. We'll create spawn points for that.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/enemies/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/enemies/tutorial-image.jpg
SRP: Global Illumination
SRP: Global Illuminationmore_vert
2019-04-29T20:27:15+00:00
Post file flag
SRP: Global Illumination 2019-04-29T20:27:15+00:00close

This installment of the Scriptable Render Pipeline series covers the big subject of indirect lighting in one go, both static and dynamic, with light maps, probe groups, LPPVs, and emission.

Shadow masks aren't part of this, because they are for direct lighting. I'll cover them later.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Global Illumination

Description
Indirect Lighting Bake and sample light maps. Show indirect light. Create emissive materials. Sample lighting via probes and LPPVs. Support precomputed realtime global illumination. There were two bugs in previous tutorials that you'll have to fix if you did them a while ago. First, when rendering cascading shadows only, the squares shadow distance must also be set.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/global-illumination/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/global-illumination/tutorial-image.jpg
Comments (1)
user avatar
catlikecoding - 30 Apr 19 14:32
I updated some asides about GPU instancing.
Tower Defense: The Board
Tower Defense: The Boardmore_vert
2019-04-25T10:39:01+00:00
Post file flag
Tower Defense: The Board 2019-04-25T10:39:01+00:00close

We have a new series, and it's about creating a game! Specifically, a tile-based tower defense game. The first installment covers the board, including pathfinding and the placement of destinations and walls.

The tower defense game comes after Object Management. It uses things that we learned from that series, like factories, although we won't spend much time on repeating the same work.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
The Board

Description
Building a Maze Create a tiled board. Find paths with breadth-first search. Support empty, destination, and wall tiles. Edit tile content in play mode. Optional show grid and path visualizations. Tower defense is a game genre where the goal is to destroy hordes of enemies before they reach their destination.

URL
https://catlikecoding.com/unity/tutorials/tower-defense/the-board/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/tower-defense/the-board/tutorial-image.jpg
New Goal: Fundamental Pages 2019-03-31T16:30:25+00:00

I have added a new goal. Once it's reached, I'll begin adding pages to my website that cover fundamental principles and theories. You can think of them as super asides that deserve their own page. They're not specific to Unity but are about the underlying concepts that we use all the time. Topics will range from what a number actually is to the specifics of BRDFs.

Reaching this goal will make it possible for me to write about stuff that I've wanted to cover for a long time but doesn't fit in any specific tutorial.

flag
Comments (4)
user avatar
User #13587743 - 30 Apr 19 11:29
It sure would be wonderful
user avatar
User #12849533 - 14 Apr 19 17:50
That would be awesome! I think this is a necessary thing. We all need it. I really like your work and appreciate all that you do. Hope your goal will be achieved.
user avatar
User #9884021 - 31 Mar 19 18:41
Wow, I need this.
user avatar
catlikecoding - 1 Apr 19 10:20
Let's make it happen!
SRP Reflections
SRP Reflectionsmore_vert
2019-03-30T16:29:06+00:00
Post file flag
SRP Reflections 2019-03-30T16:29:06+00:00close

We're going to enhance our scriptable render pipeline with reflections! Specular highlights, fresnel, and environment maps. All those were already covered by the Rendering series, but now we're doing it ourselves in our own pipeline.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Reflections

Description
Specular and Environmental Add specular highlights. Reflect the environment. Support non-uniform scaling. Work with reflection probes. Combine reflections and transparency. Up to this point we've only used simple diffuse lighting, without any highlights. We're going to change that now, adding support for specular lighting. We'll used the same model that's used in Unity's Lightweight render pipeline.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/reflections/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/reflections/tutorial-image.jpg
More Complex Levels
More Complex Levelsmore_vert
2019-03-22T19:16:34+00:00
Post file flag
More Complex Levels 2019-03-22T19:16:34+00:00close

The final part of the Object Management tutorial has arrived! It adds automatic spawn zones, kill and life zones, centralized level updating, and a little convenient editor functionality.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
More Complex Levels

Description
Spawn, Kill, and Life Zones Make spawning automatic. Create zones antithetical to or essential for life. Control which zones affect which shapes. Centralize level object updates and add editor support. Use partial classes. When behavior removal got added earlier, I forgot to add a line of code to recycle the behavior.

URL
https://catlikecoding.com/unity/tutorials/object-management/more-complex-levels/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/more-complex-levels/tutorial-image.jpg
Comments (6)
user avatar
User #289908 - 22 Mar 19 20:40
Who would have thought that Unity object mgt could be evolved to such levels! And, what I really learned (or am struggling to learn) is the power and malleability of Python classes. Seems like a visual of that hierarchy (network?) would be useful (necessary?). Probably homework for us students. Thanks...
user avatar
catlikecoding - 23 Mar 19 15:30
You could generate a C# class diagram from the code. Some Visual Studio versions make that easy. But cramming everything in a single diagram would make things appear more complex than necessary, due to information overload. Many parts exist in isolation.
user avatar
catlikecoding - 23 Mar 19 15:36
For example, you have all the behavior types that each extend ShapeBehavior, which in turn extends ScriptableObject, but only in the editor. Besides that you have the specific spawn zones that all extend SpawnZone, which extends GameLevelObject, which extends PersistableObject, which in turn extends MonoBehaviour.
user avatar
catlikecoding - 23 Mar 19 15:38
And MonoBehaviour extends Behavior, which extends Component, which extends Object. But that's isn't useful information.
user avatar
User #289908 - 23 Mar 19 19:36
That is simple! Wonder how these class relationships would map into Unity ECS and its Entity, Component, and System. Any feeling whether that would be easy or hard?
user avatar
catlikecoding - 24 Mar 19 10:42
ECS is a different approach, which might be hard initially when you're not used to it. An ECS is best made from scratch and not ported from an OOP approach.
Transparency
Transparencymore_vert
2019-02-28T16:42:50+00:00
Post file flag
Transparency 2019-02-28T16:42:50+00:00close

This time we'll add support for transparency to our pipeline, first alpha clipping and then fading. This tutorial is all about editing shaders, including adding a shader GUI for some convenient functionality.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Transparency

Description
Clipping and Fading Perform alpha clipping. Render both sides of a mesh. Support different blend modes. Generate a double-sided mesh. Create a shader GUI with presets. As explained in Rendering 11, Transparency, it's possible to cut holes in geometry by discarding fragments based on an alpha map.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/transparency/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/transparency/tutorial-image.jpg
Lifecycle
Lifecyclemore_vert
2019-02-19T16:55:02+00:00
Post file flag
Lifecycle 2019-02-19T16:55:02+00:00close

The next part of my object management series deals with growth and death. It can only really be appreciated in action, not with a still image. Instead of just popping in and out of existence, we'll make shapes smoothly grow and shrink. This requires a few changes to the way we keep track of shapes.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Lifecycle

Description
Growth and Death Make shapes grow and shrink. Allow behavior to kill shapes. Delay killing until after the game update loop. Replace immediate shape destruction with shrinking. Whenever a shape is spawned it instantly appears, at full size. Shapes pop into existence without warning, which can be a jarring experience.

URL
https://catlikecoding.com/unity/tutorials/object-management/lifecycle/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/lifecycle/tutorial-image.jpg
Comments (2)
user avatar
User #5004228 - 21 Jun 19 21:34
Hey I have a question about the redundant Kill problem, If I process the kill list immediately after the game update loop, before any other kind of dying can happen, it seems there is no chance of redundant killing ? Or is there something I have not seen or you have considered it and there are other drawbacks in doing that ? I suppose it is good practice to check if a shape is already dead before killing it anyway...
user avatar
catlikecoding - 22 Jun 19 15:54
We have the game update loop, the destruction process, and the population limit all potentially killing shapes. And the next tutorial has kill zones as well. Slow dying complicates this further. It's easiest and safest to treat all of those the same way.
Directional Shadows
Directional Shadowsmore_vert
2019-01-31T20:10:35+00:00
Post file flag
Directional Shadows 2019-01-31T20:10:35+00:00close

After spotlight shadows, we add support for directional shadows. Mixing directional and spotlight shadows requires a little work. Once that's finished, we move on to cascaded shadow maps. We'll define a main light that uses a separate cascaded shadow map to better use our shadow texels.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Directional Shadows

Description
Cascaded Maps Support multiple shadowed directional lights. Control the shadow distance. Define a separate main light. Render and sample a cascaded shadow map. Work with culling spheres. I recently upgraded this tutorial series to Unity 2018.3. If you went through it earlier, see here for the changes.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/directional-shadows/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/directional-shadows/tutorial-image.jpg
Comments (8)
user avatar
User #19340144 - 18 Apr 19 11:58
Hello,thank you for your amazing tutorials! There are some questions I dont understand: Why dont you send the shadow distance as 'globalShadowData' in Function ‘RenderCascadedShadows’(but do so in Function "RenderShadow")?Say that there is a scene with just one directional mainlight, shaders are not going to receive shadow distance paras beacuse there are no 'RenderShadow' but only ‘RenderCascadedShadows’。
user avatar
catlikecoding - 18 Apr 19 14:21
That's an oversight. It's because I only made cascaded shadows honor the shadow distance at the end and forgot to provide the shadow distance for that case. I'll amend that when I publish the next installment. Thanks for pointing it out!
user avatar
User #10493745 - 25 May 19 02:36
https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Rendering.CullingResults.ComputeDirectionalShadowMatricesAndCullingPrimitives.html shadowNearPlaneOffset I found that shadowNearPlaneOffset should not be shadow near plane. Even LWRP did wrong in this part. The offset will push the near plane farther from the far plane so that shadow will still be rendered when camera get too close to a plane which should recieve shadow from a very far object. But I don't know what should be a suitable value for this offset. For now I'm using shadow distance for it.
user avatar
catlikecoding - 25 May 19 08:40
It should be the Near Plane value of the spotlight. You can change its value and observe the shadows very close the light get cut off as it increases.
user avatar
catlikecoding - 25 May 19 08:49
Where the camera is doesn't affect the shadow map, besides culling.
user avatar
User #10493745 - 25 May 19 10:27
Oh sorry I got where the problem is. I tested it in a scene where not all objects have been changed to LWRP shader. Some of them were using error materials. Error material can still cast shadow in LWRP, but they will not be rendered in directional light's shadow map if the player's camera is too far. By setting the near plane offset to a big value exactly fixed this. So I guess it's something else than near plane value.(only directional light compute function have this argument, none with the spot or point light) Maybe error materials are ignored when unity decides where the directional light's 0-plane is. This offset will push the 0-plane backward after all. (the plane goes backward when value is positive. So maybe 0 is the default value?)
user avatar
User #10493745 - 25 May 19 10:34
Since we already provided the light Index for ComputeDirectionalShadowMatricesAndCullingPrimitives(), it's werid to provide the near plane value again. In fact I don't quite know if there are some situations where this offset argument will be useful(as long as we don't use error materials XD)
user avatar
catlikecoding - 25 May 19 17:52
It's needed to set up the directional shadow matrices and makes it possible to override it. It's typically left alone unless there are some shadow issues.
Satellites
Satellitesmore_vert
2019-01-22T16:53:30+00:00
Post file flag
Satellites 2019-01-22T16:53:30+00:00close

This installment of my Object Management series adds a satellite behavior to the game, which makes shapes orbit other shapes. It's more complex than the other behavior, because we have to keep track of a relationship between shapes, which has to be saved and become invalid when a shape gets recycled. Also, when a satellite's focus is gone it becomes free and its behavior can be removed.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Satellites

Description
Shape Relationships Spawn multiple shapes at once. Make a shape orbit another shape. Keep track of references to specific shape instances. Enforce a shape population limit. In this tutorial we're going to create a behavior that lets a shape obit another shape, like a satellite.

URL
https://catlikecoding.com/unity/tutorials/object-management/satellites/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/satellites/tutorial-image.jpg
SRP 2018.3 Upgrade 2019-01-09T19:39:24+00:00

I have upgraded the Scriptable Render Pipeline series so it works with Unity 2018.3. There are a few changes.

MyShaderIncludePaths is gone, as that approach is no longer supported. Instead, core library files are included via Packages/com.unity.render-pipelines.core and our own files via a relative include path.

The MyRP folder has been removed. Everything in it has been moved up into My Pipeline.

Updated to core library to version 4.6.0-preview.

The shadow keywords are now declared in const strings.

ConfigureLights and RenderShadows are only invoked if there are any visible lights. When there are no lights, the keywords are disabled, unity_LightIndicesOffsetAndCount is cleared, and PerObjectLightIndices8 is not used. This is needed because otherwise Unity crashes when there are no visible lights.

I also switched the project to use linear light intensity. That's done by setting GraphicsSettings.lightsUseLinearIntensity to true. It's now included in section 2.3 of Lights. To keep the intensity of all lights the same, raise their intensity value to the power of 2.2. You can do that directly in the input field, for example by replacing 7 with 7^2.2.

flag
Spotlight Shadows
Spotlight Shadowsmore_vert
2018-12-30T21:27:23+00:00
Post file flag
Spotlight Shadows 2018-12-30T21:27:23+00:00close

We're adding support for shadows to our pipeline now! We start with spotlight shadows, which are simplest. That's still plenty for one tutorial, because we have to figure out how to deal with up to sixteen shadowed spotlights, while sticking to single-pass forward rendering for the regular camera. We have to store all the shadow maps somewhere...


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Spotlight Shadows

Description
Shadow Maps Both render to and read from a texture. Render from the point of view of a light. Add a shader pass for shadow casters. Sample a shadow map. Support a mix of hard and soft shadows. Combine up to sixteen shadow maps in a single atlas.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/spotlight-shadows/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/spotlight-shadows/tutorial-image.jpg
Comments (2)
user avatar
User #28044438 - 12 Dec 19 06:38
I have a problem that the unity say no valid index light cast shadow ,but i have already set the shadowtype
user avatar
catlikecoding - 12 Dec 19 10:13
Make sure that there's only a single shadow-casting spotlight initially. No other lights.
Shape Behavior
Shape Behaviormore_vert
2018-12-21T18:33:00+00:00
Post file flag
Shape Behavior 2018-12-21T18:33:00+00:00close

The next Object Management tutorial makes our shapes more expressive! We'll create a modular behavior framework that allows shapes to do different things, while still supporting recycling. We limit ourselves to just linear movement, rotation, and oscillation, at least for now. The next tutorial will introduce more complex behavior.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Shape Behavior

Description
Modular Functionality Define abstract and concrete behavior for shapes. Only include behavior when needed. Create a generic method and class. Use conditional compilation. Add a method to an enumeration. Make shapes oscillate. Currently, all shapes move and rotate, but that's not the only thing that they could do.

URL
https://catlikecoding.com/unity/tutorials/object-management/shape-behavior/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/shape-behavior/tutorial-image.jpg
Lights
Lightsmore_vert
2018-11-30T20:31:09+00:00
Post file flag
Lights 2018-11-30T20:31:09+00:00close

It's time that we enhance our render pipeline by supporting lights! We collect lighting data and send it to the GPU, where we perform simple diffuse lighting for directional, point, and spotlights. We do that using single-pass forward rendering, so at most one draw call per object, no matter how many lights affect them.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Lights

Description
Single-Pass Forward Rendering Perform diffuse shading. Support directional, point, and spotlights. Allow up to sixteen visible lights per frame. Calculate up to four pixel lights and four vertex lights per object. To support lights, we have to add a lit shader to our pipeline.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/lights/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/lights/tutorial-image.jpg
More Factories
More Factoriesmore_vert
2018-11-24T19:30:48+00:00
Post file flag
More Factories 2018-11-24T19:30:48+00:00close

This installment of the Object Management series is about working with more than a single factory. It also introduces some complex shapes, so we can identify two types of shapes, each getting their own factory.

Sometimes, I end up creating a tutorial, but then decide that it's actually better to cover a different topic first. This is one of those cases. Dealing with complex shapes and multiple factories first will make the next installment much smoother.

Also, this tutorial is the first to be made available as a Bitbucket repository!


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
More Factories

Description
Where Shapes Come From Create composite shapes. Support multiple colors per shape. Select factories per spawn zone. Keep track of a shape's origin factory. Cubes, spheres, and capsules aren't the only shapes that we can use. We could import any mesh. Also, shapes need not consist of a single object.

URL
https://catlikecoding.com/unity/tutorials/object-management/more-factories/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/more-factories/tutorial-image.jpg
Custom Shaders
Custom Shadersmore_vert
2018-10-31T15:06:03+00:00
Post file flag
Custom Shaders 2018-10-31T15:06:03+00:00close

The second installment of my Scriptable Render Pipeline series goes into writing a custom shader. What's new compared to Rendering 2, Shader Fundamentals is that we're writing an HLSL program instead of a GLSL program and rely on macros defined (and redefined) in Unity's Render Pipeline Core Library. We also cover dynamic batching and GPU instancing, so we end up with an efficient shader that we can use as a starting point for more complex shading later.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Custom Shaders

Description
A Unity Scriptable Render Pipeline tutorial about creating custom shaders, supporting batching and GPU instancing.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/custom-shaders/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/custom-shaders/tutorial-image.jpg
Comments (2)
user avatar
User #4994041 - 14 Nov 18 23:55
I'd love to see an ECS tutorial soon! That would be amazing. I've been considering how would I use ECS for prop generation on a fantasy terrain.
user avatar
catlikecoding - 15 Nov 18 12:08
I'll cover ECS, but not this year.
Configuring Shapes
Configuring Shapesmore_vert
2018-10-25T20:40:19+00:00
Post file flag
Configuring Shapes 2018-10-25T20:40:19+00:00close

Here is the next part of my Object Management series! In it, we'll makes shapes more lively by granting them the ability to rotate and move in a fixed direction. Then we make the game even more interesting by making it possible to configure the shapes per spawn zone. You can have green zones, red zones, fast zones, slow zones, and so on. Finally, we'll make editing these settings more convenient by creating our own property drawers.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Configuring Shapes

Description
Variety of Randomness Make shapes rotate and move. Centralize game updates. Add configuration per spawn zone. Improve the inspector. We can create shapes with varied appearance, but they just sit in place until destroyed. Let's spice things up by making them do something. Specifically, we'll make all shapes spin.

URL
https://catlikecoding.com/unity/tutorials/object-management/configuring-shapes/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/configuring-shapes/tutorial-image.jpg
Video Test 2018-10-08T15:30:26+00:00

You might have noticed that gfycat recently put a white banner underneath all their embedded videos. The banner reduces the available height for the video, scaling it down and adding black bars on its left and right sides. As I use gfycat for tutorial animations, my tutorial pages are also affected.

The banner could become optional at some point, but in the mean time I've experimented with some styling to get rid of it, restoring the videos to their original form. It appears to work, but I'd appreciate it if some of you checked whether it works for you too. Please let me know if it doesn't.

The test case is the Bloom tutorial, which has four videos near the bottom of the page.

flag
Comments (14)
user avatar
User #544170 - 8 Oct 18 15:32
They look fine for me! No white banner visible. I'm on macos Mojave in Safari 12.
user avatar
User #2365404 - 8 Oct 18 15:48
Look great here Chrome on Windows.
user avatar
User #5257007 - 9 Oct 18 05:46
Chrome 69.0.3497.100 Works as expected with a white banner at the bottom. Video scaled so all content is visible but of course with large black bars on the sides. Microsoft Edge 42.17134.1.0 There is no banner at the bottom. All content is visible and no bars on the sides. Microsoft Internet Explorer 11.285.17134.0 All content is visible and no banner, but it does not play (have reloaded the page several times).
user avatar
catlikecoding - 9 Oct 18 12:19
Chrome could be using an old cached CSS filed. Could you try with a fresh load of the CSS? Does IE play the videos on other pages?
user avatar
User #373884 - 8 Oct 18 17:02
Android 7.0 Chrome: they won't automatically play unless I tap them.
user avatar
catlikecoding - 9 Oct 18 12:20
I think that's a feature. In any case, that's not under my control.
user avatar
User #5257007 - 9 Oct 18 12:59
You are right about the cached CSS file in Chrome. I now get the same eperience on both Chrome and Edge. Looks good. Still problem med IE. I have tried a different computer (also with IE 11.285.17134.0) and it does not play any movies from Gfycat. Nothing happens if I press the play button, nor can I fast-forward.
user avatar
catlikecoding - 9 Oct 18 13:53
Looks like that's a general gfycat problem. Luckily, almost no one that browses my tutorials uses IE.
user avatar
User #5257007 - 9 Oct 18 16:13
If glyfcat does not seem to bother about it, it can't be many users running the old IE. Happy writing!
user avatar
catlikecoding - 16 Oct 18 16:43
Thanks for the help, everyone! I have applied the changes to all tutorials.
user avatar
User #373884 - 8 Oct 18 17:03
But no banner!
user avatar
User #2396854 - 8 Oct 18 17:42
Seems to be working as expected in Chrome 69 and FF 62 / Win 10
user avatar
User #2344378 - 9 Oct 18 13:43
Working in Firefox on Windows 10
user avatar
User #485124 - 8 Oct 18 15:34
Looks good on Android in Chrome
Goals Update 2018-10-05T10:01:05+00:00

The $1100 goal has been reached, allowing me to get a new laptop. And what a difference it makes! Thank you all for making this possible!

The next goal is $1200 per tutorial. Once we reach that, I will begin making my tutorial projects available via Bitbucket. Much more convenient than downloading and importing a unitypackage file!

I have also added a new goal at $1300: a Discord server! It will be a private server, for all my patrons. Its purpose will be to facilitate discussions and questions about all my tutorials and related things.

flag
Comments (4)
user avatar
User #2980930 - 6 Oct 18 16:40
I like the private discord server goal
user avatar
catlikecoding - 6 Oct 18 18:07
Let's make it happen!
user avatar
User #7774184 - 8 Nov 18 02:54
I've been your patreon for nearly a year!! To show my respect on your free tutorials and contribution to the community.
user avatar
catlikecoding - 8 Nov 18 11:37
Thank you! I really appreciate it.
Custom Pipeline
Custom Pipelinemore_vert
2018-09-30T14:46:35+00:00
Post file flag
Custom Pipeline 2018-09-30T14:46:35+00:00close

It is time to create our own render pipeline! This is the first part of a tutorial series about the new scriptable render pipeline introduced in Unity 2018. The SRP API is still experimental, but has been around long enough that we can move forward and start working with it.

This first installment covers the foundation needed to get a custom pipeline up and running, from creating the pipeline asset and instance, to rendering, to integrating it with the Unity editor.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
Custom Pipeline

Description
Taking Control of Rendering Create a pipeline asset and instance. Cull, filter, sort, render. Keep memory clean. Provide a good editing experience. To render anything, Unity has to determine what shapes have to be drawn, where, when, and with what settings. This can get very complex, depending on how many effects are involved.

URL
https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/custom-pipeline/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/custom-pipeline/tutorial-image.jpg
Comments (4)
user avatar
User #5004228 - 30 Sep 18 14:54
This is amazing!
user avatar
User #2344378 - 30 Sep 18 15:23
Finally! I have been playing around with SRP for a bit but did it mostly by struggling through the undocumented APIs and out of date example projects. I'm glad that a quality SRP tutorial is being out together for others to avoid the same problems.
user avatar
User #2278231 - 30 Sep 18 21:51
Amen, I've been dealing with the same. I love the SRP but it will be a thousand times easier when we've got some decent documentation and tutorials.
user avatar
catlikecoding - 1 Oct 18 09:41
I'll do my best!
More Game State
More Game Statemore_vert
2018-09-21T15:52:11+00:00
Post file flag
More Game State 2018-09-21T15:52:11+00:00close

It's another Object Management tutorial, covering even more game state! Specifically, we're going to save randomness, level data, and creation/destruction speed and progress.

Because level data is already contained in the level scene, we don't have to save all of it. Instead, we only care about level data that could change during play.


Embed data

Provider
Catlikecoding

Provider URL
Catlikecoding

Subject
More Game State

Description
A Unity Object Management tutorial about saving and loading game and level state.

URL
https://catlikecoding.com/unity/tutorials/object-management/more-game-state/

HTMLplay_arrow

https://catlikecoding.com/unity/tutorials/object-management/more-game-state/tutorial-image.jpg
New Goals 2018-09-02T11:48:19+00:00

I added two new goals!

First, at $1100 I will finally be able to replace my 6-year-old laptop. It's starting to show its age.

Second, at $1200 I will make my tutorial projects available via Bitbucket, instead of via the old unitypackage files. This way you can get the entire project, with all its settings. You can also inspect files without having to import them in a Unity project.

flag
Upload

This creator doesn't have any shared files yet. You can add some by clicking Upload.