sub-unity sub是什么意思思

08-1708-1709-1008-09
10-0312-2701-0901-27
◇本站云标签
◇热点推荐Each shader in Unity consists of a list of subshaders. When Unity has to display a mesh, it will find the shader to use, and pick the first subshader that runs on the user’s graphics card.
Subshader { [Tags] [CommonState] Passdef [Passdef ...] }
Defines the subshader as optional tags, common state and a list of pass definitions.
A subshader defines a list of
and optionally setup any state that is common to all passes. Additionally, subshader specific
can be set up.
When Unity chooses which subshader to render with, it renders an object once for each Pass defined (and possibly more due to light interactions). As each render of the object is an expensive operation, you want to define the shader in minimum amount of passes possible. Of course, sometimes on some graphics hardware the needed effect can’t be d then you have no choice but to use multiple passes.
Each pass definition can be a , a
Any statements that are allowed in a Pass definition can also appear in Subshader block. This will make all passes use this “shared” state.
SubShader {
Lighting Off
SetTexture [_MainTex] {}
This subshader defines a single Pass that turns off any lighting and just displays a mesh with texture named _MainTex.
ShaderLab: Properties
ShaderLab: PassVersion: 5.3
LanguageEnglish
Script language
Select your preferred scripting language. All code snippets will be displayed in this language.
UnityEngine
Inherits from:
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Your email
Suggestion *
Submit suggestion
Description
A class that allows creating or modifying meshes from scripts.
Meshes contain vertices and multiple triangle arrays.
for examples of using the mesh interface.The triangle arrays are simply indices in three indices for each triangle.For every vertex there can be a normal, two texture coordinates, color and tangent.
These are optional though and can be removed at will. All vertex information is stored in separate
arrays of the same size, so if your mesh has 10 vertices, you would also have 10-size arrays
for normals and other attributes.There are probably 3 things you might want to use the modifyable mesh interface for:1. Building a mesh from scratch:
should always be done in the following order: 1) assign
2) assign .
var newVertices : [];
var newUV : [];
var newTriangles : int[];function Start () {
var mesh :
GetComponent.&MeshFilter&().mesh =
mesh.vertices = newV
mesh.uv = newUV;
mesh.triangles = newT
using UnityE
using System.Cpublic class ExampleClass :
public [] newV
public [] newUV;
public int[] newT
void Start() {
mesh = new ();
GetComponent&MeshFilter&().mesh =
mesh.vertices = newV
mesh.uv = newUV;
mesh.triangles = newT
2. Modifying vertex attributes every frame:
1) get vertices, 2) modify them, 3) assign them back to the mesh.
function Update () {
var mesh :
= GetComponent.&MeshFilter&().
var vertices : [] = mesh.
var normals : [] = mesh. for (var i = 0; i & vertices.L i++)
vertices[i] += normals[i] * (); mesh.vertices =
using UnityE
using System.Cpublic class ExampleClass :
void Update() {
mesh = GetComponent&MeshFilter&().
[] vertices = mesh.
[] normals = mesh.
int i = 0;
while (i & vertices.Length) {
vertices[i] += normals[i] * ();
mesh.vertices =
3. Continously changing the mesh triangles and vertices:
to start fresh, 2) assign vertices and other attributes, 3) assign triangle indices.It is important to call Clear before assigning new vertices or triangles.
Unity always checks the supplied triangle indices whether they don't reference out of bounds vertices.
Calling Clear then assigning vertices then triangles makes sure you never have out of bounds data.
var newVertices : [];
var newUV : [];
var newTriangles : int[];function Update () {
var mesh :
= GetComponent.&MeshFilter&(). mesh.Clear();
// Do some calculations...
mesh.vertices = newV
mesh.uv = newUV;
mesh.triangles = newT
using UnityE
using System.Cpublic class ExampleClass :
public [] newV
public [] newUV;
public int[] newT
void Update() {
mesh = GetComponent&MeshFilter&().
mesh.Clear();
mesh.vertices = newV
mesh.uv = newUV;
mesh.triangles = newT
The bind poses. The bind pose at each index refers to the bone with the same index.
Returns BlendShape count on this mesh.
The bone weights of each vertex.
The bounding volume of the mesh.
Vertex colors of the mesh.
Vertex colors of the mesh.
Returns state of the Read/Write Enabled checkbox when model was imported.
The normals of the mesh.
The number of submeshes. Every material has a separate triangle list.
The tangents of the mesh.
An array containing all triangles in the mesh.
The base texture coordinates of the mesh.
The second texture coordinate set of the mesh, if present.
The third texture coordinate set of the mesh, if present.
The fourth texture coordinate set of the mesh, if present.
Returns the number of vertices in the mesh (Read Only).
Returns a copy of the vertex positions or assigns a new vertex positions array.
Constructors
Creates an empty mesh.
Public Functions
Adds a new blend shape frame.
Clears all vertex data and all triangle indices.
Clears all blend shapes from Mesh.
Combines several meshes into this mesh.
Returns the frame count for a blend shape.
Retreives deltaVertices, deltaNormals and deltaTangents of a blend shape frame.
Returns the weight of a blend shape frame.
Returns index of BlendShape by given name.
Returns name of BlendShape by given index.
Returns the index buffer for the submesh.
Gets the topology of a submesh.
Returns the triangle list for the submesh.
Get the UVs for a given chanel.
Optimize mesh for frequent updates.
Optimizes the mesh for display.
Recalculate the bounding volume of the mesh from the vertices.
Recalculates the normals of the mesh from the triangles and vertices.
Vertex colors of the mesh.
Sets the index buffer for the submesh.
Set the normals of the mesh.
Set the tangents of the mesh.
Sets the triangle list for the submesh.
Set the UVs for a given chanel.
Assigns a new vertex positions array.
Upload previously done mesh modifications to the graphics API.
Inherited members
Should the object be hidden, saved with the scene or modifiable by the user?
The name of the object.
Public Functions
Returns the instance id of the object.
Returns the name of the game object.
Static Functions
Removes a gameobject, component or asset.
Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
Makes the object target not be destroyed automatically when loading a new scene.
Returns the first active loaded object of Type type.
Returns a list of all active loaded objects of Type type.
Clones the object original and returns the clone.
Does the object exist?
Compares if two objects refer to a different object.
Compares two object references to see if they refer to the same object.}

我要回帖

更多关于 sub是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信