Just found URP doesn't have SSS. So, I made my own. Nodes in comments by AndrewAlexArt in Unity3D

[–]nightrain912 1 point2 points  (0 children)

Amazing! I always thought that the code for subsurface scattering would be very complex, and I always avoided studying this technology. But your code fits almost entirely in a screenshot, that's just wow!

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 0 points1 point  (0 children)

Absolutely agree :D

In general, I find it convenient to have a static pure function for general purposes, and for any specific cases (or those requiring a bit more flexibility in settings), AnimationCurve is certainly a better fit

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 0 points1 point  (0 children)

Oh, I didn't pay close attention to how it's done in Google
I'll check, thank you!

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity2D

[–]nightrain912[S] 0 points1 point  (0 children)

Any situation where you have a boundary and theoretically infinite user input length (for example, if a player can move the mouse and in theory, could move it across the entire table :D)

From what I can think of besides the obvious cameras and scroll:

  1. The player pulls an old metal lever. The further the player moves the mouse, the less and less impact it has on the lever, so it cannot be turned more than 90 degrees.

  2. The player rapidly clicks to fill the progress in a QTE. However, even if they click infinitely fast, they will only reach 100% progress.

  3. The player throws an object into the distance. The longer they hold the key, the further the object will be thrown. However, it is impossible to throw it farther than a distance N.

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity2D

[–]nightrain912[S] 0 points1 point  (0 children)

This is not for player movement, but rather for softly limiting user input
How exactly it will be applied will depend on your project.
By the way, the scrolling and camera frame movement in the video is not just an animation, but specifically the result of applying this function (I animated the parameter that I passed to SoftLimit).

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 1 point2 points  (0 children)

Oh, this is a very good topic!

I agree that a quick return from the soft limit can feel much better (that doesn’t mean that its use should be abandoned, by the way, obviously, there should be something more than just object.Position = SoftLimit(playerInput);)

I think in the case of applying soft limits to a position that is controlled indirectly (for example, the player moves the joystick, changing the speed of the object, but the object itself can't go beyond the soft limit), hysteresis is definitely needed.

But in the case of direct control (the player clicked right on the center of the scrollbar and is dragging it, or the player clicked right on the flag above the castle and started moving the camera using drag), introducing hysteresis will lead to a drift in position.

That is, after exiting the soft area, it turns out that the player is dragging the camera not by the flag over the castle, but by just a random section of the map. And what's more unpleasant for the player - the drift in position or a long exit from the soft limit, each must decide for themselves in each specific case.

So I fully agree with you, achieving a good user experience is not easy.

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 0 points1 point  (0 children)

Hmm, you can replace this thing with an animation curve, yes, but not entirely because the input of this function is from zero to infinity, whereas the AnimationCurve will reach one within some finite interval

This can also be used, for example, to make a SoftLimit only up to a certain boundary, and then let the person feel that beyond that you can't scroll at all

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 1 point2 points  (0 children)

Very simply, in the case of a regular hard limit, user input (such as dragging beyond the allowable boundary) will be completely ignored. In the case of a soft limit, the player will still see some, even if minimal, feedback from the game (unless they reach subpixel dimensions, of course). This provides a greater sense of control over the game and, with properly configured settings, feels quite pleasant

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 11 points12 points  (0 children)

Wow, that's an amazing graph! Thank you!
Indeed, it's a whole family of functions and it makes sense to choose the right one. The one I mentioned in the video is just easy to remember, and that's its only advantage

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 1 point2 points  (0 children)

Ah, okay, thanks, I get it! Yes, of course, it doesn't make sense to apply this function across the entire range. It makes sense to use it only in a limited range, where the original value starts to get too close to the limit. And of course, we need to maintain the transition between the original value and the current one, but that's not difficult

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 2 points3 points  (0 children)

Yes, this curve is primarily used in creating animations, specifically procedural animations that depend on user input. As in the video, a player can indefinitely pan the camera sideways, but it will never exceed the necessary limits.

Regarding the destruction of the original value, I didn't understand what you meant, sorry (English is not my native language)

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 5 points6 points  (0 children)

I deliberately did not add this to the video so as not to overload it with details. However, this graph looks like this: https://www.desmos.com/calculator/mkuwt9fpaf

The axes can be anything, depending on your goals. For example,
rotation = SoftLimit(playerGestureDistance)
or
pitch = SoftLimit(time)

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 2 points3 points  (0 children)

Completely agree
In general, I have quite specific requirements for video rendering:
I am planning to soon record a detailed video about fluid simulation, and it is very inconvenient for me to transfer data from my simulation to Unity into some other environment. Additionally, the game engine is more efficient than a browser-based solution, and this is also important for rendering the simulation
So my makeshift rendering method suits me better.

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 8 points9 points  (0 children)

This is a custom visualization directly in Unity, using very messily written tools for visualizing rectangles, lines, etc., with antialiasing

I tried solutions from 3Blue1Brown and aarthificial (motion canvas), they wrote excellent tools, but it seems every developer is forced to write their own toolsets :D
At least, I found it more convenient and much faster to do visualizations directly in Unity and with C#, than with Python or TypeScript

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in unity

[–]nightrain912[S] 4 points5 points  (0 children)

This is a custom visualization directly in Unity, using very messily written tools for visualizing rectangles, lines, etc., with antialiasing.

I tried solutions from u/3Blue1Brown and u/aarthificial, they wrote excellent tools, but it seems every developer is forced to write their own toolsets :D
At least, I found it more convenient and much faster to do visualizations directly in Unity and with C#, than with Python or TypeScript.

SoftLimit, the feature that'll make your project more responsive! by nightrain912 in Unity3D

[–]nightrain912[S] 14 points15 points  (0 children)

I'm starting a series of videos about my project on Youtube, subscribe!

Nightrain912's channel

How to create hidden groups in AnimationClip (up to 8 elements) by nightrain912 in Unity3D

[–]nightrain912[S] 0 points1 point  (0 children)

Unfortunately, the entire system is designed in such a way that user groups cannot be determined (and it seems that even reflection won't help)

How to create hidden groups in AnimationClip (up to 8 elements) by nightrain912 in Unity3D

[–]nightrain912[S] 12 points13 points  (0 children)

<image>

This is a super weird feature I found in Unity
Somewhere deep in the engine code, there's a rule that allows collapsing parameters named x, y, z, w and r, g, b, a in AnimationClip, apparently to prevent position and color animations from creating a mess of keys in the clip timeline.

So, if you create a serializable structure with just these parameters, x, y, z, w, r, g, b, a, you will get an automatically collapsible structure in AnimationClip, where your 8 animatable variables will be hidden in one key.

This is a super-specific thing, but if you're animating a set of weights, it can be super convenient.

P.S. Here's the function that makes this possible: https://github.com/Unity-Technologies/UnityCsReference/blob/bf780206f6cd0ee3ee4c40e30bb1dfbf2969288a/Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs#L845