User:Luysys

Desarrollo de Software

Abi Sistemas

Lighting the Scene One ambient and two directional lights are added to the scene by lightScene(). An ambient light reaches every corner of the world, illuminating everything equally: private void lightScene() { Color3f white = new Color3f(1.0f, 1.0f, 1.0f); // Set up the ambient light AmbientLight ambientLightNode = new AmbientLight(white); ambientLightNode.setInfluencingBounds(bounds); sceneBG.addChild(ambientLightNode); // Set up the directional lights Vector3f light1Direction = new Vector3f(-1.0f, 1.0f, -1.0f); // light coming from left, up, and back quadrant Vector3f light2Direction = new Vector3f(1.0f, 1.0f, 1.0f); // light coming from right, up, and front quadrant DirectionalLight light1 = new DirectionalLight(white, light1Direction); light1.setInfluencingBounds(bounds); sceneBG.addChild(light1); DirectionalLight light2 = new DirectionalLight(white, light2Direction); light2.setInfluencingBounds(bounds); sceneBG.addChild(light2); } // end of lightScene() The color of the light is set and the ambient source is created along with bounds and added to the scene. The Color3f() constructor takes red/green/blue (RGB) values between 0.0f and 1.0f (1.0f being “full-on”). A directional light mimics a light from a distant source, hitting the surfaces of objects from a specified direction. The main difference from an ambient light is the requirement for a direction, such as in the following: Vector3f light1Direction = new Vector3f(-1.0f, 1.0f, -1.0f); // light coming from left, up, and back quadrant The direction is the vector starting at the specified coordinate, pointing toward (0, 0, 0); the light can be imagined to be multiple parallel lines with that direction, originating at infinity. Point lights and spotlights are the other forms of Java 3D lighting. Point lights position the light in space, emitting in all directions. Spotlights are focused point lights aimed in a particular direction.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.