You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -241,13 +241,16 @@ This recquires a couple of things.
241
241
242
242
First, you need to take make sure the background class is declared as an input in your constructors call to super.
243
243
Then, in your constructor, you need to define the mesh your background class will draw on, its size and location, and add it to your scene.
244
+
244
245
At this point you should be mindfull of whether you make your background render from both sides, or only the front or back side.
245
246
If you make a background in the form of a "sky box" that engulfs the scene in front of the camera, you'll likely want to set the drawing side to `side: THREE.BackSide`.
246
247
(This is handy if you have a lot of camera movement and can't guarantee that that anything in your scene wil neccessarily be infront of any given plane that you might have wanted to use as a background.)
247
-
This should prevent your background from loading in front of th
248
+
Doing so should prevent your background from rendering in front of the scene you are trying to display and blocking the view of it.
249
+
248
250
After that, in your scenes `update`-function, you need to ensure that your background also gets updated.
249
251
That is done by setting assigning materials' (mesh you declared in the constructors') map to the background-input.
250
252
Note that you at this point probably should also set the flag for that it needs updating.
253
+
251
254
Lastly, you should be aware that in regards to the camera and general movement in the scene, the backgound can be considered just like any other object.
252
255
This implies that for a scene with a lot of camera movement, you can both make the background an object that moves together with the camera and appears static, or you can make it rotate wildly.
253
256
@@ -270,7 +273,7 @@ Example:
270
273
}
271
274
// more constructor input
272
275
this.background=newTHREE.Mesh(
273
-
newTHREE.BoxGeometry(10000,10000,10000),
276
+
newTHREE.BoxGeometry(skybox_x_size_in_scene, skybox_y_size_in_scene, skybox_z_size_in_scene), // Note that these are independent of the dimentions you declare for the canvas in the background. E.g. you can work on a 1024 x 1024 x 1 canvas in your background that is spread out on a 3440 x 1440 x 2048 surface in the scene. You'd probably want to make the aspect ratios equivalent or draw one flat surface on each side of a 3d box in your scene though)
0 commit comments