-36-
项目报告
基于 Java3D 的网络三维技术的设计与实现
联网的出现及飞速发展使 IT 业的各个领域发生了深刻的变化,它必然
引发一些新技术的出现。3D 图形技术并不是一个新话题,在图形工作站
以至于 PC 机上早已日臻成熟,并已应用到各个领域。然而互联网的出现,
却使 3D 图形技术发生了和正在发生着微妙而深刻的变化。Web3D 协会
(前身是 VRML 协会)最先使用 Web3D 术语,这一术语的出现反映了这
种变化的全貌,没有人能严格定义 Web3D,在这里我们把 Web3D 理解为:
互联网上的 3D 图形技术,互联网代表了未来的新技术,很明显,3D 图
形和动画将在互联网上占有重要的地位。
Java3D API 是 Sun 定义的用于实现 3D 显示的接口。使用 Java 的重
要理由之一是它的平台无关性。Java3D 提供了基于 Java 的上层接口。
Java3D 把 OpenGL 和 DirectX 这些底层技术包装在 Java 接口中。这种全
新的设计使 3D 技术变得不再繁琐并且可以加入到 J2SE、J2EE 的整套架
构,这些特性保证了 Java3D 技术强大的扩展性
本文以 Java3D 为开发平台,利用 Java 语言强大的网络功能,实现了
在网页上对 3D 动画进行显示和操作。
Java3D、Web3D、三维
-36-
Abstract: The Internet appearance and the rapid development caused each
domain to IT industry have the deep transformation, it initiated some new
technical inevitably the appearance. The 3D graph technology is not a new
topic, in the graph workstation down to on PC machine already more or day
matured, and has applied to each domain. However the Internet appearance,
caused the 3D graph technology to occur actually and is occurring is being
subtle but the deep transformation. The Web3D association (predecessor is the
VRML association) uses the Web3D terminology first, this terminology
appearance had reflected this kind of change complete picture, nobody can
strictly define Web3D, in here we do the Web3D understanding is: On the
Internet 3D graph technology, the Internet has represented the future new
technology, is very obvious, the 3D graph and the animation will hold the
important status on the Internet.
Java3D API is the Sun definition uses in realizing the 3D demonstration
connection. Uses one of Java important reasons is its platform irrelevant.
Java3D has provided based on the Java upper formation connection. Java3D
OpenGL and DirectX these first floor technology packing in Java connection.
This kind of brand-new design causes the 3D technology to change no longer
tediously and may join to J2SE, the J2EE entire wrap overhead construction,
these characteristics have guaranteed the Java3D technology formidable
extension.
This article develops the platform take Java3D, uses the Java language
formidable network function nf, realized has carried on the demonstration and
the operation on the homepage to the 3D animation.
Key word: Java3D, Web3D,3D
-36-
目录
基于 JAVA3D 的网络三维技术的设计与实现 .......................................................................1
摘要:............................................................................................................................................1
ABSTRACT: ..............................................................................................................................1
第一章 绪论 .............................................................................................................................5
§1.1 引言 ................................................................................................................................5
§1.2 互联网 3D 图形技术的应用..........................................................................................5
§1.3 JAVA3D 在 WEB 中的成功 ...........................................................................................6
第二章 JAVA3D 技术的简介.................................................................................................7
§2.1 JAVA3D 概述...................................................................................................................7
2.1.1 Java3D
简介
...........................................................................................................7
2.1.2 Java3D
与其他三维技术的比较
...........................................................................7
§2.2 JAVA3D 的场景图结构...................................................................................................9
2.2.1
虚拟宇宙(
Virtual Universe
)
............................................................................10
2.2.2 Java3D
的坐标系统
.............................................................................................10
2.2.3
场景(
Locale
)
....................................................................................................12
§2.3 实现三维世界 ..............................................................................................................13
2.3.1 Java3D
的观察模式
.............................................................................................13
-36-
2.3.2 Java3D
中用来定义观察的对象
.........................................................................14
2.3.3
在三维世界中建立、移动观察点
.......................................................................16
2.3.4 Java3D
的网络基础
.............................................................................................17
第三章 实现 JAVA3D 结构体系的方法................................................................................17
§3.1 总体设计 ......................................................................................................................17
§3.2 基本形体的生成 ..........................................................................................................17
3.2.1
平板的生成
..............................................................................................................17
3.2.2
立方体的生成
.........................................................................................................18
3.2.3
圆锥的生成
.............................................................................................................18
3.2.4
球体的生成
..............................................................................................................18
3.2.5.
圆柱体的生成
..........................................................................................................19
§3.3 点、线、面的生成 ......................................................................................................19
3.3.1
点的生成
..................................................................................................................19
3.3.2
直线的生成
..............................................................................................................20
3.3.3
面的生成
..................................................................................................................20
§3.4 外部复杂形体的调用 ..................................................................................................21
§3.5 背景变换的实现方法 ...................................................................................................21
3.5.1
灯光
.........................................................................................................................21
3.5.2
纹理贴图
.................................................................................................................23
3.5.3
雾
.............................................................................................................................23
§3.6 动画的生成 ..................................................................................................................23
第四章 JAVA3D 场景的实现..................................................................................................24
§4.1JAVA3D 的实现流程......................................................................................................24
§4.2 JAVA3D 的建模 ...........................................................................................................25
4.2.1
生成场景:
.............................................................................................................25
4.2.2 Temple
的圆柱体的构建
.........................................................................................25
4.2.3 Tower
的构建
...........................................................................................................26
§4.3 动画的实现 ..................................................................................................................28
4.3.1
调用
galleon.obj
文件
.............................................................................................28
4.3.2
物体转动
.................................................................................................................29
4.3.3
场景的移动
..............................................................................................................29
§4.4 背景变换 ......................................................................................................................31
4.4.1
创建灯光
.................................................................................................................31
4.4.2
创建背景图片
.........................................................................................................34
4.4.3
指数雾
.....................................................................................................................35
4.4.4
背景音乐
.................................................................................................................36
§4.5 在网页上显示 3D 图形................................................................................................37
-36-
第五章 实践和展望 .................................................................................................................39
§5.1 WEB3D 技术发展前景 ...............................................................................................39
§5.2 论文总结 ......................................................................................................................40
参考文献 ...................................................................................................................................40
第一章
绪论
§
1.1
引言
互联网的出现及飞速发展使
IT
业的各个领域发生了深刻的变化,它
必然引发一些新技术的出现。
3D
图形技术并不是一个新话题,在图形工
作站以至于
PC
机上早已日臻成熟,并已应用到各个领域。然而互联网的
出现,却使
3D
图形技术发生了和正在发生着微妙而深刻的变化。
Web3D
协会(前身是
VRML
协会)最先使用
Web3D
术语,这一术语的出现反映
了这种变化的全貌,没有人能严格定义
Web3D
,在这里我们把
Web3D
理
解为:互联网上的
3D
图形技术,互联网代表了未来的新技术,很明显,
3D
图形和动画将在互联网上占有重要的地位。
§
1.2
互联网
3D
图形技术的应用
当前,互联网上的图形仍以
2D
图像为主流。但是,
3D
图形必将在
互联网上占有重要地位。互联网上的交互式
3D
图形技术
--- Web3D
正在
取得新的进展,正在脱离本地主机的
3D
图形,而形成自己独立的框架。
互联网的需求是它发展的动力。互联网的内容提供商和商业网站不断使用
新的工具与技术使网站更具吸引力,
Web3D
图形是最新的和最具魅力的
技术。
Web3D
图形将在互联网上有广泛应用,从目前的趋势来看主要有:
1.
电子商务:
用
3D
图形展示商品,更能吸引客户。虚拟商场是人们热中的话题。
客户可以在虚拟商场中漫游,挑选商品。许多
Web3D
图形技术的软件厂
商是瞄准了电子商务的,如
cult3D
和
viewpoint
,其图形技术主要是用于
商品的
3D
展示,您甚至于可以在网上操作或使用要购买的商品。然而,