How to reduce the transparency when DevCameraOcclusionMode = Invisicam?

Invisicam more than likely uses BasePart | Roblox Creator Documentation to work.

1 Like

So, in this case, how do I detect that Invisicam has been triggered for an object?
Do I have to track all existing in-game objects inside a RenderStep?
Or is there any specific signal I can use for an object when it’s modified by Invisicam?

1 Like

No you should use GetPartsObscuringTarget to check what parts are affected and set their BasePart | Roblox Creator Documentation every RenderStepped.

Understand. However, this will have a high CPU cost when there are thousands of parts inside the game…

1 Like

Instead you can connect a :GetPropertyChangedSignal to the LocalTransparencyModifier property on every part.

2 Likes

Hey. Good news: I found the solution. So Invisicam (just like all the other player control related stuffs) is being controlled by Roblox’s PlayerModule. That module gets loaded into every player’s PlayerScripts when the game starts. However, if there is already one there, it wont get loaded. So what you do is:
0. Set camera occlusion mode to “Invisicam” (you have already done this);

  1. Click “Play Test” to test your game;
  2. Now find your player in game.Players and find an object named PlayerScripts, then expand it and you are gonna see a whole bunch of stuff. Find a module named “PlayerModule”:
  3. Cut the “PlayerModule” (Ctrl + X on windows) and click “Stop” to get back to Studi Edit mode.
  4. Now paste the “PlayerModule” into StarterPlayerScripts.
  5. Expand the module, expand “CameraModule” and you will find a module named “Invisicam”. Open it in script editor.
  6. At the very top of it there is a variable named “TARGET_TRANSPARENCY”. It is set to 0.75. Set it to 0 (or any other value that you want).
  7. Play test your game and you will see that it doesnt make the part transparent:
    new2.wmv (1.6 MB)
6 Likes

@debugger57 That’s great idea! Thank you for all your effort.

However, @Abcreator gave the simpler solution:

Now it’s very easy to detect any property change, like LocalTransparencyModifier.

Here’s my final solution, which will reduce the default (0.75) transparency to 0.5:

part:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
	if part.LocalTransparencyModifier == 0.75 then 
		part.LocalTransparencyModifier = 0.5
	end
end)

@Abcreator although it’s your idea, I’ll set this post as solution, since it has a code snippet to facilitate the consultation of future similar questions.
Thank you for the tip!

5 Likes

Hmm, there is a glitch in my previous solution:

If I change the LocalTransparencyModifier inside its own GetPropertyChangedSignal("LocalTransparencyModifier"), it will create an infinite recursive loop…

1 Like

Check the value of it before changing it.

I ran several tests and reached some important conclusions:

  1. It’s no use changing the LocalTransparencyModifier value inside GetPropertyChangedSignal("LocalTransparencyModifier"). Roblox will not accept this change and will re-force the value 0.75 every time.
    Here a project that’s showing this: invisicam.rbxl (26.4 KB)
  2. When two or more parts are together, with no space between them, the value of LocalTransparencyModifier will fluctuate between 0.75 and 0.5 (as reported here):
  1. Finally, the DevCameraOcclusionMode = Invisicam property acts for ALL objects, so I can’t specify a blacklist or whitelist for which objects I want to be affected by this property.

Taking all these restrictions into consideration, I conclude that it is easier and more flexible to create a Raycast script between the camera and the character, leaving only the parts that interest me semi-transparent.

2 Likes

I suggest using @debugger57 ‘s solution. You only need to change one variable, and if you are scared that you’ll miss an update, change the PlayerModule every once in a while. To me it seems like the easier solution.

Or, if you want to get really technical, you can copy the code inside the Invisicam module and make the appropriate edits (which could take a bit).

If you need any help or suggestions let us know.

3 Likes

You’re right. It really was the simplest solution. I only realized this after getting hit a lot with all the bugs I reported above. I was already developing a whole ray method as I mentioned before, but your answer came just in time.
I was not aware that it was possible to hack this script.
Thank you for your insistence and your patience.

@debugger57 Thank you for your effort and your solution. There was only one problem when duplicating the original Invisicam script, showing the warning about Humanoid.Torso deprecated:

Changing by Torso by RootPart solved the problem:

2 Likes

Well, there is only one remaining limitation, which I commented on before: Invisicam acts on ALL objects. How to create a whitelist or blacklist to choose only some objects to be affected by transparency?

2 Likes

Camera | Roblox Creator Documentation has an ignoreList property you can use.

1 Like

Yeah, I also see that in the original InvisiCam script there are mentions of GetPartsObscuringTarget.
I just don’t know how to add items to the ignore list of this script.

2 Likes

In the second argument of the function add a table of all the parts you wish to ignore.

1 Like

Adding onto this, you should make a variable at the beginning of the Invisicam script, that looks like this

local IGNORE_PARTS = {}

Then, like @Abcreator said, add the IGNORE_PARTS variable to the second argument of the function.

2 Likes

I mean, how, in my LocalScript I will interact sending this ignorelist table to my current hacked Invisicam script?

2 Likes

Use PlayerModule as I explained in my post before. It should be put into StarterPlayerScripts.

1 Like

Yeah, I already did and it’s working as I said before.
image
But my question now is how can I send my current ignore list table that is located in my Localscript to this hacked script.

2 Likes