- Home /
Visualizing Camera preview
Hi I am developing an application to visualize what security cameras would see in a house or office and I am having problems with the visualization. Right now users can create, personalize and preview the cameras in gamemode. I want to apply a red light to what the created camera is seeing so that users can see it from the main Camera. I have tried using cookies on spot lights but they glitch a lot and wouldnt adapt to the aspect ratio. Is there a way to do this? Thanks in advance
Answer by xibanya · Dec 24, 2019 at 09:11 AM
Can you explain a bit more about the ultimate effect you want to achieve? If you've seen it in another game, can you provide a screenshot? I'm not sure what exactly is the effect you want. Do you mean you want the object the player is looking at to have a light shined on it? in that case, it's unclear to me why a spotlight wouldn't work, since the camera's aspect shouldn't affect the spotlight.
Do you mean you want the currently targeted object to be tinted red? If that's the case, you could raycast from the camera center towards the object to get it, then find the mesh renderer component, get the material, and set the material tint (probably either the main color or emissive color value) Cache the object, and set a timer. When the timer elapses, try to hit it with a raycast from the camera again. if you still can, reset the timer. If you can't, set its color back to normal.
I want the region seen by the camera to tint red , the new camera that users can preview, but not that region in mesh terms but like what the new camera is exactly seeing. Its difficult to explain so I hope the images are enough to explicate it. I have tried decals in HDRP but they dont work and HDRP is not supported for Android which is the target platform. I think a shader might be the solution but I am not emperimented with them. Any ideas or tips? Thanks in advance
Also it should adapt to camera changes (focal length , aspect ratio...etc) as it appears in the image (texts are in spanish).
Your answer
Follow this Question
Related Questions
Render Texture display different with its camera preview 1 Answer
Game preview incorrect! 0 Answers
How to make camera position relative to a specific target. 1 Answer
Change angle of camera in prefab preview 4 Answers
What are Camera Types for? 1 Answer