Hidden in Rendering

Typically: "How do I... ", "How can I... " questions
Post Reply
zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Hidden in Rendering

Post by zhengkz »

Hi,

I wonder how to stop rendering a specific object for vision sensors, especially when the sensor is under 'color-coded handles' mode.

I have tried 'Hidden during simulation' and changed the visibility layers, but neither works for the rendering. Hope for your reply!

Best,
Kz

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Hidden in Rendering

Post by coppelia »

Hello,

as of CoppeliaSim V4.6, I would use following approach:
  • set the vision sensor to explicit handling
  • in a child script, in the sensing section, call sim.handleVisionSensor(yourVisionSensorHandle)
  • if you need to hide/show an object at some point, simply appropriately adjust the visibility layer for that object before/after the call to sim.handleVisionSensor, with sim.setObjectInt32Param(objectHandle, sim.intparam_visible_layers, l)
Cheers

zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Re: Hidden in Rendering

Post by zhengkz »

Thanks for your reply! I'm wondering what values should I set the visibility layer to hide/show. By default, will all vision sensors always only render the objects in the first layer and ignore other layers? Thanks!

Best,
Kz

zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Re: Hidden in Rendering

Post by zhengkz »

To give a more clear example, I attached two images below:

Image
image 1

Image
image 2

Image 1 comes from a normal RGB camera, and Image 2 comes from a handle-coded camera. You can see there are two large shadows above the boxes where these two cuboids should not be rendered. I have set 'Hidden during simulation' = True and set visibility layer = 2, but it still happens.

Best,
Kz

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Hidden in Rendering

Post by coppelia »

Do something like:

Code: Select all

function sysCall_sensing()
    sim.setObjectInt32Param(objectToToggle, sim.intparam_visible_layers, 0) -- hide
    sim.handleVisionSensor(visionSensorHandle)
    sim.setObjectInt32Param(objectToToggle, sim.intparam_visible_layers, 0xffff) -- show
end
Cheers

Post Reply