Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spot light does not produce shadow #2817

Open
e2002e opened this issue Mar 7, 2023 · 5 comments
Open

Spot light does not produce shadow #2817

e2002e opened this issue Mar 7, 2023 · 5 comments
Labels
bug This issue describes a bug

Comments

@e2002e
Copy link
Contributor

e2002e commented Mar 7, 2023

Spot light shades the object yet doesn't produce shadow.

Screenshot from 2023-03-07 14-52-52

Area lights just crashes the engine as soon as started.

@e2002e e2002e added the bug This issue describes a bug label Mar 7, 2023
@MoritzBrueckner
Copy link
Collaborator

MoritzBrueckner commented Mar 7, 2023

Hi, would you mind sharing an example file or at least your local configuration (i.e. deferred or forward, and so on)? Also, could you please write what OS and GPU you use (I can't reproduce it)? Thanks :)

@e2002e
Copy link
Contributor Author

e2002e commented Mar 8, 2023

Ok @MoritzBrueckner , I'm using Ubuntu with nvidia.
The only way I get shadow with spot is when either putting two of them or activating manually atlasing (which is what is done when two or more "non sun" lights are present, or maybe it has to do with clusters, don't remember.)
Deferred renderer, now I'm working on GI i have issue with forward I won't be able to test if that works.

@MoritzBrueckner
Copy link
Collaborator

MoritzBrueckner commented Mar 11, 2023

Created a separate issue for the area light crash: #2823. Please create one issue per problem if possible.

I can confirm the missing spot light shadows for both deferred and forward renderpaths (I forgot about this issue when I wrote above that I cannot reproduce it – this was an answer to the area light thing).

@MoritzBrueckner
Copy link
Collaborator

MoritzBrueckner commented Mar 13, 2023

Hi, just to let you know: I think I found the reasons for this issue (although there are still some open questions), and one of it I already managed to fix locally. However, since I'm very short in time this month, it will take a little longer until I can provide a fix (if I can, looks partly like a Kha/Kinc issue):

  • The world-view-projection matrix of spot lights is passed in a mat4 array uniform to the shader, but Armory recognizes the uniform as a float array which in turn caused Iron to never call the responsible code to actually pass the values to the shader.
  • Even after the float/matrix confusion was fixed, the shader still receives wrong matrix values which ultimately leads to the issue with missing shadows. This could me more tricky to fix, as I suspect the reason for the wrong values is the same as my second point in Issues with get_texture_unit functions Kode/Kinc#730. Sometimes, the compiled shader files do contain array brackets for the uniform names, sometimes (as in the case of the deferred light shader) they don't. This essentially writes all matrices to the same position in the buffer.

@e2002e
Copy link
Contributor Author

e2002e commented May 25, 2023

I can confirm that the Spots produce shadows via:
#if (arm_clusters && arm_spot)
case "_biasLightWorldViewProjectionMatrixSpotArray": {
fa = LightObject.updateLWVPMatrixArray(object, "spot");
}
arm_clusters need to be activated by having shadowmap_atlasing on or/and another light in the scene (other than a sun).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a bug
Projects
None yet
Development

No branches or pull requests

2 participants