1

Is this possible? I want to load an image for the background.

Currently I got this:

viewer.setLightPreset(4);
viewer.setQualityLevel(false, false);
viewer.setGhosting(true);
viewer.setGroundShadow(true);
viewer.setGroundReflection(true);
viewer.setEnvMapBackground(false);
viewer.setProgressiveRendering(true);

But neither of these makes it possible to add a image for the background. If this is not within the API, would it be possible to change the background color? (not the load background color, but the viewer background color)

1
  • Hi~ I have update the answer, hope it help. Commented Aug 21, 2017 at 7:27

1 Answer 1

3

There is no API available for changing the viewer background image. But a workaround could be applied in this case, please refer the answer here.

However, you can change the background color via the viewer.setBackgroundColor. Here is an example for change background into red color:

viewer.setBackgroundColor( 255, 0, 0, 255, 255, 255 )

The first 3 arguments are for the top clear color of the WebGLRenderer. The others stand for the bottom clear color of the WebGLRenderer. But there is no documentation that describes what top and bottom clear color is.

===== Update =====

After some research, I found that:

  • If you want to change the background color into pure colors, you can set both top and bottom clear color up with the same value. e.g.

    // Change whole background color into red.
    viewer.setBackgroundColor( 255, 0, 0, 255, 0, 0 )
    
  • If you want to change the background color in the color gradient style, you can set the top clear color and the bottom clear color with different value. e.g.

    // Change background color in a color gradient style, top color is red, bottom color is white.
    viewer.setBackgroundColor( 255, 0, 0, 255, 255, 255 )
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.