When most flash programmers want to access 3D Projects, they should be the same as me. They are most concerned about how to build a mountain and how to display the flowing river in the scenario, or how to make the model move (running, attacking, or dancing), or how to replace the character and how to equip the character with weapons.
However, please believe me. The terms we mentioned below must be understood before the course begins. Maybe they are not worth reading, however, if you are a beginner and can understand some basic knowledge, they will eventually help you one day in the future.
I will try my best to avoid using words that are too professional and difficult to understand. If any of you think the following content is incorrect or is not enough, please let me know, I will constantly modify and improve these content in the future. Thank you ^
Origin (originally called the start point ):
In the 3D world and the center of an object, any object in the 3D world will have an origin. No matter the scene, 3D model, light, or camera, its position is the object or scene, 0) coordinates. You may not see it in all 3D engines or 3D software (such as 3 Dmax), but it actually exists and plays a corresponding role.
Geometry (ry ):
In away3d, the geometry class is actually a data object, which is used to save basic data of 3D objects, such as vertices, normals, and UV data, the model files we load from the outside will be parsed into a geometry instance and saved in memory.
Of course, we can also create some basic geometric shape data by instantiating some sub-classes of geometry.
Planegeometry // plane
Cubegeometry // Square
Spheregeometry // spherical
Cylindergeometry // cylindrical
Capsulegeometry // Capsule
Material (material ):
We can also call it texture. The basic texture is divided into three types: color texture, photo texture, and wiremap (wiremap is only used for wiremap objects ), we can also set opacity and light reflection intensity for textures to achieve some special effects.
Mesh (mesh ):
Mesh is a container. If we set shape data and textures for it, we can see it in the scene. It can be a square, a ball, it can also be a complex model such as a car or a building. Of course, it can be just a point, a line, or a plane. Everything depends on the geometry data content it contains.
UV:
U, V is short for texture coordinates (it is similar to the X, Y, and Z axes of 3D models). The horizontal direction is U, and the vertical direction is v, the UV Coordinate System of the Two-dimensional plane defines the information of the positions of each point on the image. these points are associated with the 3D model to determine the position of the surface texture. UV precisely maps each point in the image to the surface of the model object. the software performs smooth image interpolation on the gap between points. this is the so-called UV texture.
Normals (normal ):
A normal is not a solid line. It is a virtual line perpendicular to a node on a curve and a tangent to the surface, use positive and negative values to represent and distinguish the forward parameters of the polygon and vertices. Only the points and surfaces with the normal value are visible in the scenario. Generally, from internal to external, the normal at the current position is positive. If you flip the surface, the normal direction is changed. If your model is not displayed on both sides, the negative side is invisible in the vision window and cannot be rendered.
Light ):
The world we live in must have light, or it will be dark...
The same is true in 3D, but the difference is that, we need to use a limited number of lighting types in the 3D world to simulate most visible light sources in the real world (invisible light sources like infrared are not discussed here)
Currently, away3d 4.0 provides two types of light sources.
Pointlight: This is the most commonly used lamp. We can use it to simulate the sun, moon, or lamp.
Directionallight: Well, it can be used to simulate a searchlight, or the effect of moonlight through a window.
View3d ):
This is the entrance to the entire 3D world. It is like watching the world through a window. In away3d, view3d is the window. You can add multiple view3d instances in flash, just like opening multiple windows on one wall, each view3d instance can point to the same scene3d or different scene3d, but remember, even if all view3d objects point to the same scene3d instance, the performance may degrade. Therefore, we usually only use one view3d instance.
Scene3d (scenario ):
Scene3d is a window outdoor landscape. Its function in Flash is similar to stage. All 3D objects must be addchild to be displayed, you can also instantiate multiple scene3d instances at the same time, but each view3d instance can be assigned only one scene3d instance at a time.
Camera3d (lens ):
We talked about the windows and the scenery. Well, I admit it's a bit old-fashioned, but if you want to see the content, you still need your eyes. camera3d is like your eyes, if you move the coordinates of camera3d, it is equivalent to moving your eyes, .... what if we move the coordinates of objects in scene3d ?..... That means that the object is moving... =!
- // Example:
- VaR view: view3d = new view3d ();
- // View3d instances must be added to the stage to take effect correctly.
- Stage. addchild (View );
- // Create a cube data with a length, width, and height of 500
- VaR cubegeometry: cubegeometry = new cubegeometry (500,500,500 );
- // Create a monochrome texture (material)
- VaR cubematerial: colormaterial = new colormaterial (0xff0000 );
- // Create a visible mesh object and set shape data and textures
- VaR cubemesh: mesh = new mesh (cubegeometry, cubematerial );
- // Add the mesh to the stage
- View. Scene. addchild (cubemesh );
- // Move objects in the landscape
- Cubic emesh. Z + = 100;
- // Move the lens or move your eyes ....
- Views. Camera. z = 100;
Copy code
Objectcontainer3d:
By the way, the objectcontainer3d class is the base class of most 3D Visual Objects in away3d,
If you want to create a complex 3D object (such as an object containing several mesh objects) by yourself, you can inherit it to achieve your own needs.
Away3d 4.0 getting started tutorial-the foundation of the world