Jump to content

Box Light Stops Working After Move/Rotate


Go to solution Solved by Josh,

Recommended Posts

Posted

I've run into an issue where the box light shows up in the 3D viewport, but doesn't in a test game. This often occurs after the box light has been placed and then, later, moved or rotated. So, if I create a box light and position initially, then run a test game, it shows up fine. But if I then move or rotate the box light, it fails to work in test game even though it continues to show correctly in the 3D viewport (see screen shot).

box.png

  • Thanks 1

Creating professional 2D and 3D content is my passion!
Monkey Frog Studio

Posted

This also happens if you just open the map in the editor.

The cause is around line 145 of Shaders/PBR/Lighting.glsl:

if (shadowCoord.x < 0.0f || shadowCoord.y < 0.0f || shadowCoord.x > 1.0f || shadowCoord.y > 1.0f || shadowCoord.z < shadowrange.x || shadowCoord.z > shadowrange.y) return lighttype;

Ah, okay, it is due to the lack of any shadow range value I think...

|| shadowCoord.z < shadowrange.x || shadowCoord.z > shadowrange.y

Something like that...I will continue to look for the exact cause...

  • Like 1
  • Upvote 1

Let's build cool stuff and have fun. :)

Posted

Seems there's another issue, possibly related. 

I created a lightbox, unticked Cast Shadows (so it's False). That one works fine. Can move it, rotate it, etc., and it updates in the viewport. However, if I use the move tool and drag out a copy (holding SHIFT) the new one does not cast any light at all. If I then go to the Scene panel and tick Cast Shadow on then off again, it works. I have to do this for each duplicate I create. 

This does not happen when creating a new lightbox since they come in automatically with Cast Shadows ticked. 

To emphasize - if a shadowbox has Cast Shadow unticked (False) and you duplicate it, it will not show any light. You have to tick then untick Cast Shadow if you want the lightbox to create a light but not cast a shadow.

Creating professional 2D and 3D content is my passion!
Monkey Frog Studio

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...