ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to position lighting and remove shadows in ros3djs?

asked 2021-04-22 06:49:41 -0500

Py gravatar image

updated 2021-05-19 05:11:48 -0500

When I display markers using ros3djs they appear to be darker than they do on my default RViz setup. It seems my issue is related to lighting direction in ros3djs because I played around with different views in RViz and found that the same issues with shadowing there but from different directions. To me, it seems that I need to specify lighting direction in ros3djs. Is this possible?

Markers on ros3djs web GUI:

image description

Markers on RViz:

image description

I've played around with options like alpha and intensity in ROS3D.Viewer but these do not solve the problem. I'm hoping something like the pseudo code below might be available but I can't find anything on the docs here...... any ideas?

Initial viewer setup (real code):

let viewer = new ROS3D.Viewer({
    divID : 'map',
    width : 600,
    height : 600,
    background : '#FFFFFF',
    alpha : 1.0,
    antialias : true,
    intensity : 1.0,
    cameraPose : {x : -1, y : 0, z : 20},
    displayPanAndZoomFrame : true
});

Some pseudo code that I hope someone can advise how to properly implement:

viewer.addObject(new ROS3D.LightingPosition({x : -1, y : 0, z : 20}));
edit retag flag offensive close merge delete

Comments

1

I would say it's actually RViz which is "wrong" here. It has a pretty limited lighting model IIRC.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-22 07:58:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-05-20 04:32:33 -0500

Py gravatar image

After some troubleshooting, it turns out that lighting direction was not the problem - it was the default ambient light colour. I therefore solved this problem by changing the colour of the ambient light to white using three.js. Here's my code snippet:

viewer.scene.add(new THREE.AmbientLight(0xffffff));
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-04-22 06:49:41 -0500

Seen: 418 times

Last updated: May 20 '21