text:
How to implement and understand Clipping
I am writing a 3D renderer from scratch in Python using PyGame and Numpy. I have the basics implemented, which are working well. I have noticed that when you get too near to objects, the objects invert. I think this is because the projection or transformations matrices are inverting objects when renderering -z values. This is why I am trying to implement a clipping routine to clip any objects which go behind the camera view plane.
This seems to be kind of working. When set to clip in the Z plane, it cuts off objects as its meant to, but when moving the camera forward, the plane seems to move forward with half the speed of the camera (not sure why?). Then when the camera catches up with the plane, the shapes begin to try and invert to the edges of the screen. I've tried changing the FOV and Zoom of the camera and also how far forward the plane is in-front of the camera and they all work well, clipping the whole object without any inverting. However I want the clipping plane to clip only near to the camera.
I have also tried clipping in the X axis and the plane clips the object at the same speed as the camera moves to the right (seems to move at the same speed as the camera in the X axis).
I have also been following this video to try and understand clipping better: One Lone Coder - Clipping
GitHub link.
The code in question is shown below (in the projectionViewer Class):
def clipFaceAgainstPlane(self, pointOnPlane, planeNormal, face, wireframe):

        planeNormal = normaliseVector(planeNormal)
        distance1 = self.distanceOfPointToPlane(pointOnPlane, planeNormal, wireframe.nodes[face.vertices[0]])
        distance2 = self.distanceOfPointToPlane(pointOnPlane, planeNormal, wireframe.nodes[face.vertices[1]])
        distance3 = self.distanceOfPointToPlane(pointOnPlane, planeNormal, wireframe.nodes[face.vertices[2]])

        insidePoints = []
        outsidePoints = []
        outputPoints = []

        if distance1 > 0:
            insidePoints.append(face.vertices[0])
        else:
            outsidePoints.append(face.vertices[0])

        if distance2 > 0:
            insidePoints.append(face.vertices[1])
        else:
            outsidePoints.append(face.vertices[1])

        if distance3 > 0:
            insidePoints.append(face.vertices[2])
        else:
            outsidePoints.append(face.vertices[2])

        if insidePoints == 0:
            pass
        elif len(insidePoints) == 1:
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[0]])
            outputPoints.append(self.checkLineOnPlane(pointOnPlane, planeNormal, wireframe.perspectiveNodes[insidePoints[0]], wireframe.perspectiveNodes[outsidePoints[0]]))
            outputPoints.append(self.checkLineOnPlane(pointOnPlane, planeNormal, wireframe.perspectiveNodes[insidePoints[0]], wireframe.perspectiveNodes[outsidePoints[1]]))
        elif len(insidePoints) == 2:
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[0]])
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[1]])
            outputPoints.append(self.checkLineOnPlane(pointOnPlane, planeNormal, wireframe.perspectiveNodes[insidePoints[0]], wireframe.perspectiveNodes[outsidePoints[0]]))

            outputPoints.append(wireframe.perspectiveNodes[insidePoints[1]])
            outputPoints.append(self.checkLineOnPlane(pointOnPlane, planeNormal, wireframe.perspectiveNodes[insidePoints[1]], wireframe.perspectiveNodes[outsidePoints[0]]))
            outputPoints.append(self.checkLineOnPlane(pointOnPlane, planeNormal, wireframe.perspectiveNodes[insidePoints[0]], wireframe.perspectiveNodes[outsidePoints[0]]))
        elif len(insidePoints) == 3:
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[0]])
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[1]])
            outputPoints.append(wireframe.perspectiveNodes[insidePoints[2]])

        return outputPoints

Also, another reason which is why this could be happening is because I am not clipping before applying the perspective to the points. Would I apply the clipping in the Z axis to the regular nodes?


text:
Disconnected Limbs when Auto-Rigging
I'm new to Blender and rigging, and I probably have a fundamental misunderstanding of something.
In Blender, I created a humanoid model, following directions from a Blender/Unity book. The model only has 14 parts: Torso, Head, Arms/Hands (6 parts), Legs/Feet (6 parts). All body parts are children of Torso in the tree structure you'd expect (Torso > Upper Arm > Lower Arm > Hand). All body parts are overlapping in the model as well, looking pretty typical in T-pose.

However, when I import my model into Mixamo or AccuRIG, my model is partially disassembled with Lower Arm and Hand connected from Torso, placed below the model. Lower Legs are also separated, as well as Feet.

I tried moving body parts closer together, but this didn't help, and as mentioned, I tried AccuRIG and Mixamo, which both give the same results. I'd love any suggestion of how to fix my issue!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Client error I can't spawn canvas and asign it to my client player -Netcode for Gameobjects
in my netcode unity c# code I have a host and a client, and each time i try to instantiate a client I get this error  even though canvasInstance is not null since it's passing the debug
public class PlayerNetworkConfigurer : NetworkBehaviour
{
    [SerializeField] private GameObject canvasPrefab;
    [SerializeField] private PlayerStatusModel statusModel;
    [SerializeField] private Player playerScript;
    GameObject canvasInstance;

    public override void OnNetworkSpawn()
    {
        if (IsOwner)
        {
            // Instantiate the canvas prefab only for the owner
            canvasInstance = Instantiate(canvasPrefab);
            if (canvasInstance == null) Debug.Log("o que deu?");
            //canvasInstance.GetComponent<NetworkObject>().Spawn(true);

            if (IsClient)
            {
                Debug.Log("é pra ser cliente né?");
                SpawnCanvasServerRpc();

            }
            else
            {
                Debug.Log("aaa");
                SpawnCanvas();

            }
            if (canvasInstance == null)  Debug.Log("oxxx que deu?");

            // Set the canvas parent to this object (owner)

            // Set the local position to zero to keep it relative to the owner
            canvasInstance.transform.localPosition = Vector3.zero;

            // Make sure the canvas is visible and interactable only for the owner

            canvasInstance.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceCamera;

            //canvasInstance.GetComponent<Canvas>().worldCamera = Camera.main;
            canvasInstance.SetActive(true);
            SetStatusImages(canvasInstance);
            playerScript.InventoryManager = canvasInstance.GetComponent<InventoryManager>();

            Transform capule = FindChildByName(transform, "Capsule");
            Transform hand = FindChildByName(capule, "Hand");
            playerScript.InventoryManager.HandParent  = hand;
            Transform InventoryUI1 = FindChildByName(canvasInstance.transform, "InventoryUI1");

            playerScript.InteractionText = FindChildByName(InventoryUI1, "InteractionText").gameObject.GetComponent<TextMeshProUGUI>();
        }
    }
    private void SpawnCanvas()
    {
        NetworkTransform networkTransform;
        networkTransform = GetComponent<NetworkTransform>();
        Debug.Log((transform.gameObject.name));
        Debug.Log((transform.GetComponent<NetworkObject>().NetworkObjectId));

        Debug.Log(networkTransform.NetworkObject.OwnerClientId);
        canvasInstance.GetComponent<NetworkObject>().SpawnWithOwnership(networkTransform.NetworkObject.OwnerClientId);
        canvasInstance.transform.SetParent(networkTransform.gameObject.transform);
    }
    [ServerRpc(RequireOwnership = false)]
    private void SpawnCanvasServerRpc()
    {
        SpawnCanvas();
        Debug.Log("é ");
    }

NullReferenceException: Object reference not set to an instance of an object
PlayerNetworkConfigurer.SpawnCanvas () (at Assets/Scripts/Network/PlayerNetworkConfigurer.cs:74)
PlayerNetworkConfigurer.SpawnCanvasServerRpc () (at Assets/Scripts/Network/PlayerNetworkConfigurer.cs:80)
PlayerNetworkConfigurer.__rpc_handler_1989096977 (Unity.Netcode.NetworkBehaviour target, Unity.Netcode.FastBufferReader reader, Unity.Netcode.__RpcParams rpcParams) (at <05a5223dbd3d4bec92736c6fbf2e0a1b>:0)
Unity.Netcode.RpcMessageHelpers.Handle (Unity.Netcode.NetworkContext& context, Unity.Netcode.RpcMetadata& metadata, Unity.Netcode.FastBufferReader& payload, Unity.Netcode.__RpcParams& rpcParams) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/Messages/RpcMessages.cs:70)
Rethrow as Exception: Unhandled RPC exception!
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.RpcMessageHelpers:Handle(NetworkContext&, RpcMetadata&, FastBufferReader&, __RpcParams&) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/Messages/RpcMessages.cs:74)
Unity.Netcode.ServerRpcMessage:Handle(NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/Messages/RpcMessages.cs:125)
Unity.Netcode.NetworkMessageManager:ReceiveMessage(FastBufferReader, NetworkContext&, NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/NetworkMessageManager.cs:570)
Unity.Netcode.NetworkMessageManager:HandleMessage(NetworkMessageHeader&, FastBufferReader, UInt64, Single, Int32) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/NetworkMessageManager.cs:434)
Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue() (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Messaging/NetworkMessageManager.cs:460)
Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Core/NetworkManager.cs:45)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.7.1/Runtime/Core/NetworkUpdateLoop.cs:208)

Which line is line 74? If it's this: canvasInstance.GetComponent<NetworkObject>().SpawnWithOwnership(networkTransform.NetworkObject.OwnerClientId) then there are 4 things that could be null at this point: canvasInstance, canvasInstance.GetComponent<NetworkObject>(), networkTransform, or networkTransform.NetworkObject. Have you checked all four immediately before this line?

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Correct Orientation from Blender to Unreal Engine 5 in a spline
Let me preface this by saying I'm an absolute beginner and I have no idea what I'm doing.
Following lot's of different tutorials, I want to create a road spline in unreal engine. Therefor I created a simple road model in blender and exported it as an fbx:
I made a very simple road model in blender and exported it as an fbx:

I then hooked up the following blueprint in UE5

where Road is a SplineComponent.
The Add Spline Mesh Component function has the following settings

But when I drag the spline blueprint into the scene it looks like this (it's distorted and rotated)

What went wrong and how do I fix it?


text:
doing anything with value with this thing doesnt work
if  script.Parent.Value.Value == 5  then
    print("Health is 5")
end

that above, is actually int value like  a health of a wall. when i set this value manually this does work. but i have like a monster type of thing which damages the wall when it damages it to that  much health it doesnt work. here's the script of damaging it:
local ms = game.Workspace:WaitForChild("ls") -- ls is monster

script.Parent.Parent.Torso.Touched:Connect(function(Hit) -- dont mind why wall is called
 torso

    if Hit:IsDescendantOf(ms) and script.Parent.Parent.Value.Value >= 10  then
        script.Parent.Parent.Value.Value = script.Parent.Parent.Value.Value - 5

    end

end)

please keep in mind im bad at roblox scripting. and please answer why that doesnt work(why it doesnt print that out when value is 5).


text:
Convert color to texture in Unreal 5.3
I have a blg file containing a building, using the advanced show options and checking the 'vertex color' setting I was able to see the building with color.

But if I put a camera in front and try to see it , the building appears with no color.

Is there a way to fix this? perhaps converting the color to texture? so that in the rendering of the scene the building appears with the correct colors.


text:
How can I apply blur filter in Phaser 2.7
can somebody please tell me how can I apply filters in general, and specifically blur filters in Phaser 2.7?
The approach I found on ChatGPT is:
var blurYFilter = game.add.filter('BlurY');
blurYFilter.blur = 20; // Set the blur value to 20
sprite.filters = [blurYFilter];

But this is not working. Can you please tell me the correct way to apply filters?
I am getting this error:
c.Filter[a] is not a constructor
    at c.GameObjectFactory.filter

Same Question as on SO, and is answered: https://stackoverflow.com/a/77696819/1679286


text:
Duplicated the player scene but only the running animation is not playing
First time asking a question here, so hopefully it goes well! So, I had a player scene set up with a custom state machine, for now handling the idle, run and jump stages, currently set up as nodes:

This player1 plays all animations correctly, however, since I was following a tutorial and wanted to change how my movement logic worked, I duplicated the player1 scene and tried to merge the two scripts (State Machine and animation logic from player1 with movement logic to player2).
All animations play correctly, idle when idle, jumping when jumping, landing when landing, but when running the sprite just stays static.
I've gone back and forth from player1 scene to player2 scene to make sure I've selected the correct nodes, but I can't figure out why all animations play except the running animation. Below is the full Player2 script, I'm activating the animation tree in the _ready function, I'm setting the parameters of Move which is a blendSpace1D with the idle and running animations and I'm calling it in the _physics_proccess.
extends CharacterBody2D

@export var movement_data: PlayerMovementData

var air_jump = false
var just_wall_jumped = false
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var was_wall_normal = Vector2.ZERO
var direction : Vector2 = Vector2.ZERO

@onready var sprite_2d = $Sprite2D
@onready var animated_sprite_2d = $AnimationPlayer
@onready var coyote_jump_timer = $CoyoteTimer
@onready var wall_jump_timer = $WallJumpTimer
@onready var animation_tree : AnimationTree = $AnimationTree
@onready var state_machine : CharacterStateMachine = $CharacterStateMachine

func _ready():
    animation_tree.active = true

func _physics_process(delta):
    apply_gravity(delta)
    update_animation_parameters()
    handle_wall_jump()
    handle_jump()
    var input_axis = Input.get_axis("move_left", "move_right")
    handle_acceleration(input_axis, delta)
    handle_air_acceleration(input_axis, delta)
    apply_friction(input_axis, delta)
    apply_air_resistance(input_axis, delta)
    var was_on_floor = is_on_floor()
    var was_on_wall = is_on_wall_only()
    if was_on_wall:
        was_wall_normal = get_wall_normal()
    move_and_slide()
    var just_left_ledge = was_on_floor and not is_on_floor() and velocity.y >= 0
    if just_left_ledge:
        coyote_jump_timer.start()
    just_wall_jumped = false
    var just_left_wall = was_on_wall and not is_on_wall()
    if just_left_wall:
        wall_jump_timer.start()

    update_animations(input_axis)

func apply_gravity(delta):
    if not is_on_floor():
        velocity.y += gravity * movement_data.gravity_scale * delta

func handle_wall_jump():
    if not is_on_wall_only() and wall_jump_timer.time_left <= 0.0: return
    var wall_normal = get_wall_normal()
    if wall_jump_timer.time_left > 0.0:
        wall_normal = was_wall_normal
    if Input.is_action_just_pressed("jump"):
        velocity.x = wall_normal.x * movement_data.speed
        velocity.y = movement_data.jump_velocity
        just_wall_jumped = true

func handle_jump():
    if is_on_floor(): air_jump = true

    if is_on_floor() or coyote_jump_timer.time_left > 0.0:
        if Input.is_action_pressed("jump"):
            velocity.y = movement_data.jump_velocity
            coyote_jump_timer.stop()
    elif not is_on_floor():
        if Input.is_action_just_released("jump") and velocity.y < movement_data.jump_velocity / 2:
            velocity.y = movement_data.jump_velocity / 2

        if Input.is_action_just_pressed("jump") and air_jump and not just_wall_jumped:
            velocity.y = movement_data.jump_velocity * 0.8
            air_jump = false

func handle_acceleration(input_axis, delta):
    if not is_on_floor(): return
    if input_axis != 0 && state_machine.checkIfCanMove():
        velocity.x = move_toward(velocity.x, movement_data.speed * input_axis, movement_data.acceleration * delta)

func handle_air_acceleration(input_axis, delta):
    if is_on_floor(): return
    if input_axis != 0 && state_machine.checkIfCanMove():
        velocity.x = move_toward(velocity.x, movement_data.speed * input_axis, movement_data.air_acceleration * delta)

func apply_friction(input_axis, delta):
    if input_axis == 0 and is_on_floor():
        velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)

func apply_air_resistance(input_axis, delta):
    if input_axis == 0 and not is_on_floor():
        velocity.x = move_toward(velocity.x, 0, movement_data.air_resistance * delta)

func update_animation_parameters():
    animation_tree.set("parameters/Move/blend_position", direction.x)

func update_animations(input_axis):
    if input_axis > 0:
        sprite_2d.flip_h = false
        sprite_2d.offset.x = -15
    elif input_axis < 0:
        sprite_2d.flip_h = true
        sprite_2d.offset.x = -75

I'm sorry if it's a bit confusing, I'll try to clarify any raised questions and I appreciate any help with this, I'm sure it's something dumb but after a full afternoon of trying to resolve this, I need help. So once again, thank you for your time!

Do the properties for the AnimationPlayer in the inspector match? Do the animations show correctly in the Animation panel? Do you get any error or warning when running the animations?


text:
How to prevent pre-launch report play store bots from affecting firebase analytics
I am following this publishing flow to send updates to the Android Play Store: I upload a new build to the Internal testing track and after testing that all's well, I'll promote it to Production. The problem that I'm seeing is that since every build is auto-tested by Play Store's Pre-Launch Report, it immediately brings on 5+ users on to my app which start sending analytics events. This is ending up inflating my analytics data unnecessarily. How can I eliminate this? I do want the automated testing, it helps me overall, but ideally I want zero impact from the bots on my Analytics tracking.
I tried making a checking function to look for "firebase.test.lab" in the system contentResolver, but testing this is super-hard because it requires me to make a test release every time and then wait for like an hour to let the bots finish hammering to get to the next sane test cycle. So far I've not been able to skip turning on the analytics, here's the function I'm trying to build:
using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
    var context = actClass.GetStatic<AndroidJavaObject>("currentActivity");
    if (context == null) {copOut(); return;}
    AndroidJavaClass system = new AndroidJavaClass("android.provider.Settings$Global");
    if (system == null) {copOut(); return;}
    string inTestLab = system.CallStatic<string>("getString", context.Call<AndroidJavaObject>("getContentResolver"), "firebase.test.lab");
    if (inTestLab == null) {copOut(); return;}
    Debug.Log($"In TestLab:{inTestLab}");
    FirebaseAnalytics.SetAnalyticsCollectionEnabled(inTestLab != "true");
}


text:
Need advice on how to implement grass shader similar to Breath of the wild
What I am trying to achieve :
I’m trying to recreate the grass shader of Breath of the wild & Tears of the Kingdom. There is a glow on the edge of the individual grass blades present when the sun/moon and the camera are facing each other. I want the grass to have a glow in the edge similar to a SSS effect in breath of the wild.
This is my video reference. As you can see, the grass which is in the same line as the sun has a glow on it and the rest of them just appear to be the base texture of the grass.
Below picture is a picture reference of the effect I am trying to achieve. The sun is somewhere on the top left causing the grass to have that glow only in that direction, and the rest of them on the right are darker.

I have tried multiple implementations to achieve the effect and am very lost. Can someone tell me what EXACTLY breath of the wild or tears of the kingdom is doing to get the effect and how I can implement it in Unity URP?
What I have tried so far :
There were issues with backface colouring due to it being a flat mesh, tried to flip normals in shadergraph but that did not entirely fix the issue. One side was still darker than the other. I tried using ambient light to compensate for the darker side but there was a limit on how bright I can make the ambient light, so that did not entirely fix the issue (Ambient light was set to Color mode,not skybox or gradient).The direction light also seemed to be effecting the colours even though the colour of light was set to white and intensity 1. This forum thread was my reference for this issue.
The effect looked like sub surface scattering so I tried to imitate that effect using light angles and camera angles using shader graph but it was effecting all the grass blades instead of just the grass blades in the same direction of the sun. I tried to use the sub surface glow effect to compensate the darker side in the above bullet point, but the issue was that the logic enabled the sub surface effect only when the camera and the light where in completely opposite directions, there was no transition for the effect, it just toggled even with the linear interpolation node present so the darker sides would be visible for some duration until the threshold is crossed.
This is what my implementation looks like. Right now all the instances change colours instantly instead of being based on the light like what breath of the wild does
Felt like the effect was relying on reflections some how so tried to use custom smoothness maps to define shiny parts but the intended effect was not achieved. The reflectiveness seemed to work per object, but it did not work the way breath of the wilds grass. This is what it looked like.
I tried to use transparency to give an effect of sub surface scattering. I changed the shader from Opaque to transparent and give the shader a metallic map.I used a gradient texture as well as a separate alpha map which both gave the same effect. It caused all the grass to be shiny at the edges after a certain distance, depending on the angle of the light source.
Only a few grass blades were glowing, not all of them, as seen in the below picture.
Implementation and Technical details
This is my shader graph.

There are 4 groups you can see in the above shader graph.
The SSS group i used as a mask for defining the glowing parts of the grass blade as well as the metallic mask. I experimented with a simpler metallic mask as well which yielded roughly same results. This image is the simpler metallic map.
The flip normals group i used to flip normals of grass blade mesh.
The light angle threshold group i used to calculate at what angle of the light the grass should glow. This was tunable with a float variable.
The camera angle threshold group i used to calculate at what angle between the camera and the light source the grass should glow. This was also tunable with a float variable.
This shader graph was a much simpler shadergraph to achieve the effect mentioned in the last bullet point in the “What I have tried so far” section.

The light angle threshold defines the angle at which the edge starts glowing. If the camera and the light source are roughly facing the same direction and camera is looking at the grass, then there will be no glow effect. The glow is present only when the light and the camera are roughly facing each other.
Only if both the thresholds cross the SSS mask texture is multiplied with the base texture to give the effect of glowing and SSS.

Possibly related question on BotW grass shading. I thought we had another related question, but I haven't been able to locate it.


text:
How to implement a server on Android during play
I'm developing a chess game for mobile. In Godot, you can set up a UDP connection with PacketPeerUdp. My problem is establishing a process that acts as a server and runs the already compiled (armv8) chess engine file. Unlike on PC, where I can write code in C++, compile it, and run it as a separate process, on mobile that won't work. Do I need to create an executable file through Android Studio or is there a simpler way to solve this?


text:
Javascript global variable doesn't update
Here is the scenario,
I have a GetImageAerial.jslib which has function something like this
var GetImageAerial = {
    getImageFromBrowserAerial: function(objectNameAerialPtr, funcNameAerialPtr) {
        var g = window.becauseUnitysBadWithJavacript_getImageFromBrowserAerial || {
            busy: false,
            initialized: false,
            rootDisplayStyle: null,
            root: null,
            ctx: null
        };
        window.becauseUnitysBadWithJavacript_getImageFromBrowserAerial = g;

        if (g.busy) {
            return;
        }
        g.busy = true;

        var objectNameAerial = UTF8ToString(objectNameAerialPtr);
        var funcNameAerial = UTF8ToString(funcNameAerialPtr);

        if (!g.initialized) {
            g.initialized = true;
            g.ctx = document.createElement("canvas").getContext("2d");
            g.root = document.createElement("div");
            g.root.innerHTML = [
                '',
                '
',
                '
',
                '        click to choose an image',
                '        <input id="photo" type="file" accept="image/*"/>
',
                '        cancel',
                '
',
                '
'
            ].join('\n');

            document.body.appendChild(g.root);

            var input = g.root.querySelector("input");
            input.onchange = getPic;
            input.onclick = preventOtherClicks;

            var label = g.root.querySelector("label");
            label.onclick = preventOtherClicks;

            var cancel = g.root.querySelector("a");
            cancel.onclick = handleCancel;

            var getImageElement = g.root.querySelector(".getimage");
            getImageElement.onclick = handleCancel;

            g.rootDisplayStyle = g.root.style.display;
        }

        g.root.style.display = g.rootDisplayStyle;

        function preventOtherClicks(evt) {
            evt.stopPropagation();
        }

        function getPic(evt) {
            evt.stopPropagation();
            var fileInput = evt.target.files;
            if (!fileInput || !fileInput.length) {
                return sendError("no image selected");
            }

            var picURL = URL.createObjectURL(fileInput[0]);
            var img = new Image();
            img.onload = function() {
                handleImageLoad(img, sendResult);
            };
            img.onerror = function() {
                sendError("Could not get image");
            };
            img.src = picURL;
        }

        function handleCancel(evt) {
            evt.stopPropagation();
            evt.preventDefault();
            sendError("cancelled");
        }

        function handleImageLoad(img, sendResultCallback) {
            g.ctx.canvas.width = 256;
            g.ctx.canvas.height = 256;
            g.ctx.drawImage(img, 0, 0, g.ctx.canvas.width, g.ctx.canvas.height);
            var dataUrl = g.ctx.canvas.toDataURL();
            g.ctx.canvas.width = 1;
            g.ctx.canvas.height = 1;
            sendResultCallback(dataUrl);
        }

        function sendError(msg) {
            sendResult("error: " + msg);
        }

        function sendResult(result) {
            g.root.style.display = "none";
            g.busy = false;
            SendMessage(objectNameAerial, funcNameAerial, result);
        }
    }
};

mergeInto(LibraryManager.library, GetImageAerial);

I have a button call that calls this JS function from C# script which is attached to a gameobject.
 public void CallImageAerial()
{
    Debug.Log("Call Image Aerial:" + gameObject.name);
    GetImageAerial.GetImageFromUserAsyncAerial(gameObject.name, "ReceiveImageAerial");
    TurnOffAllButtons();
}

string s_dataUrlPrefix = "data:image/png;base64,";
public void ReceiveImageAerial(string dataUrl)
{
    if (dataUrl.StartsWith(s_dataUrlPrefix))
    {
        byte[] pngData = System.Convert.FromBase64String(dataUrl.Substring(s_dataUrlPrefix.Length));

        // Create a new Texture (or use some old one?)
        Texture2D tex = new Texture2D(1, 1); // does the size matter?
        if (tex.LoadImage(pngData))
        {
            //Renderer renderer = GetComponent<Renderer>();
            aerialRenderer.transform.gameObject.SetActive(true);
            aerialRenderer.material.mainTexture = tex;
            Debug.Log("Calling Receive Aerial");
            DoneAerial();
        }
        else
        {
            Debug.LogError("could not decode image");
        }
    }
    else
    {
        Debug.LogError("Error getting image:" + dataUrl);
    }
}

I have a class which has reference to the static extern void and imports the DLL
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;

public class GetImageAerial
{

#if UNITY_WEBGL

   [DllImport("__Internal")]
   private static extern void getImageFromBrowserAerial(string objectName, string callbackFuncName);

#endif

   static public void GetImageFromUserAsyncAerial(string objectName, string callbackFuncName)
   {
#if UNITY_WEBGL
       Debug.Log("Inside Get Image " + callbackFuncName);
       getImageFromBrowserAerial(objectName, callbackFuncName);

#else

           Debug.LogError("Not implemented in this platform");

#endif
   }
}

The problem I have here is that I do call this JS function multiple times and what I want to do is update the objectNameAerial and funcNameAerial in consecutive calls but that doesn't happen. Javascript always preserves the first value of the variable that was set. I was thinking of setting local variables, but I can't technically do that. Any suggestions are welcome! Been stuck at this for too long!
Thank you!


text:
Why doesn't my save system work on IOS?
I am building an IOS game in Unity. I have constructed a save system and it seems to function as expected in editor, but does not when I release a build to my device. Additionally, if there is some fatal flaw with this architecture, please let me know, as I have not seen someone build a system quite like this.
I am using (scriptable object) databases of (scriptable object) models for all of the data in my game. Each model has a serializable version that I convert between when saving / loading. The system is primarily defined by the following template class:
/// <summary>
/// A base class for ScriptableObject databases, providing common functionality and a singleton instance.
/// </summary>
/// <typeparam name="TDatabase">The type of the database.</typeparam>
/// <typeparam name="TModel">The type of the ScriptableObject model the database stores.</typeparam>
/// <typeparam name="TSerializable">The serializable version of the model.</typeparam>
public abstract class BaseDatabase<TDatabase, TModel, TSerializable>
    : ScriptableObject,
        IDatabase
    where TDatabase : BaseDatabase<TDatabase, TModel, TSerializable>
    where TModel : BaseModel<TModel>
    where TSerializable : BaseSerializableModel
{
    /// <summary>
    /// The list of item models in the database.
    /// </summary>
    public List<TModel> Items = new();

    /// <summary>
    /// The dictionary of item models in the database.
    /// </summary>
    public Dictionary<string, TModel> ItemDictionary = new();

    /// <summary>
    /// The inspector-set ID of the database.
    /// </summary>
    [SerializeField]
    protected string id;

    /// <summary>
    /// Gets the singleton instance of the database.
    /// </summary>
    public static TDatabase Instance { get; private set; }

    /// <summary>
    /// Gets or sets the ID of the database.
    /// </summary>
    public string ID
    {
        get { return id; }
        set { id = value; }
    }

    /// <summary>
    /// Gets the type of the database.
    /// </summary>
    public abstract DatabaseType Type { get; }

    /// <summary>
    /// Initializes the database, populating the item dictionary.
    /// </summary>
    public virtual void Initialize()
    {
        if (Items == null)
        {
            Debug.LogError("Items list is null.");
            return;
        }

        if (Items.Count == 0)
        {
            Debug.LogWarning("Items list is empty.");
            return;
        }

        foreach (TModel item in Items)
        {
            if (ItemDictionary.ContainsKey(item.Id))
            {
                continue;
            }

            ItemDictionary.Add(item.Id, item);
        }
    }

    /// <summary>
    /// Gets a random item from the database.
    /// </summary>
    /// <returns>The random item.</returns>
    public virtual TModel GetRandomItem()
    {
        if (Items.Count == 0)
        {
            Debug.LogWarning("Items list is empty.");
            return null;
        }

        return Instantiate(Items[Random.Range(0, Items.Count)]);
    }

    /// <summary>
    /// Gets an item from the database by ID.
    /// </summary>
    /// <param name="id">The ID of the item to get.</param>
    /// <param name="suppressWarnings">Whether to suppress warnings.</param>
    /// <returns>The item.</returns>
    public virtual TModel GetItem(string id, bool suppressWarnings = false)
    {
        if (ItemDictionary.Count == 0)
        {
            if (!suppressWarnings)
            {
                Debug.LogWarning("Item dictionary is empty.");
            }

            return null;
        }

        if (!ItemDictionary.ContainsKey(id))
        {
            if (!suppressWarnings)
            {
                Debug.LogWarning("Item dictionary does not contain key: " + id);
            }

            return null;
        }

        return Instantiate(ItemDictionary[id]);
    }

    /// <summary>
    /// Serializes a ScriptableObject model item into a serializable version.
    /// </summary>
    /// <param name="item">The item to serialize.</param>
    /// <returns>The serialized item.</returns>
    public abstract TSerializable SerializeItem(TModel item);

    /// <summary>
    /// Deserializes a serializable version of a model into a scriptableObject.
    /// </summary>
    /// <param name="item">The item to deserialize.</param>
    /// <returns>The deserialized item.</returns>
    public abstract TModel DeserializeItem(TSerializable item);

    /// <summary>
    /// Sets the singleton instance of the database.
    /// </summary>
    /// <exception cref="System.Exception">Thrown when there is already an instance of the database.</exception>
    protected virtual void OnEnable()
    {
        if (Instance == null)
        {
            Instance = this as TDatabase;
        }
        else if (Instance != this)
        {
            throw new System.Exception("There can only be one instance of a database.");
        }
    }
}

The "PlayerProfile" represents the root of the save data structure. My save manager performs serialization and handles the actual file IO:
/// <summary>
/// Manages game save data.
/// </summary>
public static class SaveManager
{
    /// <summary>
    /// Gets the current player profile.
    /// </summary>
    public static PlayerProfile PlayerProfile { get; private set; }

    /// <summary>
    /// Initializes the save manager.
    /// </summary>
    public static void Initialize()
    {
        VerifyOrCreateSaveFile();
        TryLoadPlayerProfileFromFile();
    }

    /// <summary>
    /// Resets the player profile.
    /// </summary>
    public static void ResetPlayerProfile()
    {
        PlayerProfile = ScriptableObject.CreateInstance<PlayerProfile>();
    }

    /// <summary>
    /// Sets the player profile.
    /// </summary>
    /// <param name="newProfile">The new player profile.</param>
    public static void SetPlayerProfile(PlayerProfile newProfile)
    {
        PlayerProfile = newProfile;
    }

    /// <summary>
    /// Saves the player profile to file.
    /// </summary>
    public static void SaveGame()
    {
        string path = GetSaveFilePath();

        SerializablePlayerProfile serializablePlayerProfile =
            PlayerProfileDatabase.Instance.SerializeItem(PlayerProfile);

        string json = JsonUtility.ToJson(serializablePlayerProfile, true);
        File.WriteAllText(path, json);
    }

    private static void VerifyOrCreateSaveFile()
    {
        string path = GetSaveFilePath();
        string directory = Path.GetDirectoryName(path);

        if (!Directory.Exists(directory))
        {
            Directory.CreateDirectory(directory);
        }

        if (!File.Exists(path))
        {
            File.Create(path);
            Debug.Log("Save file did not exist and was created at " + path);
        }
    }

    private static void TryLoadPlayerProfileFromFile()
    {
        string path = GetSaveFilePath();
        if (!File.Exists(path))
        {
            throw new System.Exception("Cannot load player profile, path does not exist.");
        }

        string json = File.ReadAllText(path);
        SerializablePlayerProfile serializedPlayerProfile =
            JsonUtility.FromJson<SerializablePlayerProfile>(json);

        if (serializedPlayerProfile != null)
        {
            PlayerProfile = PlayerProfileDatabase.Instance.DeserializeItem(
                serializedPlayerProfile
            );
        }
        else
        {
            PlayerProfile = ScriptableObject.CreateInstance<PlayerProfile>();
        }
    }

    private static string GetSaveFilePath()
    {
        return Path.Combine(Application.persistentDataPath, "playerProfile.GameSaves.json");
    }
}


text:
Splitting regions across mountain ranges in 2D tile map partitioning, for a Civ5 mod
I'm trying to do a rewrite of Civ5's AssignStartingPlots.lua (Lua is the scripting language used by Civ5), and I'm comfortable writing it, but conceptually, just figuring out what algorithm to use, I'm running up against a wall.
By the point that this script is called, the terrain (plains/grassland/desert/snow/jungle/hills, etc.) has already been generated, but the resources have not been placed on it. This script is supposed to 1) place the resources, and 2) assign starting positions to players.
This starts - in the default script as well as in my rewrite - by dividing the map up into "regions" (either Tundra, Jungle, Forest, Desert, Hills, Plains, Grassland or Hybrid), which affect both where certain resources can be placed, and where players are preferentially placed. My general strategy for this is basically flood-fill: pick e.g. a random jungle plot, iterate through its neighbors, and if they 1) are also jungle and 2) are not already in a region, then add them to the region being generated, then go through their neighbors and repeat, until every plot has been assigned a region.
One thing I want to add though is having regions be bisected by mountain ranges - that is, e.g. the grassland on the north side of a mountain range should not be placed in the same region as the grassland on the south side of the mountain range, even if they are otherwise simply connected. But this presupposes that 1) I can tell which mountains even compose a mountain range in the first place, and 2) how to tell which side of the range a plot falls on.
All the map data is contained in global Map object and using Map.GetPlot(x,y) I can get a Plot object at any (x, y, z = -(x+y) ) on the map. With nested for all x/ all y loops I can interate through every plot on the map, use Plot.IsMountain() to check if it's a mountain, and if it is, I can cache it in a table. That gives me a list of all the mountains on the map. And then... what do I do with it to figure out which items collectively compose a range?
And for which side of the range a test plot is on - if the range is perfectly linear then it's as simple as constructing the formula for a secant line from the two most extreme points, and then checking the test plot's y coordinate to see if it's higher/lower of the y-coordinate predicted by the secant y(x). But any curvature in the mountain range (which is almost guaranteed) means the secant line approach is going to end up assigning plots to the wrong side.

can you give an example map and mark there for example what you would consider (for this mechanics purpose) a mountain range and what not?


text:
how to export gtlf file to godot without crashing?
I've been working on a project involving around 40 animations in Blender, but I've hit a roadblock when attempting to export the Blender file to Godot. Unfortunately, both the FBX and GLTF formats seem to freeze and crash the moment I click the export button. It's becoming quite a hindrance to my workflow. I've considered the possibility of purchasing a new computer, but before taking such a drastic step, I'm wondering if there are any alternative solutions or troubleshooting steps I can explore to overcome this export issue. How can I go about resolving this problem and successfully export my animations to Godot without encountering these crashes?
also tried exporting one animation at a time and then loading them into the animation player in godot...didn't work, the loaded animations aren't recognized even tho it's the same rig with the same bone names.

Exporting animations separately and then merging then in Godot is a pain, would not recommend. The only thing that I can think of on Godot side would be to import the .blend file (you need to set the path to blender in editor settings), but since that is based on the GLTF export I won't expect it to solve the problem. I'd say this is something to tackle on Blender side, but I would not know where to start. Addendum: I have added the blender tag. Addendum 2: is blender up to date? Could reinstalling it fix it? Could you get a third party to export them for you?


text:
How to rotate Scene Collection TileSet
I am using a scene in a TileMap node, but I can't seem to be able to rotate it. I tried rotating it in code, but that doesn't work. I also tried rotating it in the editor using the TileMap node.
Is it possible at all to rotate a Scene TileMap? If so, how?
The Code I used to try and rotate:
func _ready():
    rotation_degrees = 90

I also tried using X and Z to rotate the Tile, but it says cannot transform tile scenes

It seems like I somehow fixed it. I will try to figure out how though.


text:
how do I continue my code so that the circle (player) doesn't go through the rectangle?
There is a collision, I find it on the side of the rectangle (I can’t do it otherwise), but I don’t know how to stop the circle, that is, so that I can’t go any further (and at the same time not get stuck and can go back)
class Rect
{
    constructor(x,y,w,h)
    {
        this.x = x;
        this.y = y;
        this.w = w;
        this.h = h;
    }
    drawRect()
    {
        ctx.fillStyle = "#FF0000";
      ctx.fillRect(150, 150, 100, 20);
    }
    checkcollision(player)
    {
        let distX = Math.abs(player.cx - this.x - this.w / 2);
        let distY = Math.abs(player.cy - this.y - this.h / 2);
        if (distX > this.w / 2 + player.radius || distY > this.h / 2 + player.radius) {

          } else {

          }

}

}

move code
chekcollision()
      {
        if(this.cx - this.radius < 0)
        {
            this.cx = this.radius;
        }
        if(this.cx + this.radius > 600)
        {
            this.cx = 600 - this.radius;
        }
        if(this.cy - this.radius < 0)
        {
            this.cy = this.radius;
        }
        if(this.cy + this.radius > 400)
        {
            this.cy = 400 - this.radius;
        }
      }
```

Have you checked out questions in the [tag:collision-resolution] tag for some ideas? We have lots of prior answers about this topic. Note that users here won't be able to tell you much about how to stop your player's movement if you haven't shown the code you use to move the player. What you've labeled "move code" seems to actually be checking the player against the bounds of the screen/play area.

Perhaps just apply a force in the opposite direction with the players speed when the player is inside the collider? That could also fix problems, as just stopping the movement may end up with side effects like getting stuck inside colliders rather than being pushed out as i mentioned.


text:
Animating horses and possibly other animals
I'm adding centaurs to my game, good thing Blender has an add-on for animating animals, horrible that when exporting to GLTF these animations get distorted and ruined during the export process...
[Editor's note: this is the place where you show/describe the specific distortions you're seeing]
I tried this on multiple computers (also multiple blend files), and the issue persists, so it's either one of the many issues of the gltf format, an issue with the Blender add-on, or an issue with the animations/rigs.
How can I resolve this problem?

I think this can be fixed in blender, and I doubt it is an export problem, it sounds more like a rigging problem. Are you sure you don't want to ask on https://blender.stackexchange.com/ (probably show the result you are getting)? - If it is the export... Godot got a new FBX importer in 4.3 dev 4 which avoids the GLTF conversion, so you could try exporting to FBX and importing with that. Finally, if you need a different tool for animation, you can try animating with cascadeur (it only supports FBX).


text:
How is sound and microphone sampling supposed to work?
I've started using miniaudio sound library written in C, which is an impressive single-header roughly 100k lines of code library for playing audio and reading microphone in a cross_platform way. I'm wondering, what it seems to do is launch a worker thread, and loop, and calls your callback (I'm not exactly sure what it does), but this means that a single thread is using all of the CPU core on which it runs, because that's what endless loops do, it doesn't sleep or anything like that. Smooth playback/reading is said to be around 44khz, whereas looping is running at max speed of the CPU. How is sampling supposed to be done generally speaking? How is it done in for example a game engine? What's the proper way to do this?

Please add more details. what do you understand by the "sound sampling" specifically? Also, what is your gamedev endgoal with it?

@Kromster Well I'm wondering in a typical game engine, the sound obviously runs on another thread, but does it just loop sampling whenever it's appropriate from the sound source audio? It seems to me doing this is devoting an entire thread at 100% CPU utilisation even though you may not have to sample that often. What I want to know is how this is supposed to be done.

I'd be surprised if the call to sample doesn't block / yield time on that hyperthread until a hardware signal that new data is available. Just because code is running doesn't mean the CPU can't preempt it and switch to another thread for a bit. But we can't investigate that without seeing the worker thread loop in question and how it's kicked off.


text:
What data is essential for ensuring scalability and safety in a multiplayer game where a graph serves as the absolute source of truth?
I'm exploring the server-client relationship in game development, aiming to understand the necessary information for transmission from the server to the client in a multiplayer game where I'm using a graph data structure as my source of truth. (I don't know how far I'm going to get, but it seems like a fun idea.)
For example, I'm in the process of constructing a server for a WebGL game, omitting SSR. This setup utilizes WebSockets (TCP) for real-time communication between the server and client. Let's consider a scenario where a client joins an empty server: the client then sends lightweight data to the server, adding it as a node in the graph {id, {name, color, position}}. In response, the server transmits the graph's object containing the current state of all players {id, name, color, position} to initialize the client's game world. Additionally, it broadcasts the details of the new player {id, name, color, position} to all players (if any). However, would this approach be correct and scalable? It seems unsafe and expensive.

What exactly do you understand by the "graph data structure" and how is it going to be a source of truth?

By using a graph data structure as the "source of truth" in a multiplayer game, you establish a centralized representation of the game world. Nodes could represent entities in the game world (e.g., players, NPCs, objects), and edges could represent spatial relationships between them (e.g., proximity, adjacency). Network Topology: Nodes could represent servers or game instances, and edges could represent network connections or communication channels between them. In addition the nodes can represent regions of the game world. I dont understand why I got downvoted.

Your explanation contains a whole lot of "could"s, looks like you don't know what you are doing. In fact, the "where I'm using a graph data structure as my source of truth" could be easily replaced with "where I'm using any data structure as my source of truth" and it won't change its meaning.

On the same vein, what "safety" and what is "expensiveness" in your understanding? *Please add details to the question body itself, not in comments.


text:
How to find how long it takes to perform varoius mundane actions?
I was thinking of making a sims game of sorts. I've decided I'm going to have a 'round robin' system for time, rather than having all actions take up the same amount of time. However, I would need to find the time frame for various actions.
I would need times for all manner of mundane actions, like eating meals, getting dressed, bathing, cleaning, you get the idea. Problem is some of these actions should take more or less time depending on the individual's characters stats, such as how active they are, or even their age. How on earth could I ever find such numbers? I could time myself, yes, but that would only give me times for a character just like myself. How can I find the times for all manners of different types of people? Do I need to just look up someone playing a real sims game and copy the time frames the actions take in that game?

This sounds like a question to ask someone who studies people's daily activities, like a sociologist, not a game developer. Just because you plan to use the information in a game does not mean that game developers are the experts who will know the most about it.

Then where on stack exchange could I ask this?

I'm not sure there is a StackExchange site for this — we don't cover every possible topic. I'd search sociology journals for studies into how people spend their time, like time diaries, experience sampling, etc.

My question is about how to find this info. I wasn't expecting someone to give me the answer. How could I do my own research into this?

Is it even meaningful for your game to have the exact time per task? Taking a time compression into account of something like 1min per 1h, a toilet break would be something like 5s - too short to fit a good animation or interaction for the player.

I just told you how you can do your own secondary research using the available literature. If you want to do your own primary research, again, you'll want to talk to an expert in that type of research: a sociologist. They'll be better positioned to advise on how to gather that data. Here on Game Development, we can help you with the game coding / setup / etc. aspects.

@Zibelas. Yes, it does matter. I thought about having the game work in 15-min intervals (its turn-based), but I didn't like most actions taking at least 15 minutes when there's plenty of actions that clearly wouldn't take that long (besides, it hards to think of anything that wouldn't be exactly one or two turns). Also, the game will be text-based, so there's no 'animations'. As for the sims, taking a bath took about half an hour of in-game time (or 30 seconds in real time), but I can't remember the times for anything else (nothing took nearly as long as a bath, outside of crafting anyway).


text:
Stochastic transparency for rendering transparent clouds
I'm experimenting with stochastic transparency in openGL to avoid sorting my scene which consists of clouds at different positions. I'm trying to implement the method described here https://blog.bonzaisoftware.com/stochastic-order-independent-transparency/. In my accumulation shader I experimented with different things and here is what I'm using now:
FragColor = currentPixel + accumulatedPixel) / numSamples;
FragColor = clamp(FragColor, 0.0, 1.0);

and my rendering loop is like this:
int numSamplesPerPixel = 25; // Adjust as needed
ourShader.setInt("numSamples", numSamplesPerPixel);
for (int i = 0; i < numSamplesPerPixel; ++i) {
        // Bind the appropriate framebuffer
        float time = static_cast<float>(glfwGetTime());
        GLuint currentFramebuffer = (i % 2 == 0) ? framebuffer1 : framebuffer2;
        GLuint otherFramebuffer = (i % 2 == 0) ? framebuffer2 : framebuffer1;
        GLuint currentFramebufferTexture = (i % 2 == 0) ? texture1 : texture2;
        GLuint accumulationTexture = (i % 2 == 0) ? texture2 : texture1;
        glBindFramebuffer(GL_FRAMEBUFFER, currentFramebuffer);
        ourShader.use();
        ourShader.setFloat("time",time);

        glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, cloud_cluster.numClouds);

        // Accumulate the rendered image onto the accumulation framebuffer
        glBindFramebuffer(GL_FRAMEBUFFER, otherFramebuffer);
        accumulateShader.use();
        accumulateShader.setInt("currentFrame",0);
        accumulateShader.setInt("accumulationBuffer", 1);
        accumulateShader.setInt("numSamples", numSamplesPerPixel);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, currentFramebufferTexture); // Use the texture associated with currentFramebuffer
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_2D, accumulationTexture); // Use the texture associated with otherFramebuffer
        // Render a quad covering the entire screen, blending the current framebuffer with the accumulation buffer
        glBindVertexArray(quadVAO);
        glBindBuffer(GL_ARRAY_BUFFER, quadVBO);
        glDrawArrays(GL_TRIANGLES, 0, 6);
    }

Here is what I'm getting now, it is very clear that there is some black dots inside the clouds. How can I fix that? Am I using stochastic transparency correctly?

EDIT:
the original shader looks like this:
FragColor = texture(textureArray, vec3(TexCoord,int(imageIndexOut)));
float rand = random(vec3(gl_FragCoord.xy, time));
if (FragColor.a < rand){
    discard;
}

where random is a function I use descirbed here https://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl in the second answer. Time is passed at each iteration and now I see that the cloud pixels are changing constantly.

How are you varying your noise between samples? Is it possible some samples are consistently hitting coherent noise values, and not getting the amount of randomization/decorrelation you need?

Your accumulation function looks a bit odd too. It looks like the current RGB has been pre-scaled to 1/sampleCount, while for the alpha it's the accumulated value that's been scaled, and not by the reciprocal? Can you explain your thinking here?

We need the source code of the shaders to workout why the noise has such high contrast (unusable quality). DMGregory's first comment is most likely cause.

@DMGregory thanks for your replies. I edited the post above and fixed passing the time unifrom in the render loop. Now when the time is passed correctly, I get a new problem and it's that the cloud pixels constantly change, some becoming black and then change to white and vice versa. Do you think it is enough with the time and FragCoord.xy to avoid patterns in the noise values? The code of the fragment shaders of accumulationShader and "ourShader" is basically what I wrote plus the noise function. Do you think my approach at creating stochastic transparency this way works?

@Blindman67 I commented above and edited the post

Also the accumulation function looked odd but now I just add all the RGBA channels and divide by numSamples