Shockwave3D建模文档

Shockwave3D建模文档

以下内容是根据本人几年来的工作积累的经验所写,也有部分内容是从Adobe网站上面摘录,Shockwave3D适用于小规模场景的实时渲染及在线三维小游戏,希望本文档能为国内(China)Shockwave3D开发人员带来方便,更希望国内Shockwave3D开发人员能越来越强。如果有时间,我还想写一个Shockwave3D开发文档,这里面大部分内容是关于建模的,不过开发人员也必须了解如何建模才能更好的进行后续的开发工作。

 

 

 

模型(model)

制作:

1:模型面数最好控制不要超过20,000(P43.0,1G Ram)

2:制作模型的时候如果能使用instance来复制模型最好使用instance,这样可以使输出文件的文件量达到最小化.*场景内如果有tree要绕着camera旋转的话,使用instance复制可以,不过不能调节scale参数,否则到应用的时候会出现问题。

3:透明度不是1000的模型尽量不要与其它模型交叉.这样会引起z buffer问题,导致显示不正确。

4:建立模型尽量使用box, plane, Sphereshockwave支持的几种model resource来建立模型。

5:2个模型不能重叠,而且尽量避免靠的太近。

6:模型上面不管有没有贴图最好都加上UV modifier

7:所有二维的线面都是不被支持的,导出前建议删除场景内所有不被支持的数据,避免发生导出错误。

8:如果不是特殊需求,尽量取消物体之间Group层级关系.

 

优化:

1:使用max modifierOptimize,优化一些面数很大的模型。

2:使用polygon cruncher进行模型优化(强烈推荐)。

3:合并相同材质距离较近模型(合并的物体必须只是渲染用到,如果这个物体有关键帧动画,或者这个物体需要实现点击或绕着Camera旋转,不可合并)。

4:删除在场景内看不见的面。

 

常见错误:

1:场景内有二维物体存在(有可能是建模时候遗留的,也有可能是做路径动画的时候使用的,删除建模时候遗留的)。

2Modefier stack里面太多modefier,可能会导致导出错误,解决方式:Convert to editablemesh

 

材质(Material)

制作:

1:standard 材质
2:MultiMaterial
,子材质必须是standard材质。

优化:

1:场景如果最终做完,可以打散所有多维材质,合并场景里面相同材质的物体(合并的物体必须只是渲染用到,如果这个物体有关键帧动画,或者这个物体需要实现点击或绕着Camera旋转,不可合并)。

 

常见错误:

1:使用不被支持的Material类型(强行导出material会丢失)。

2Material重名(强行导出只能导出一个material,另一个material被覆盖)。

 

 

贴图(texture map)

制作:

1:贴图尺寸最好是2n次方,如果128*128尺寸就可以表现的,不要用256*256大小的,这个对性能影响很大.不要使用超过1024*1024尺寸的贴图,没有实际意义。
2:
贴图通道:Diffuse,反射贴图,透明贴图
3:
贴图总量不要太多,场景内的贴图是对性能影响的关键之一.

 

优化:

1:减小贴图尺寸,尽量使用最小可以满足效果的贴图尺寸。

2:减少贴图数目,合并几张贴图到一张大的贴图,然后重新分MeshUV坐标。(如果都是贴在Diffuse通道的贴图,可以使用map combine)。

3:效果优化,可以使用烘培来实现。

4:导出的时候Compression SettingsTexture如果要保证贴图质量的话不要选择80以下数据,建议是85.Texture Size Limits建议选择 No Limits on texture。测试时候可以选择256 by 256 pixels

 

常见错误:

1:贴图重名。

灯光(light)

制作:

支持类型:ambient,directional,point,spot.
支持属性:不支持阴影,支持衰减
灯光尽量不用,场景内的灯光很消耗资源,并且效果一般
建议只适用默认灯光来照亮场景。

 

优化:

1:建议删除场景内所有的灯光,不推荐用灯光。

2:如果要实现灯光效果,建议使用烘培到贴图(Render to texture)来实现。

动画(motion)

制作:

支持关键帧动画和骨骼动画
关键帧动画支持PositionRotationScale变换。

 

优化:

1:由于数据量较小,所以优化的意义不大,不过如果导出的时候动画效果不好,可以通过调节Animation Option里面的Sampling




摄像机(Camera)

只支持Free camera,不支持target camera
Target Camera
也可以导入,但是Target就不好用了,Target被定义成一个Group,但不起任何作用

 

优化:

1:删除场景内无用摄像机。

 

导出(Export)

      

1:文件量

       最终导出之前,如果对文件量有大小要求,先做一次Analyze,看到哪部分的文件量最大,并且做相应优化。一般最好保证单一场景在2M以内,20000面以下,在大多数机器都可以得到较好性能。

2:错误检查

       导出之间进行一次Author Check,可以看到场景内哪些物体导出的时候会有问题,如果没有任何问题,再导出。

 

3Resources to Export

       如果不是特殊需求,去除Enable Toon and SDS选项。

 

 

 

4Compression Setting

       推荐参数

    Geometry   50

    Texture         85

    Animation    100

 

5Texture Size Limits

       最终导出都要选择No limit on texture.测试时可使用256 by 256提高测试速度。

 

6Animation Options

       Sampling 1Range 默认参数。

 

7:图例

 

 

 

 

 

关于Line

这种类型是不支持的,不过你如果使用Line作为Camera的路径的话,导出W3d会自动生成一个路径模型,这个模型不是Line,而是带有面的,这时你做碰撞(如果检测所有模型的碰撞的话)可能会导致意向不到的结果.建议使用Camera和一个Box Group一起再沿着路径走,这样不会导出那个Linemodel(我记得是这样,这个地方我不是很确定,因为好久之前做的了,记忆有些模糊)

 

 

命名规范

1:为了更好的兼容性,三维场景里面任何地方不用中文命名。

2Camera命名,使用”Cam_“ or “Camera_”作为前置标识。后缀用来区别用途,比如 “Camera_AutoView” 表示自动行走的Camera”Cam_Gate”,表示大门处的Camera

3Light命名,使用”Light_”做前缀,命名和Camera类似。

4Geometry(Model)命名,分成3部分。中间用”_”来分开。例如:

”MainName_AreaName_ObjName”

MainName        3-6个字符,整个Max文件的标识,在一个Max文件里的所有GeometryMainName都相同,多人合作建模的时候最后导出可以分辨出来是哪部分模型。

AreaName 3-6个字符,一个Max文件里面标识不同区域的字符,同一区域的AreaName相同(最好也设置相同的Object Color,这样在wireframe显示的时候更直观)。

ObjName    3-6个字符,模型真正代表的意义,比如”_chair” “_desk” “_roof” “_tree”等。如果有很多相同的desk,可以用这种标识 “_desk01””_desk02” 等。

 

5:Material Texture命名,原则上没有太多要求,不过不要重名。否则导出会覆盖重名Material or Texture

 

 

关于烘培

下表是max自带的Render to texture 参数设置图表。

见下页

User Properties

Setting User Properties

User properties may be set by the following process:

Select a model in 3D Studio MAX.

Right-click the model and open the Properties dialog.

Select the User Defined tab.

In the text box, type the user property name and value.

User Property Syntax

User properties are specified as property name and property value pairs. Property names are associated with property values with the equal (=) sign. Property values are terminated with a semicolon (;). Property names are alphanumeric, starting with an alpha character. No spaces are allowed between the user property and the equal (=) sign, and between the equal (=) sign and the start of the property value.

There is no limit to the number of user properties. Currently, property values are restricted to 512 characters.

Syntax Examples

MyProperty1=A Monster called Fred;

CharacterLifeForce=10 units;

sw3d_lod_adjust_normals=true;

Reserved User Properties

The following user property names are reserved by Shockwave 3D and trigger the following described behaviors when the .w3d file is loaded into Director. The exporter should be used to assign these properties to a model and programmatically implement them at export.

Note: All strings starting with "sw3d_" are reserved for future use by user properties in Shockwave 3D.

Property

Value

Default

Description

sw3d_stream_priority

[Unsigned Integer: 0...256]

256

Specifies the relative stream priority of a model and any textures used by the model (0 indicating the highest priority, with larger numbers indicating a lower priority). By default, texture priorities are set to 4 times the model priority.

 

Note: Priority 0 denotes inclusion in the initial Load Segment.

sw3d_texture_stream_priority

[Unsigned Integer: 0...1024]

1024

Specifies the relative stream priority of a texture. This control allows you to override the priority given a texture after setting the sw3d_stream_priority user property on a model that uses the texture.

 

Note: Priority 0 denotes inclusion in the initial Load Segment.

sw3d_visibility

front/back/
none/
both

front

Controls initial visibility of a model.

Note: If set to none the model is streamed but not initially visible. A Lingo programmer may make the model visible later by setting model(1).visibility=#front

sw3d_lod_adjust_normals

true/false

true

When true, creates new normals to track the new surface curvature as a model is simplified.

When false, uses normals from original model and generates no additional normals to track the simplified surfaces.

Note: When sw3d_lod_adjust_normals is set to true, the new normals are calculated according to the values of sw3d_lod_minimum_crease_angle and sw3d_lod_max_normal_error.

Hint: Set this value to false to obtain the smallest file size.

sw3d_lod_minimum_crease_angle

Integer value in 10ths of a degree

750 (75.0 degrees

Sets crease angle value. As an object is simplified the angles between the surfaces change. When the angles exceed this value, a hard edge is formed by introducing separate normals for each surface.

A small value results in a more faceted, chunky model. A large value results in a more realistic, smoother model with occasional shading errors.

Note: This is only used when sw3d_lod_adjust_normals is set to true.

Hint: The default value seems to work well for most models, so you probably won't need to change it.

sw3d_lod_max_normal_error

Integer value in 10ths of a degree

1350 (135.0 degrees

Trades off file size for lighting quality. Large values result in smaller files with more lighting errors. Small values result in larger files with better lighting through the generation of additional normals.

Note: This used only when sw3d_lod_adjust_normals is set to true.

 

 

shockwave 3D exporter FAQ

 

When I export my model, its textures look wavy in the preview window, and I can see through the triangles. What's wrong?

The preview window shows how the model will look after it is compressed for output to the Shockwave 3D* file format.

Gaps between triangles can appear when a vertex that is shared among multiple triangles is replicated into multiple vertices by the level-of-detail calculations. This can happen when the UVW Modifier is used in 3D Studio MAX* to create tiling, which causes very rapid changes in the texture coordinates on the mesh. Replication can also occur at the boundary between two materials on a model by assigning different material IDs to different parts of a mesh and then using a Multi/Sub-Object Material to texture each part of the mesh. These multiple copies of the vertex are compressed differently, disconnecting adjacent vertices. To get rid of these gaps, either adjust the UVW Modifier or the Geometry Quality to decrease the compression errors.

Wavy textures are another symptom of excessive geometry compression. The lack of gaps indicates that the triangle vertices were not replicated when creating the level-of-detail representation of the mesh. Instead, the single vertex shared by all triangles is getting shifted slightly, which distorts the resulting texture. Increase Geometry Quality until you reach an acceptable level of distortion.

My exported models look creased where a number of faces come together. How do I fix this?

This is a result of geometry compression. Increase the Geometry Quality level (which decreases the compression), balancing this with the need to keep the file sizes small.

In my animation, the scene elements slowly float apart as the scene loops. Why is this happening?

Object animations are specified relative to their starting position (Animation Range Start). When the animation loops, the object is not reset to its original position and moves again starting at its current position. This results in the object floating away as the animation loops. To create a looping animation that stays in one place, make sure that your objects return to their original locations and orientations by the end of the animation sequence in 3D Studio MAX.

Why are all of the textures on my model exporting as a single texture, or all the materials on my model exporting as a single material?

The most likely cause is a naming conflict. All materials and textures must have unique names in Shockwave 3D; otherwise, materials and textures with the same names are assumed to be the same despite their internal settings. Use the 3D Studio MAX Material Editor to change the default "Material #n" or "Map #n" names assigned by 3D Studio MAX to something meaningful for your scene.

Note: Textures are assigned a name in the Material Editor and do not derive their names not from the bitmap they use.

Why does my sharp-edged model have dark-shaded triangles along its edges when I export it?

The edges of the model are not perfectly sharp, being modeled by a number of very small triangles where the edges meet. One part may be modeled by a series of triangles that are much larger than the tiny triangles used to "blunt" its edges. This can cause problems when the mesh resolution drops, as a large triangle on the flat face of the model is as likely to be thrown out as one of the tiny triangles. This causes sudden changes in the normals of the remaining faces, and the appearance and disappearance of large triangular dark spots.

One solution is to select all the vertices at the very edge of the model with the 3D Studio MAX Mesh Select modifier. This will mark these vertices as "base vertices," meaning that they will be the last vertices to vanish as the mesh resolution drops to zero faces. The problem, however, is that sharp edges are typically modeled by many vertices, so selecting all the edge vertices as base vertices defeats the purpose of having multiresolution mesh representation. This can also cause poor streaming behavior, or scenes where only the base vertices of the model are rendered. Another solution is to model the edges with a smooth range of triangle sizes near the edges. The problem with this approach is that it creates a more complex mesh, which will slow streaming.

A final solution is to make use of the sw3d_lod_adjust_normals and sw3d_lod_minimum_crease_angle user properties. Decrease the value for the sw3d_lod_minimum_crease_angle user property, and the dark triangles will go away. This procedure can increase file size, however. Increase the value of the sw3d_lod_minimum_crease_angle user property, and the dark triangles will also go away. This procedure can cause different lighting errors. Which user property to use will vary depending on the model. Try extreme values of either of these user properties to see how their effects differ when the model is viewed in Director, and then adjust the values until you have reached an acceptable visual quality and file size compromise.

When I export, the light, camera, and group aren't animating. What's wrong?

These scene entities are only able to move when they are the child of a mesh, because only meshes and bones can be animated in Shockwave 3D. Be sure to attach the light, camera, or group to a mesh, and then animate the mesh when setting up the animation for export.

Note: A group that has a group as its parent will animate when it has a mesh as its child, because the group and the mesh get collapsed into a single model node which can be animated. See Scenegraph Hierarchy Rules.

Why does my scene get clipped when I use the Dolly tool in the Preview window?

The scene was probably exported in Orthographic view. Export in Camera or Perspective view from 3d Studio Max to avoid clipping.

Why does my character start animation at the end of its cycle?

Because of the way 3D Studio Max sends the animation position information, the time slider must be set to 0 or else the animation starts at the last frame.

Why are the objects that are animated showing tiny vibrations?

The vibration is a result of animation compression. The exporter Animation Quality value controls the degree to which the animation is compressed. At lower values with higher compression, the motion is represented with less accuracy. This means that the positions of all the bones will have a random element in them from one keyframe to the next, resulting in a vibrating image. Keep in mind that there is a trade off between inaccuracy in the motion and file size when adjusting the Animation Quality control.

Why are objects that I hide in 3D Studio MAX showing up when I export?

Marking an object as "invisible" in the 3D Studio MAX simply hides it when working in or rendering a scene, but does not remove the object from the scene. The Shockwave 3D exporter sees all objects in the scene whether or not they are marked as invisible. If you want the models to remain invisible in Shockwave 3D, mark them with the "sw3d_visibility" user property. If you don't want them in the exported scene, to save download time and disk space, remove them from the scene before exporting.

I have two meshes, one of which is the child of the other. When I export, why is the animation of only the parent mesh captured? Likewise, when I have a mesh contained in a group, only the animation of the group is captured. Why?

According to the Scenegraph Hierarchy Rules, parent-child meshes are collapsed into a single mesh by the Shockwave 3D exporter. This means that the animation of the child mesh will be lost as it becomes part of its parent. Only bones will cause the child mesh to move relative to its parent after this collapse.

To animate both meshes separately, place a group node between the parent mesh and the child mesh. Alternately, use one or more bones to animate the child mesh with respect to its parent.

When 3D Studio MAX nodes are collapsed into a single node by the exporter, only the animation of the top node in the set being collapsed will be captured. The animation of a child mesh contained within a group will not be captured for the same reason that its animation was lost under a parent mesh: all children of a node become part of that one node and are animated by that top node's animation.

The scene looked fine in the preview; but when I exported it, the scene was blank and using Lingo script "put member(x).model(1)" returns "<VOID> or the name of the model." What happened?

If Lingo returned <void>, you probably exported the scene without having the Scenegraph Hierarchy export option selected. When this option is not selected, the only things written to the export file are the shader, texture, model, and motion resources. All the information that specifies how they exist in the scene, how the scene is laid out, how the scene is lit, and how the scene is viewed is lost. Re-export the scene and make sure the Scenegraph Hierarchy option is selected.

If Lingo returned the name of the model, you probably exported the scene with having the Shader export option or the Light Resources option selected. When these options are not selected, the model exports but is not shaded or lighted, which renders it invisible. Re-export the scene and make sure the shader and light resources options are selected.

I have placed a camera as a child to a mesh. When I animate this mesh, thereby causing the camera to animate, the view from the camera vibrates. How do I fix this?

The vibration is be caused by the animation being too compressed. To avoid this, set the Animation Quality compression control to a value of 100.0. In general this setting is too high for most animations. When you must use this value, create a special scene containing only the camera's parent, and export only the animation on that object. Then use the Lingo loadfile command to load the animation into the full scene.

Shaky motion can also result when keyframes have very different positions from the beginning or the end keyframes. In this case, the shaking won't go away even when the Animation Quality control is set to 100.0 because of the way the animation keyframes are compressed. The fix is to try to keep all keyframe positions within a tight range whenever possible.

I want to export a lip sync animation built by using a morph compound object, but cannot get it to work after the export, because only bones-based deformations will export. How do I get around this?

The Morpher modifier and Morph compound objects will not export because the deformations they create are not bones-based. Only bones-based deformation will export. Morphing can be achieved by using bones to generate phoneme targets, and then by copying the bone keyframe information as needed to reproduce the target pose. Other options include creating a model using bones and applying the Physique modifier to the lips and head, or generating a series of morph targets, and blending them using Director.

Why does the Shockwave 3D exporter stop responding or cause 3D Studio Max or my system to fail when I export a scene containing a large model?

Converting a MAX model containing over more than 10,000 faces to the Shockwave 3D multi-resolution representation is a memory-intensive operation. On systems with less than 256Mb of memory, but even on systems with more memory, very large models can exhaust a system's memory. This can cause the exporter to slow and, in some situations, can cause 3D Studio MAX or your operating system to fail. As an example, a 260,000-face teapot required 610 Mb of system memory to export, and produced a 4Mb Shockwave 3D file.

Because large models will take a long time to stream to a remote computer over the Internet, and are unlikely to render at full resolution on all but high-end systems at frame rates longer than one second, we recommend that you simplify large models before attempting to export them.

What is the difference between geometry compression and the level-of-detail (LOD) representation of a model?

Geometry compression removes no vertices from a model (including keyframes and texture colors), but rather causes the vertex positions (including normals and texture coordinates) to be represented with less precision, causing them to drift from their true positions. This drift increases as the compression rises, eventually resulting in a noticeable wrinkling or crumpling of the object. A geometry quality setting of 100 means least compression of the mesh data with the highest possible accuracy.

When models are exported, their meshes are processed and simplified one vertex at a time. This process works in the opposite direction when the model is streaming into a Shockwave 3D scene.

Simplification does not create gaps in a model, although it will cause any existing gaps in a model to get larger as the model is simplified. The degree to which a model is automatically simplified depends on the target framerate, the hardware used, the complexity of the model, the distance between the model and the camera, and the complexity of the entire scene. Very large models need to be greatly simplified just to obtain approximately 30 frames per second, even using fast machines, or when the model is far from the camera.

Level-of-detail (LOD) calculations, on the other hand, remove vertices from a model. This is done by looking at the local smoothness or non-smoothness of the surface around each vertex. Smooth surfaces are retained and jagged surfaces are removed.

Sharp but important features, like an antenna on a vehicle, which would be removed, can be preserved by being marked as base vertices using the Mesh Select modifier. This effectively indicates that these vertices are the last to be removed. Do not mark too many vertices with the Mesh Select modifier, however, as this can create poor streaming behavior, or scenes where only the base vertices of the model are rendered.

Further tuning of level of detail can be done with the sw3d_lod_adjust_normals, sw3d_lod_minimum_crease_angle, and sw3d_lod_max_normal_error user properties.

Default settings of user properties can result in the the removal of vertices that drastically change the surface normal, resulting in a hole in model. Models with faces with a normal direction or winding order that is inconsistent with the adjoining faces, or having faces that have zero area, for example, can cause tearing of the model when it simplifies. Decreasing the sw3d_lod_max_normal_error or increasing the sw3d_lod_minimum_crease_angle user property values can often remove these holes as the model simplifies, but often at the expense of creating a larger Shockwave 3D file that will take longer to stream.

Streaming and Load Priorities
What is load priority?


Load priority is the method used by a .w3d file to define the general ordering of models and textures in the data that is streamed. Load priority values are unsigned integers that range from 0 to 256 for models, and 0 to 1024 for textures. Models and textures with the highest load priority significance appear before those with lesser significance. Load priority significance increases as the value decreases.

How is load priority specified in the Shockwave 3D Exporter?

For a model, this is done by setting a sw3d_stream_priority assignment for the model's user properties. For all textures used by a model, this is done by setting a sw3d_texture_stream_priority assignment for the model's user properties. See User Properties for more details.

What is the default load priority for all models in the Shockwave 3D Exporter?

The default load priority of all models is 256. A model's default load priority is overridden if the sw3d_stream_priority user property is specified for the model, and its value is less than the default of 256. If there are multiple model instances using a common resource, the most significant priority value (that is, the numerically smallest load priority value) is used for the model resource geometry and any associated textures.

What is the default load priority for all textures used by all models in the Shockwave 3D Exporter?

The default load priority of each texture is the most significant load priority specified for all of the models that use the texture, multiplied by 4. If all of the models using the texture have the default load priority of 256, then the default load priority of the texture will be 1024. If some of the models that use the texture don't have the default load priority and 10 is their most significant load priority, then the default load priority of the texture will be 40. A texture's default load priority is overridden if the sw3d_texture_stream_priority user property is specified for the texture, and its value is less than the calculated default.

How does load priority affect what's in the initial load segment for Shockwave 3D file (for example, the ILS or what will have been loaded when the Lingo state reaches header loaded or 2)?

The load priority for a model and its textures only affects where the geometry update records and texture image data are placed in the .w3d file. All of the other types of data are placed in the ILS without respect to the load priority. This includes group nodes, model nodes, lights, materials, animations, motions, initial model resource definitions, initial texture definitions, etc. If the load priority for a model is 0, then its geometry update records and texture image data will be placed in the ILS. If the load priority for a model's textures is 0, then the texture image data is placed in the ILS. The ILS equals a load priority of 0.

Does the texture image data required for a model appear in the Shockwave 3D file before or after the associated geometry update records?

By default, if the exporter is set to save the textures, some of a model's geometry update records will appear before the texture image data used by the model. However, if a load priority for the textures is specified that is more significant than the model's load priority, the texture image data will appear before the geometry update records.

Are material colors, vertex colors, and face colors saved by the Shockwave 3D Exporter?

Only material colors are saved by the exporter. The vertex and face colors are not saved because they are not currently supported by the .w3d file format.

 

 

 

 

 

 

 

 

 

 

 

 

Shockwave3D 资源

Shockwave3D Export SDK

http://www.ccloveaa.com/blog/article.asp?id=372

3D Lingo 参考

http://www.ccloveaa.com/blog/article.asp?id=258

Shockwave3D 行走控制

http://www.ccloveaa.com/blog/article.asp?id=224

 

Maya 4.5 导出w3d的插件

http://www.ccloveaa.com/blog/article.asp?id=221

 

Shockwave3D骨骼动画控制技巧

http://www.ccloveaa.com/blog/article.asp?id=181

Havok物理引擎

http://www.ccloveaa.com/blog/article.asp?id=100

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值