角色相机半透明怎么开启相机失败

拍摄人像外景时相机的设置该怎么调?_百度知道文章图片人物器材论坛
拍摄人像照片如何设置相机
日期: 09:43   来源:全球摄影网   作者:叉烧君   责编:陈雯欢   阅读:17480
字号:加大 缩小
上一篇:下一篇:
  1.将相机设置为光圈优先自动曝光模式  人像摄影时合焦点(景深)的控制非常重要。所以要在拍摄模式转盘中选择Av(光圈优先自动曝光模式),以便根据自己的意图控制景深。使用优先决定光圈值的Av模式更容易控制合焦范围。  2.自由决定ISO感光度  应该根据拍摄状况选择ISO感光度。设置为自动基本上也没有问题,但是为了更好地理解快门速度和光圈的关系,最好能够选择某个特定的感光度以习惯拍摄。推荐尽量使用ISO800以下的感光度。  3.将驱动模式设置为连拍  在拍摄人像时即使是同一个姿势也应该连续拍摄多张照片。如果能养成这种习惯,那么拍出合焦理想的人像照片的概率就会大大增加。另外,如果将相机设置为连拍模式,就能够迅速地拍摄下一张照片。  4.原则上应该设置为单次自动对焦  原则上应该将自动对焦模式设置为合焦之后对焦动作就会停止的“单次自动对焦”模式,比起会追逐被摄体连续自动对焦的模式,“单次自动对焦”更有利于精确合焦。尤其是在进行人像摄影时,由于被拍摄者会不断摆出不同的造型,使用单次自动对焦模式会更有利于拍摄。  5.手动选择对焦点  为了在构图之后能够自由选择离人物眼睛最近的对焦点,应该将“自动对焦点选择”设置为“手动选择”。这样能够根据构图的不同自由变更对焦点。为了在任何情况下都能迅速选择好对焦点,拍摄者应该事先确认相机的操作,并练习手动选择对焦点。建议尽量使用中心对焦点,中心对焦点相比其他对焦点更加灵敏。  6.使用自动对焦启动(AF-ON或自动曝光锁)按钮进行自动对焦  数码单反相机的默认设置是,半按快门按钮时,相机会同时进行自动对焦和自动测光。如果能够将自动对焦和自动测光的操作按钮分离开来,使用自动对焦启动(AF-ON或自动曝光锁)按钮来进行自动对焦,将自动测光的启动分配给快门按钮,就能将这两个操作系统分离开来,从而更加集中地对焦。
[] [] [] [] [] [] [] [] [] []
最新大赛信息1547人阅读
CharacterCameraControl(1)
提要第三人称相机有非常多种,今天要实现的一个第三人称射击游戏的相机。如果对相机控制不是很了解,建议看一下上一篇博文。控制思路鼠标控制yaw和pitch,添加一个distance变量来记录角色和相机之间的距离。通过yaw和pitch来得到相机的position。最后添加一个向右的位移和向上的位移量,将角色放在屏幕偏左边的位置。transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
characterModel.transform.forward = new Vector3(transform.forward.x, characterModel.transform.forward.y, transform.forward.z);
target.forward = new Vector3(transform.forward.x, 0, transform.forward.z);
float yaw = rotationX;
float pitch = rotationY;
float yawRed = Mathf.Deg2Rad * (yaw - 90f);
float pitchRed = Mathf.Deg2Rad *
Vector3 direction = new Vector3(-Mathf.Cos(yawRed) * Mathf.Cos(pitchRed), -Mathf.Sin(pitchRed), Mathf.Sin(yawRed) * Mathf.Cos(pitchRed));
transform.position = target.transform.position + distance *
transform.position += transform.right + transform.在这里,相机只控制了model的rotation。direction是通过yaw和pitch计算出的角色到相机的Ray的方向。一些问题的处理角色往斜方向跑的动画处理通常在TPS游戏中,角色的背面是始终对着摄像机的。当玩家希望角色往斜方向走的时候,不能直接播放角色往前走的动画,这时候就需要给角色Model一个额外的角度偏移量,这个偏移量由玩家的输入决定。& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & && & & & & & & & & & & & & & & & & &&代码如下 characterModel.transform.forward = new Vector3(transform.forward.x, characterModel.transform.forward.y, transform.forward.z);
if (characterModel.transform.parent.GetComponent&Character&().characterFPAnimation.extraRotation == 0)
extraRot = Mathf.Lerp(extraRot, 0f, 10 * Time.deltaTime);
extraRot = Mathf.Lerp(extraRot, characterModel.transform.parent.GetComponent&Character&().characterFPAnimation.extraRotation, 10 * Time.deltaTime);
Quaternion targetRotation = characterModel.transform.rotation * Quaternion.AngleAxis(extraRot, Vector3.up);
characterModel.transform.rotation = targetR添加了Lerp,让转身更加顺滑。墙体遮挡环境遮挡是第三人称摄像机一个经常遇到问题,下面是几个常见的方法。解法一 &射线检测,将相机移动到不被遮挡的位置。在Unity官网的一个Tutorial里面,处理的方法是将相机慢慢上移,直到看到角色(游戏的场景是没有天花板的) bool ViewingPosCheck (Vector3 checkPos)
// If a raycast from the check position to the player hits something...
if(Physics.Raycast(checkPos, player.position - checkPos, out hit, relCameraPosMag))
// ... if it is not the player...
if(hit.transform != player)
// This position isn't appropriate.
// If we haven't hit anything or we've hit the player, this is an appropriate position.
newPos = checkP
void SmoothLookAt ()
// Create a vector from the camera towards the player.
Vector3 relPlayerPosition = player.position - transform.
// Create a rotation based on the relative position of the player being the forward vector.
Quaternion lookAtRotation = Quaternion.LookRotation(relPlayerPosition, Vector3.up);
// Lerp the camera's rotation between it's current rotation and the rotation that looks at the player.
transform.rotation = Quaternion.Lerp(transform.rotation, lookAtRotation, smooth * Time.deltaTime);
}在Update里面的处理是这样的
void FixedUpdate ()
// The standard position of the camera is the relative position of the camera from the player.
Vector3 standardPos = player.position + relCameraP
// The abovePos is directly above the player at the same distance as the standard position.
Vector3 abovePos = player.position + Vector3.up * relCameraPosM
// An array of 5 points to check if the camera can see the player.
Vector3[] checkPoints = new Vector3[5];
// The first is the standard position of the camera.
checkPoints[0] = standardP
// The next three are 25%, 50% and 75% of the distance between the standard position and abovePos.
checkPoints[1] = Vector3.Lerp(standardPos, abovePos, 0.25f);
checkPoints[2] = Vector3.Lerp(standardPos, abovePos, 0.5f);
checkPoints[3] = Vector3.Lerp(standardPos, abovePos, 0.75f);
// The last is the abovePos.
checkPoints[4] = aboveP
// Run through the check points...
for(int i = 0; i & checkPoints.L i++)
// ... if the camera can see the player...
if(ViewingPosCheck(checkPoints[i]))
// ... break from the loop.
// Lerp the camera's position between it's current position and it's new position.
transform.position = Vector3.Lerp(transform.position, newPos, smooth * Time.deltaTime);
// Make sure the camera is looking at the player.
SmoothLookAt();
}从角色的脚到头,分四个地方都进行了射线检测,最后的结果是这样的&类似的还可以将相机拉到被遮挡的墙前面。检测的代码如下void ShelterTest()
RaycastResult result = new RaycastResult();
float characterHeight = GameManager.GetInstance().character.height * 0.4f;
Vector3 targetHeadPos = new Vector3(target.position.x, target.position.y + characterHeight, target.position.z);
Ray[] testRays = new Ray[5];
testRays[0] = new Ray(targetHeadPos, transform.position + 0.8f * transform.right + 0.5f * transform.up - targetHeadPos);
testRays[1] = new Ray(targetHeadPos, transform.position + 0.8f * transform.right - 0.5f * transform.up - targetHeadPos);
testRays[2] = new Ray(targetHeadPos, transform.position - 0.8f * transform.right + 0.5f * transform.up - targetHeadPos);
testRays[3] = new Ray(targetHeadPos, transform.position - 0.8f * transform.right - 0.5f * transform.up - targetHeadPos);
testRays[4] = new Ray(transform.position, transform.position - targetHeadPos);
float castDist = (transform.position - targetHeadPos).
float[] dists = new float[5];
for (int i = 0; i & 5; i++)
if (RaycastHelper.RaycastAll(testRays[i], castDist, true, GameManager.GetInstance().character.floorMask, out result))
Debug.DrawLine(targetHeadPos, result.point, Color.red);
dists[i] = Vector3.Distance(result.point, targetHeadPos);
Debug.DrawLine(targetHeadPos, targetHeadPos + castDist * testRays[i].direction, Color.blue);
dists[i] = castD
float minDist0 = Mathf.Min(dists[0], dists[1]);
float minDist1 = Mathf.Min(dists[2], dists[3]);
float minDist2 = Mathf.Min(minDist0, minDist1);
float minDist = Mathf.Min(minDist2, dists[4]);
transform.position = targetHeadPos + minDist * testRays[4].direction.
}用了5根射线来检测,为了避免fov穿墙的问题。注意是从角色射向摄像机。解法二 &半透明掉中间遮挡的物体用raycast进行检测,然后动态替换掉材质就可以了。解法三 利用Stencil对角色进行重绘对Stencil Buffer 不了解的请参考这一篇 :&通过Ztest将角色被遮挡部分的Stencial标记出来,然后就可以对这部分的像素进行处理。要么用一种单色绘制出来,要么绘制成透明,要么绘制一个发光的描边,都可以。简单的效果如下:这里分三个pass处理,第一遍绘制利用ZTest写StencilShader &Custom/Player& {
Properties {
_MaskValue(&Mask Value&, int) = 2
_MainTex (&Base (RGB)&, 2D) = &white& {}
SubShader {
Tags { &RenderType&=&Opaque& }
Ref [_MaskValue]
Comp always
Pass replace
ZFail keep
#pragma surface surf Lambert
sampler2D _MainT
struct Input {
float2 uv_MainT
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.
o.Alpha = c.a;
FallBack &Diffuse&
再加一个Shader来清掉ZTestShader &Custom/ClearZbuffer& {
Properties {
_MainTex (&Base (RGB) Gloss (A)&, 2D) = &white& {}
SubShader {
Tags { &RenderType&=&Transparent&
&Queue&=&Transparent+100&}
ColorMask 0
ZTest Greater
#pragma surface surf Lambert
sampler2D _MainT
struct Input {
float2 uv_MainT
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = half4(1,0,0,1);
o.Alpha = 0.3;
FallBack &Diffuse&
最后用一个Shader对被Stencil标记出来的像素进行处理Shader &Custom/StencilTransparent& {
Properties {
_MaskValue(&Mask Value&, int) = 2
_MainTex (&Base (RGB)&, 2D) = &white& {}
_TransVal (&Transparency Value&, Range(0,1)) = 1.0
_ColorAdd (&Color (Add, RGB)&, Color) = (0.5,0,0)
SubShader {
Tags { &RenderType&=&Opaque& &Queue&=&Transparent+100&}
Ref [_MaskValue]
Comp notequal
ZTest LEqual
Blend SrcAlpha OneMinusSrcAlpha
BlendOp Add
#pragma surface surf Lambert
sampler2D _MainT
fixed _TransV
half4 _ColorA
struct Input {
float2 uv_MainT
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
//o.Albedo = c.rgb * half4(1,0,0,1);
//o.Alpha = 1;
o.Albedo = c.rgb * _ColorA
o.Alpha = _TransV
FallBack &Diffuse&
遮挡处理的方法并不是说哪一种最好,可以进行混合使用达到最好的效果。参考Real-Time Cameras:A Guide for Game Designers and DevelopersUnity tutorial stealth -&/learn/tutorials/projects/stealth-tutorial-4x-only
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1075625次
积分:15558
积分:15558
排名:第450名
原创:397篇
译文:29篇
评论:585条
文章:19篇
阅读:81088
(3)(1)(10)(4)(6)(5)(3)(3)(5)(2)(5)(5)(2)(2)(2)(3)(5)(4)(6)(1)(1)(3)(4)(10)(4)(9)(11)(10)(6)(8)(14)(4)(5)(14)(18)(12)(6)(12)(16)(19)(18)(27)(28)(3)(1)(10)(8)(1)(6)(4)(5)(19)(9)(8)(12)(1)(1)(2)(4)(2)(1)谁能教我用数码相机照出人物特写,就是人很清晰背景模糊的相片?_百度知道

我要回帖

更多关于 怎么开启照相机权限 的文章

 

随机推荐