Inviscam doesn't ignore character in first person

When in first person the invisicam system doesn’t ignore the character. This is due to a call to

local partsTouchingCamera = game.Workspace:FindPartsInRegion3(region3,nil,10)

which should be

local partsTouchingCamera = game.Workspace:FindPartsInRegion3(region3,Character,10)	

Character is not ignored in first person with invisicam enabled causing an issue where in first person you can see your character’s body as invisicam glitches out with the the TransparencyController not updating every frame.

This only happens when running or when the character is moved a bit from the camera origin.

As in first person it finds parts parented to the Character.

I have a pull request here to fix that.

Reproduction

  1. Create a new place
  2. Set camera mode to inviscam
  3. Zoom in all the way
  4. Look straight down
  5. Walk around a bit

Expected behavior:
Arms, nothing else shows up. This is even worse with some animations I’m running on my character which makes invisicam unplayable.

Thanks!

4 Likes

Strange - why does this only occur with r15 arm parts?

:thinking:

1 Like

It’s based upon camera location and position. I believe the character is located forwards from the camera.

It happens with other parts (head, hats, et cetera) based upon animations and size of character.

Just realized: You may need to set your avatar to be mine to fully reproduce. My character a bit taller than normal.

1 Like

Thanks for reporting this! This collision test was a last minute addition to fix another bug, where the camera could swing inside the bounding box of a concave mesh part, and not make the mesh invisible because all the rays originate from within the part. It was possible for the mesh to still have faces that are facing towards the camera, blocking the view.

I will have a look at how best to remedy this. I didn’t expect Invisicam to be updating at all when in first person, the TransparencyController should be what’s using LocalTransparencyModifier when the camera is really close to your character.

1 Like

I’ve identified the code that causes this issue.

I sent a pull request which fixes this completely. It’s easy enough to just ignore the character.

For now, I’ve forked the camera scripts in my game.

This is perfectly fine to do to get your game patched, and I’ll be discussing how we fix this in the core scripts tomorrow with @darthskrill. My choice of passing nil to FindPartsInRegion3 was deliberate and I’d like to avoid changing that if possible, because it adds the overhead of traversing the character model hierarchy on every renderstep, and that region3 shouldn’t be touching your character when Invisicam is running. The real bug here is that the occlusion modules (Invisicam and Poppercam) are not getting disabled when you scroll in to first-person. Both of these modules have significant cost from multiple raycasts, so disabling them will actually improve first-person performance of your game for players with lower-end machines.

If it turns out that the character can still intersect that region3 at the minimum distance where the occlusion modules are active because of huge wings, tail, festive narwhal, or something like that, I’d rather just skip that PartsInRegion3 check when the camera gets close enough to possibly hit these things.

2 Likes

Thank you! This explanation is excellent!

Last week, I looked into this, and I ended up checking in an interim solution that includes your proposed fix, @Quenty. The long-term fix of disabling occlusion modules in first-person turned out to be a better candidate for my ongoing refactor of the camera scripts, since there are currently some minor differences between “LockFirstPerson” and scrolling in to first person with the mouse wheel, as well as an unhandled edge case if anyone were to set StarterPlayer.CameraMinZoomDistance to 2.0. I’m making all this work consistently and definitively, and will incorporate the enabling/disabling of all occlusion modules. Thanks for your help!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.