Closed JPGygax68 closed 1 year ago
It looks like the state is not set correctly before drawing to the screen. So I think there is nothing wrong with the shadow map code, it's where you draw the objects to the screen that's the issue. Can you link or paste that part of the code?
So my initial thought is that the shadow map rendering sets the Scissor box correctly to 1024x1024, however, when rendering to the screen the scissor box is not set, hence it still uses the 1024x1024 Scissor box and don't draw outside of the 1024x1024 area. To test, can you add context.set_scissor(camera.viewport().into());
in between the shadow map call and rendering to the screen?
Thank you! I forgot to take my laptop with so I can't check right now, but I will this afternoon.
On Mon, Jan 23, 2023, 09:22 Asger Nyman Christiansen < @.***> wrote:
It looks like the state is not set correctly before drawing to the screen. So I think there is nothing wrong with the shadow map code, it's where you draw the objects to the screen that's the issue. Can you link or paste that part of the code?
So my initial thought is that the shadow map rendering sets the Scissor box correctly to 1024x1024, however, when rendering to the screen the scissor box is not set, hence it still uses the 1024x1024 Scissor box and don't draw outside of the 1024x1024 area. To test, can you add context.set_scissor(camera.viewport().into()); in between the shadow map call and rendering to the screen?
— Reply to this email directly, view it on GitHub https://github.com/asny/three-d/issues/311#issuecomment-1399959393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGCFCFQSTKXFWAKEOTT5S3WTY5VHANCNFSM6AAAAAAUCOTDZQ . You are receiving this because you authored the thread.Message ID: @.***>
Aaand after another delay I can now confirm that your suggestion worked 100%. (As a side effect, the shadows are now somewhat jagged, but that is now just a matter of balancing performance against visual quality.)
I adapted the "statues" example to my needs. It worked, but I found that the output was clipped to the lower left corner of my window, everything else was black: The above ist the result of:
I had to increase the texture size passed to
DirectionalLight.update_shadow_maps()
until it was at least the width of my viewport (which is wider than it is high) to make the rest of the scene appear: With:What could I be doing wrong?