UPBGE / upbge

UPBGE, the best integrated game engine in Blender
https://upbge.org
Other
1.43k stars 180 forks source link

Suddenly Shadows Disappear, then the whole frame becomes white. #1872

Open JYamihud opened 8 months ago

JYamihud commented 8 months ago

I make a game on GNU / Linux Pop_OS! using UPBGE 0.36

I have 32 GB RAM from which the whole setup uses only 17 GB ( blender ( upbge ) takes only about 3 GB ) CPU is working during the game only at about 20%

I have an AMD GPU and I head that there are problems with those ( the UI flickers for example ). Maybe I just need to restart my computer. But still this is some hella crazy bug.

https://github.com/UPBGE/upbge/assets/27649397/099b83a5-7c4e-4268-8701-4811351bfc3f

JYamihud commented 8 months ago

I did some tests:

Restarted computer: Didn't help.

Found what does the trick. I noticed that the white frame started when the car hit the light stand. So I did that a few times. And most of the other times it was from hitting a light stand. ( Perhaps in other times, NPC were hitting light stands ).

I had a Rolling Friction setting on the light stand to be 1.0 I reduced it to 0.0 and it stopped crashing the rendering. I put it back to 1.0 and it started crashing the rendering again.

Here is the code I use to spawn light stands:

for i in bge.logic.globalDict.get("light-spawns", []):

    inview = cam.pointInsideFrustum(i.worldPosition) == cam.INSIDE

    if i["to_spawn"] and i.getDistanceTo(dani) < spawnAtDistance and inview:

        if i["LightSpawn"] not in bge.logic.globalDict["all-lights"]:
            bge.logic.globalDict["all-lights"][i["LightSpawn"]] = []

        found = False
        for obj in bge.logic.globalDict["all-lights"][i["LightSpawn"]]:
            if cam.pointInsideFrustum(obj.worldPosition) == cam.OUTSIDE and obj.getDistanceTo(dani) > spawnAtDistance/3:
                found = True
                obj.suspendDynamics(True)
                obj.position = i.worldPosition
                obj.position[2] += 5
                obj.orientation = i.worldOrientation
                obj["spawner"]["to_spawn"] = True
                break
        if not found:

            obj = scene.addObject(i["LightSpawn"], i["LightSpawn"])
            obj.suspendDynamics(True)
            obj.position = i.worldPosition
            obj.position[2] += 5
            obj.orientation = i.worldOrientation
            bge.logic.globalDict["all-lights"][i["LightSpawn"]].append(obj)

        obj["spawner"] = i

        i["to_spawn"]= False

Here is the logic bricks of the light stand.

image