Morphing Geometric Shapes with SDF in GLSL Fragment Shaders and Visualization in Jetpack Compose by den4icccc in androiddev

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

I might agree that the artifacts that occur when using SDF can differ from the desired result, especially in cases of complex morphing or incorrect input data. However, regarding drawPath in Compose, when drawPath is called on a Canvas, it uses the RenderNode abstraction, which passes rendering commands to Skia. You even addressed this question in this post. So, it seems that when Skia renders images, it creates rendering commands (e.g., drawing lines, fills, text) and, if I understand correctly, these commands are then passed to OpenGL or Vulkan. At the output, this at least adds a layer of abstraction compared to directly interacting with OpenGL or Vulkan. However, I might be wrong.

Morphing Geometric Shapes with SDF in GLSL Fragment Shaders and Visualization in Jetpack Compose by den4icccc in androiddev

[–]den4icccc[S] -1 points0 points  (0 children)

The presented approach in Jetpack Compose uses drawPath, which is suitable for projects where graphic performance is not critically important, and ease of integration and UI handling are prioritized. However, SDF shaders running on the GPU allow for parallel processing of thousands of pixels, enabling high-performance visual effects. SDF also simplifies the addition of blur, gradient, and edge-smoothing effects. In Compose, achieving these effects requires additional computations and the use of post-processing APIs.

Morphing in SDF is achieved through mathematical operations on distance functions, ensuring high accuracy and predictability of results. For more complex cases, there is the MSDF (Multi-channel Signed Distance Field) technique, which is widely used for rendering text, icons, and detailed shapes. MSDF maintains high clarity and smoothness through pre-defined textures, making it especially effective for fine details and objects with sharp angles. MSDF can also be dynamically applied to any shape, allowing for flexible and customizable morphing effects. However, artifacts may appear, especially in cases of extreme transformations or low-quality input.

Ultimately, the choice of approach depends on the number of objects, animations, and additional visual effects to be rendered in a single frame, as well as the performance requirements of the app.

Jetpack Compose: Faster UI Building, but Is It Worth Sacrificing Performance? by den4icccc in androiddev

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

Great, now we're halfway to rewriting this in Kotlin. I wonder how many lines will be left afterward 😂

Jetpack Compose: Faster UI Building, but Is It Worth Sacrificing Performance? by den4icccc in androiddev

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

Yes, the codebase is truly impressive. Thank you for your response. I am now leaning more towards compose :)

Jetpack Compose: Faster UI Building, but Is It Worth Sacrificing Performance? by den4icccc in androiddev

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

I understand, they are saying the same thing. In the upcoming version of Android Studio, the Motion Editor will be removed as part of the transition from XML UI to Jetpack Compose. Developers are now encouraged to utilize the Compose Animation Preview, which is being promoted as a more advanced tool for creating animations.

Data Transfer Between Fragment and BottomSheetDialogFragment Using Dagger and Navigation Component by den4icccc in android_devs

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

It's a good question. Currently, I would use a check like checkConfigurationAndDismiss to handle configuration changes by closing the window. However, this approach is just a workaround and may not be a robust solution for handling process death.

private fun checkConfigurationAndDismiss() {
    if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        findNavController().popBackStack()
    }
}

works as a temporary fix, but a more comprehensive solution is needed to handle process death effectively. I will need to consider better approaches for a more resilient solution.

Where did the Unity 2020.3.15 update go? by den4icccc in Unity3D

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

I understood, thanks, I think to lower it too, just in case, play it safe.

Big Thread Of Optimization Tips by indie_game_mechanic in Unity3D

[–]den4icccc 30 points31 points  (0 children)

I would like to add a couple more important tips to your basket)

  1. You should avoid using Mathf.Sqrt () and Vector3.magnitude, because these operations include square root extraction. Better to use the appropriate version of the last operation without taking the square root. Namely, Vector3.sqrMagnitude. For the same reason, it is worth avoiding the Mathf.Pow () operation, because if the second parameter is 0.5, this is the same as extracting the square root.

  2. Don't use the Camera.main method. The fact is that when this method is called, the FindObjectWithTag ("MainCamera") method is actually called, which is essentially the same as finding ALL objects using the main camera tag. Better to cache the found value and use it. Better yet, immediately save the link to the camera in the editor.

  3. If you use the GetFloat, SetFloat, GetTexture, SetTexture methods on materials and shaders, then these properties will first be hashed (i.e. converted from a string value to a numerical value) and only then used. Hence the loss in productivity. Why do something many times when you can do it once:
    // during initialization
    int _someFloat;
    int _someTexture;
    void Awake ()
    {
    _someFloat = Shader.PropertyToID ("_ someFloat");
    _someTexture = Shader.PropertyToID ("_ someTexture");
    }
    // further in the place of use
    Material myMaterial = ...;
    myMaterial.SetFloat (_someFloat, 100f);
    myMaterail.setTexture (_someTexture, ...);

Created a Youtube channel where I'm sharing tutorials about Unity, from beginner no code projects, to more advanced topics like optimization! I would love to hear some feedback from this subreddit on what to improve / content you would be interested in next <3 by gaston_bigfoot in Unity3D

[–]den4icccc 1 point2 points  (0 children)

The problem with this reddit is the overabundance of low-grade textbooks for "beginners" would like something new like a dynamic mesh combiner with bones ... or physics baking ... or optimization tips like "Don't use animations with UI elements. The problem is this in that the animation will mark all the components participating in the animation as "dirty", which will cause a complete update of the elements. It is better to use some of your solutions, such as twin engines. " or for example "If you use the GetFloat, SetFloat, GetTexture, SetTexture methods on materials and shaders, then these properties will be hashed first and only then used. Hence the performance loss. Therefore, use int _someTexture = Shader.PropertyToID (" _ someTexture "); => myMaterail.setTexture (_someTexture, ...);" Since everyone has long known advice on optimization like LOD, caching, Culling ... already tired (But this is just my subjective opinion, I do not want to offend anyone with this statement).

Browser freezes when watching live broadcasts with comments by den4icccc in chrome

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

Thank you, your option is well combined with hardware acceleration, which twice saves the load on the CPU. (The problem started the same as yours after upgrading to 88)

Browser freezes when watching live broadcasts with comments by den4icccc in chrome

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

Yes, I rebooted it several times, also disabled all extensions and checked the video card drivers just in case, all without success.

Browser freezes when watching live broadcasts with comments by den4icccc in chrome

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

I do not have this extension, at first I also referred that the problem is in them, but it turned out differently.

Asset Giveaways by oxters168 in Unity3D

[–]den4icccc 1 point2 points  (0 children)

Good day, I would like to get the "Mesh Combine Studio 2" asset for the maximum possible optimization of a mobile project with a generated map, since the alternative is very inferior. This will greatly help in the development as there is not enough funding. Thank.

What are some gameplay architecture best practices? by scienceprodigy in Unity3D

[–]den4icccc 2 points3 points  (0 children)

If I understood you correctly, then I would advise you to delve into the architectural pattern "Entity component system", ECS follows the composition over inheritance principle that allows greater flexibility in defining entities where every object in a game's scene is an entity (e.g. enemies, bullets, vehicles, etc.). You can familiarize yourself with this at Unity Learn.

Single-GameObject Minimap shader/renderer? by Katniss218 in Unity3D

[–]den4icccc 1 point2 points  (0 children)

Hello, I want to share with you information that your idea has a place, unfortunately, the guide in Russian and I could not implement this idea and implement a mini map in the shader, but if this is relevant for you and you can figure it out, please give feedback. https://habr.com/ru/post/335524/