2. 코덱스 비주얼 연구실
5월 11일. 프로세스 워크샵
• NVIDIA PhyX • Real Time Shadow for
– Wall Destruction. Smart device.
– RAG Doll
• Shader.
– Dissolve FX Shader.
3. • Wall Destruction
코덱스 비주얼 연구실
– 목표 : 스마트폰 에서 Distruction 을 PhyX
5월 11일. 프로세스 워크
사용.
샵
– 포멧1 : 강체 오브젝트를 실시간으로
NVIDIA PhyX
Wall Destruction.
Distruction 알고리즘을 사용 하여 붕괘 시
RAG Doll 키는 것이 아님.
강체 노드 그룹 : GameObject
– 포멧2 : Instantiate 로 데이터 교체 타입.
rigidbody.Sleep(); function Start() {
rigidbody.Sleep();
var health : int = 100; }
===========================
var health : int = 100;
하위 강체 노드 집합 : GameObject
yield WaitForFixedUpdate();
충돌체 :
GameObject health -= Mathf.Round(chunkAngVelocity.magnitude * twistMultiplier);
/ Force
조건문에 의한 제어.
if (health < 1) {}
Instantiate : Prefabs
: 강체 노드 그룹의 health 가 1 보다 작다면 노드 그룹은 참조 하는 프리
펩 개체 바로 호출 하여 spawned 한다.
Behave Collision
4. • RAG Doll
코덱스 비주얼 연구실 – 목표1 : 효율적인 RAGDOLL 셋팅과 결과
5월 11일. 프로세스 워크 물 도출.
샵 – 목표2 : PhyX 의 고질적 RAGDOLL 후 2
NVIDIA PhyX 차 충돌체와의 지속적인 떨림 현상 제거.
Wall Destruction. – 포멧1 : 유니티 내장 RAG DOLL 설정자
RAG Doll
사용 하지 않음.
RAG DOLL NODE – 활용 모듈 : 얼티밋 레그돌 디벨롭 에디션
MASS
DRAG 떨림 현상(대상: 팔이나 발 등…)이 심하게 발견 되는 레그돌 노드를 선별.
팔이나 발의 질량 값이 낮게 설정 되어 있는 이유가 선행 이유 이고 이 값
을 높혀 주면서 다시 Drag 값을 함께 조정 하여 최종값으로 보정.
일부 떨림 현상 (팔 , 머리 등)
RigidBody 프로퍼티의 Drag 값을 높이면서 노드의 Mass 값을 함께 수정
하여 적당 한 목표점(조합 값)을 찾는다.
보정 값 적용.
통상적으로 Drag 값을 높이면 무중력 상태와 같은 현상이 발생 한다.
다시 말하면 외부 충돌체와 지속적인 충돌이 일어 나도 그 반응이 아주 느
리기 때문에 시각적으로 떨림 현상이 완화 된 것 처럼 보인다.
시각적 안정화
이후 보강 목표 : Drag 값 보다는 코루틴과 .Spleep 함수의 활용.
5. • Dissolve FX Shader
코덱스 비주얼 연구실 – 목표 : 모바일용 쉐이더가 아닌 복잡한 구
5월 11일. 프로세스 워크 조의 쉐이더를 최적화.
샵 – 기존 쉐이더의 프로퍼티스.
Shader "Dissolve/Dissolve_TexturCoords" {
Shader. Properties {
Dissolve FX Shader. _Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
fixed4 _Color; fixed4 _Color; _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
half4 _DissColor; half _Shininess;
_Amount ("Amount", Range (0, 1)) = 0.5
half _Shininess; half _Amount;
static half3 Color = float3(1,1,1); _StartAmount("StartAmount", float) = 0.1
half _Amount;
fixed4 _ColorAnimate; _Illuminate ("Illuminate", Range (0, 1)) = 0.5
static half3 Color = float3(1,1,1);
half _StartAmount; _Tile("Tile", float) = 1
half4 _ColorAnimate;
half _Illuminate; _DissColor ("DissColor", Color) = (1,1,1,1)
fixed4 _DissColor;
half _Tile; _ColorAnimate ("ColorAnimate", vector) = (1,1,1,1)
half _StartAmount; _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
불필요 한 변수 제거. _BumpMap ("Normalmap", 2D) = "bump" {}
_DissolveSrc ("DissolveSrc", 2D) = "white" {}
변수 타입 제 정의.(연산 정밀도 다운)
_DissolveSrcBump ("DissolveSrcBump", 2D) = "white" {}
Precision of computations (연산 결정)
}
Cg/HLSL에서 쉐이더를 쓸 때, 3 가지의 기본 숫자 타입이 있습니다: float, half
그리고 fixed (vector & 그들의 matrix 변형 뿐만 아니라, 예. half3와float4x4): 변경 후 프로퍼티스.
Properties {
float: 고도로 정밀한 부동 소수점. 일반적으로32 비트, 보통의 프로그래밍 언
어에서 float 타입처럼. _Color ("Main Color", Color) = (1,1,1,1)
half: 중간 정도로 정밀한 부동 소수점. 일반적으로16 비트, -60000 과 +60000 _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
사이이고 3.3 정확도의 자릿수.
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
fixed: 낮은 정도로 정밀한 부동 소수점. 일반적으로11 비트, -2.0과 +2.0사이이 _Amount ("Amount", Range (0, 1)) = 0.5
고1/256정확도. _StartAmount("StartAmount", float) = 0.1
_DissColor ("DissColor", Color) = (1,1,1,1)
OPENGL ES 에서는 _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
Precision of Qualifier 로 highp , mediump , lowp 로 선언 할 수 있는
키워드 가 있음.
_BumpMap ("Normalmap", 2D) = "bump" {}
_DissolveSrc ("DissolveSrc", 2D) = "white" {}
} 원본 프라그먼트 쉐이더 : 27 fps +-3
http://unitykoreawiki.com/index.php?n=KrMain.SL-
ShaderPerformance 수정 후 프라그먼트 쉐이더 : 42 fps +-5
6. • Real Time Shadow Shader
코덱스 비주얼 연구실
– 목표 : 모바일용 실시간 쉐도우 적용.
5월 11일. 프로세스 워크
샵 – 포멧 : 케릭터 라이트 쉐도우 활용.
void LateUpdate()
Shader. {
if (!shadowmap) {
shadowmap = new RenderTexture( textureSize,
Real Time Shadow Shader textureSize, 8 );
shadowmap.isPowerOfTwo = true;
child.camera.targetTexture = shadowmap;
Projector proj =
CharacterShadow (Projector)child.GetComponent(typeof(Projector));
proj.material.SetTexture("_ShadowTex",
shadowmap);
연결 개체에 차일드 컴퍼넌트 연결 }
OrientToEncloseTarget();
savedPixelLightCount
// create a child camera/projector object
child = new GameObject("ChildCamProjector", typeof(Camera),
셋팅 프로젝션 카메라. typeof(Projector), typeof(CharacterShadowHelper), typeof(BlurEffect));
child.camera.clearFlags = CameraClearFlags.Color;
child.camera.backgroundColor = Color.white;
child.camera.cullingMask = (1<<privateLayer);
child.camera.isOrthoGraphic = true;
쉐이더 데이터 바
Projector proj = (Projector)child.GetComponent(typeof(Projector));
proj.isOrthoGraphic = true;
인딩. proj.ignoreLayers = (1<<targetLayer);
proj.material = projectorMaterial;
proj.material.SetTexture("_FalloffTex", fadeoutTexture);
child.transform.parent = transform;
child.transform.localPosition = Vector3.zero;
child.transform.localRotation = Quaternion.identity;
RTT(Render To Texture) 수행.
BlurEffect BlurFX = child.GetComponent<BlurEffect>();
BlurFX.iterations = 1;
BlurFX.blurSpread = 0.3f;
Post Blur Process BlurFX.blurShader = Shader.Find("Hidden/BlurEffectConeTap");
Shader.(implementation
is not Yet)
쉐도우 렌더링.
RTT 텍스쳐 셈플링 처리. 셈플링 값을 낮게 설정 하여 코스트 낮춤.
프로젝터 카메라에 블러 컴퍼넌트 적용 하여 이미지 블러링.