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

Only one pointlight at a time possible #1772

Closed
Simonrazer opened this issue Jul 18, 2020 · 12 comments
Closed

Only one pointlight at a time possible #1772

Simonrazer opened this issue Jul 18, 2020 · 12 comments
Labels
bug This issue describes a bug has workaround This issue has a known workaround kha This issue needs to be fixed/implemented in Kha

Comments

@Simonrazer
Copy link
Contributor

Links to #1140 #1429, reposting because these issues don't have the error posted and don't get the attention they really need.

Description
When using more than one pointlamp this error occurs:
When using Deferred rendering:

Compiling shader 20 of 20 (World_World.vert.glsl).
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(152,20-84): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(5,14-30): error X4500: overlapping register semantics not yet implemented 's1'
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(7,14-30): error X4500: overlapping register semantics not yet implemented 's2'
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(9,14-30): error X4500: overlapping register semantics not yet implemented 's3'
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(4,19-26): error X4500: overlapping register semantics not yet implemented 't1'
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(6,19-26): error X4500: overlapping register semantics not yet implemented 't2'
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\deferred_light.frag.hlsl(8,19-26): error X4500: overlapping register semantics not yet implemented 't3'

Compiling shader 8 of 20 (deferred_light.frag.glsl) failed:
Shader compiler error.
(node:8276) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:8276) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8276) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ERROR: Build failed, check console

When using Forward rendering:

Compiling shader 19 of 19 (World_World.vert.glsl).
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\armdefault_mesh.frag.hlsl(125,20-84): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\armdefault_mesh.frag.hlsl(8,19-30): error X4500: overlapping register semantics not yet implemented 't1'

Compiling shader 1 of 19 (armdefault_mesh.frag.glsl) failed:
Shader compiler error.
(node:12752) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:12752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:12752) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\Material_mesh.frag.hlsl(125,20-84): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Users\SK\Desktop\Armory\blends\test\build_test\debug\temp\Material_mesh.frag.hlsl(8,19-30): error X4500: overlapping register semantics not yet implemented 't1'

Compiling shader 8 of 19 (Material_mesh.frag.glsl) failed:
Shader compiler error.
ERROR: Build failed, check console

This makes it impossible to build bigger scenes in Armory.

To Reproduce
Place more than one pointlamp

System
Blender: 2.82/2.83
Armory: latest git
OS: Win 10
Graphics card: Gtx 1060

lampbug.zip

@Simonrazer Simonrazer added the bug This issue describes a bug label Jul 18, 2020
@Simonrazer Simonrazer changed the title Only one pointlight per scene possible Only one pointlight at a time possible Jul 18, 2020
@knowledgenude
Copy link
Collaborator

Here it is working i guess
Screenshot_20200718_113227

untitled.zip

@Simonrazer
Copy link
Contributor Author

Simonrazer commented Jul 18, 2020

Tried your file, not working for me (and probably many others too, judging by the similar issues I missed to link).
Multiple lights used to work some months ago or so, are you sure you have a up-to-date version?
Also reminder, I use Windows (as do many others).

@knowledgenude
Copy link
Collaborator

I use Git version. I also have this problem in Windows but not in Linux. Did you already tryed with a Windows or Linux Krom export?

@Simonrazer
Copy link
Contributor Author

I don't have a Linux machine. A Windows Krom export does result in the deferred error. If I set the Play mode to Browser in works though.

@knowledgenude
Copy link
Collaborator

Then the problem is happening in Windows Krom export, as it occurs in Krom and Kromx (not tested in C). I will test other builds here and see what happens

@MoritzBrueckner
Copy link
Collaborator

MoritzBrueckner commented Jul 18, 2020

It's also happening to me on Krom (Windows 10). There was a small discussion about this and similar lighting issues in the discord channel:
https://discordapp.com/channels/486771218599510021/486771218599510024/713166567134724118

Summary:
Without knowing anything about HLSL (that's where the error occurs), I assume the error lays within the declaration of uniforms (if it's even called like that in HLSL too).

Instead of this:

SamplerComparisonState _shadowMapSpot_sampler[4] : register(s0);
SamplerComparisonState _shadowMapPoint_sampler[4] : register(s1);

The generated output should probably look like this (source: https://stackoverflow.com/a/32479831/9985959):

SamplerComparisonState _shadowMapSpot_sampler[4] : register(s0);
SamplerComparisonState _shadowMapPoint_sampler[4] : register(s4); // <-- s4 instead of s1 because the arrays have length 4

I'm unfortunately not able to help here, maybe it's even a Kha issue (because of the glsl -> hlsl conversion), I don't know.

Edit: I think this might be a Krafix issue. If you export with opengl it obviously works (glsl) but with DirectX it fails (hlsl), so the conversion is probably wrong. Maybe those files have to be fixed: https://github.com/Kode/krafix/blob/master/Sources/D3D11Compiler.cpp and https://github.com/Kode/krafix/blob/master/Sources/D3D9Compiler.cpp

@knowledgenude
Copy link
Collaborator

knowledgenude commented Jul 22, 2020

I can't test with DirectX now, but in OpenGL it is working fine. I only get an issue trying to use Vulkan API:
Screenshot_20200721_225953

My GPU supports Vulkan, maybe it is missing some drive. Can someone please test if Vulkan is working or not in Armory with the example above trough a Krom export?

@Simonrazer
Copy link
Contributor Author

I tried to build Kromx for Vulkan but it fails. As for OpenGL, it build a Krom.exe without any errors, but when I actually try to build the Game with Armory and then launch it nothing happens. When I try to open it via commandline no messages are there, it is just instantly done. That might be because I did stuff wrong, but I am don't know what that could be. I used these instructions to build Kromx, I just replaced the "direct3d11" with "opengl" or "vulkan".

@e1e5en-gd
Copy link
Contributor

When adding a second light to the scene, various errors occur with the deferred_light.frag.hlsl shader:

  1. Point and Spot (Spot and Spot)
    use-case-1
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(146,20-75): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(290,5): warning X4000: use of potentially uninitialized variable (sampleLight)
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(8,24-46): error X4500: overlapping register semantics not yet implemented 's1'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(8,24-46): error X4500: overlapping register semantics not yet implemented 's2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(8,24-46): error X4500: overlapping register semantics not yet implemented 's3'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(11,14-30): error X4500: overlapping register semantics not yet implemented 's2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(13,14-30): error X4500: overlapping register semantics not yet implemented 's3'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(15,14-30): error X4500: overlapping register semantics not yet implemented 's4'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(7,21-34): error X4500: overlapping register semantics not yet implemented 't1'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(7,21-34): error X4500: overlapping register semantics not yet implemented 't2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(7,21-34): error X4500: overlapping register semantics not yet implemented 't3'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(10,19-26): error X4500: overlapping register semantics not yet implemented 't2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(12,19-26): error X4500: overlapping register semantics not yet implemented 't3'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(14,19-26): error X4500: overlapping register semantics not yet implemented 't4'

Compiling shader 4 of 19 (deferred_light.frag.glsl) failed:
Shader compiler error.
(node:4596) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:4596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:4596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  1. Point and Point
    use-case-2
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(152,20-84): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(5,14-30): error X4500: overlapping register semantics not yet implemented 's1'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(7,14-30): error X4500: overlapping register semantics not yet implemented 's2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(9,14-30): error X4500: overlapping register semantics not yet implemented 's3'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(4,19-26): error X4500: overlapping register semantics not yet implemented 't1'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(6,19-26): error X4500: overlapping register semantics not yet implemented 't2'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(8,19-26): error X4500: overlapping register semantics not yet implemented 't3'

Compiling shader 4 of 19 (deferred_light.frag.glsl) failed:
Shader compiler error.
(node:9004) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:9004) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  1. Point and Area
    use-case-3
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(361,20-75): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(19,14-30): error X4500: overlapping register semantics not yet implemented 's4'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(21,14-30): error X4500: overlapping register semantics not yet implemented 's5'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(18,19-26): error X4500: overlapping register semantics not yet implemented 't4'
...\two_lights\build_error_two_lights\debug\temp\deferred_light.frag.hlsl(20,19-26): error X4500: overlapping register semantics not yet implemented 't5'

Compiling shader 4 of 19 (deferred_light.frag.glsl) failed:
Shader compiler error.
(node:9916) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:9916) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9916) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

When using Sun light source with other sources - no errors.
In this case, errors occur even if the light sources are in different scenes of the same project.

System
Blender: 2.83.8
Armory: git, master (9e8117e)
OS: Windows 10 64-bit
Graphics card: NVIDIA GeForce 930M

Test File
error_two_lights.zip

@MoritzBrueckner
Copy link
Collaborator

There is a workaround now, thanks to #2102. When the new Shadow Map Atlasing option is enabled, multiple lights are now also working on DirectX.

@MoritzBrueckner
Copy link
Collaborator

Found a minimal reproducible example file for Krafix, so it's a Krafix bug: Kode/krafix#88

@MoritzBrueckner MoritzBrueckner added the kha This issue needs to be fixed/implemented in Kha label Jun 4, 2022
@MoritzBrueckner
Copy link
Collaborator

Fixed in SDK 22.07 :)

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 has workaround This issue has a known workaround kha This issue needs to be fixed/implemented in Kha
Projects
None yet
Development

No branches or pull requests

4 participants