godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.86k stars 20.99k forks source link

Incorrect display of OpenGL 3 shadows #88123

Open piramidamsc opened 7 months ago

piramidamsc commented 7 months ago

Tested versions

Building the engine v4.3 dev3 win64

System information

win10 ,opengl3,GTX 560 ti

Issue description

shadows are displayed incorrectly in opengl 3 mode, the problem occurs when importing a 3d model in glb format, there are no problems when using obj format. S r

Steps to reproduce

Create a new project with the opengl 3 visualization system, and export the 3d model in the format.glb without a second UV channel, then generate a uv2 light map in the editor. Новый игровой проект.zip

Minimal reproduction project (MRP)

N / A

Calinou commented 7 months ago

This is likely due to mesh LOD being used too early. You can probably see the issue going away if you disable Generate > LODs in the Import dock for the .glb file.

piramidamsc commented 7 months ago

This is likely due to mesh LOD being used too early. You can probably see the issue going away if you disable Generate > LODs in the Import dock for the .glb file.

this is not related to the Lods generator.The error occurs if create shadow meshes is active.

In Godot_v4.3-dev2_win64 this error is not reproduced.

akien-mga commented 7 months ago

Can you clarify what is the expected correct look in 4.3-dev2?

I tested on my system (Linux, AMD) and the MRP looks the same in 4.3-dev2 and 4.3-dev3, as well as 4.2-stable.

Calinou commented 7 months ago

The expected appearance is the one from CSG meshes and OBJ (notice how their shadows connect to the ground properly).

However, double-check the glTF scenes aren't using a different material by default which may skew the rendering (the fallback 3D material is not pure white, but the material you imported in the glTF scene might be).

piramidamsc commented 7 months ago

Apparently shadow meshes are distorted when they are generated. I just can't understand how the creation of uv2 lightmap affects them.

piramidamsc commented 7 months ago

Can you clarify what is the expected correct look in 4.3-dev2?

I tested on my system (Linux, AMD) and the MRP looks the same in 4.3-dev2 and 4.3-dev3, as well as 4.2-stable.

Yes, this is my mistake, I just checked the builds from version 4.2 beta 1 to 4.3 dev 3 creating a new project for each version and the error popped up in all cases.

clayjohn commented 7 months ago

Taking a look at this locally. It seems the issue is not present when using the imported meshes directly even if they have UV2s generated.

The only meshes that are impacted are ones where Arraymeshes are being used directly (i.e. not connected to a GLB or OBJ file). So, the clear workaround for now is to just reimport your meshes.

Seeing that you are using dev builds, I wonder if the ArrayMeshes were extracted during a period where mesh compatibility was broken. For example, if you had extracted those meshes during the Dev phase of 4.2, they could have been broken in a way that is fixed in newer builds. But you have preserved the broken mesh data by extracting them

clayjohn commented 5 months ago

I'm not sure if there is anything actionable anymore as this issue can't really be reproduced and seems to just be an issue with those specific ArrayMeshes.

@piramidamsc Can you confirm that the issue went away after reimporting your GLTF meshes?

Calinou commented 4 months ago

Closing due to lack of response. Please comment if you can still reproduce this following the instructions in https://github.com/godotengine/godot/issues/88123#issuecomment-2093935607.

piramidamsc commented 3 months ago

I'm not sure if there is anything actionable anymore as this issue can't really be reproduced and seems to just be an issue with those specific ArrayMeshes.

@piramidamsc Can you confirm that the issue went away after reimporting your GLTF meshes?

Hello.Sorry for taking so long to answer.I was busy.

Yes, I still have a problem.when generating UV2 for the lighting map, my shadows break.Maybe it's related to my PC since my hardware is outdated, gtx 560 ti and intel core i5 760.

Yes, if you re-import the model, the shadows are displayed correctly and UV2 is saved for light maps.

I have prepared an archive for you with a .blend file from which I exported the model into an empty Godot 4.2.2 for the purity of the experiment.

poy_test.zip Screenshot_1 Screenshot_2 Screenshot_3