Axiom3D学习日记 3.Cameras, Lights, and Shadows

Camera 相机:

相机基础知识不写了,需要注意的是:axiom目前不支持同时操作多个相机.

创建,设置位置基本操作.

_camera  =  _scene.CreateCamera("MainCamera");
_camera.Position = new Vector3(0, 10, 200);
_camera.LookAt(Vector3.Zero);

_camera.Near = 5;决定了相机可视范围.

ViewPort(视口)

当要显示多个窗口时候用,这个我不怎么需要,就不写了.

Shadows in Axiom(重点来了)

Axiom有3种不同阴影.

    1. 纹理阴影:计算成本最低的一种.
    2. Modulative Stencil Shadows:较第三种没那么密集
    3. Additive Stencil Shadows:会叠加计算每个灯光的阴影,对GPU来说是比较大的负担.

遗憾的是:Axiom不支持软阴影,如果需要软阴影,需要自己写顶点和片段程序.

使用阴影非常容易:

scene.AmbientLight   = ColorEx.Black;
scene.ShadowTechnique = ShadowTechnique.StencilAdditive;

Entity ent = scene.CreateEntity("ninja", "ninja.mesh");
ent.CastShadows = true;
scene.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

灯光:

灯光类型:

    1. Point (LightType.Point) - 点光源,各个方向.
    2. Spotlight (LightType.Spotlight) - 聚光灯
    3. Directional (LightType.Directional) - 平行光

创建灯:

Light pointLight = scene.CreateLight("pointLight");
pointLight.Type     = LightType.Point;
pointLight.Position = new Vector3(0, 150, 250);

pointLight.DiffuseColor  = ColorEx.Red;
pointLight.SpecularColor = ColorEx.Red;
Light spotLight = scene.CreateLight("spotLight");
spotLight.Type           = LightType.SpotLight;
spotLight.DiffuseColor  = ColorEx.Blue;
spotLight.SpecularColor = ColorEx.Blue;
spotLight.Direction = new Vector3(-1, -1, 0);
spotLight.Position  = new Vector3(300, 300, 0);

 

转载于:https://www.cnblogs.com/niconico/p/5007630.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值