⭐ DirectX/DirectX11 3D
[DirectX11] 029~30 Cube Map, Sphere Map
[DirectX11] 029~30 Cube Map, Sphere Map
2023.01.27Cubemap Texture 글의 요약 설명 부분. 150자를 적어주세요. 글의 요약 설명 부분. 150자를 적어주세요. 글의 요약 설명 부분. 150자를 적어주세요. 글의 요약 설명 부분. 150자를 적어주세요. 글의 요약 설명 부분. 150자를 적어주세요. 글의 요약 설명 부분. 150자입니다 목차 Cube Map CubeMap.fx CubeMap.fx 더보기 matrix World; matrix View; matrix Projection; TextureCube CubeMap; struct VertexInput { float4 Position : Position; float2 Uv : Uv; float3 Normal : Normal; }; struct VertexOutput { float4 Posit..
[DirectX11] 028 Mesh Sphere, Mesh Cylinder + 구면 좌표계, 원통 좌표계
[DirectX11] 028 Mesh Sphere, Mesh Cylinder + 구면 좌표계, 원통 좌표계
2023.01.26Mesh Sphere, Mesh Cylinder 구면 좌표계, 원통 좌표계 목차 Mesh Sphere 구면 좌표계 https://blog.naver.com/qio910/221499166816 구면 좌표계(Spherical Coordinate System) 이전 공부 구면 좌표계(Spherical coordinate system)는 3차원 공간의 한 점을 (r, θ, φ)로 나타냅니다.... blog.naver.com https://www.youtube.com/watch?v=5vUSrA9mqJk https://www.youtube.com/watch?v=ae6kcOBEZK0 MeshSphere.cpp 내에 void MeshSphere::Create() 이 구면 좌표계 그리는 부분이다. Vector3 p = ..
[DirectX11] 027 Mesh Cube
[DirectX11] 027 Mesh Cube
2023.01.25목차 MeshCube MeshCube MeshCube.h 더보기 #pragma once class MeshCube : public Mesh { public: MeshCube(Shader* shader); ~MeshCube(); private: void Create() override; //Mesh.h에 있는 Create() 재정의 }; MeshCube.cpp 더보기 #include "Framework.h" #include "MeshCube.h" MeshCube::MeshCube(Shader * shader) : Mesh(shader) { } MeshCube::~MeshCube() { } void MeshCube::Create() { float w = 0.5f; float h = 0.5f; float d ..
[DirectX11] 025~26 Mesh
[DirectX11] 025~26 Mesh
2023.01.21목차 Mesh 짐벌락 현상 x축과 z축이 겹쳐서 돌다가 정상적으로 Rendering되지 않고 사라져버린다. 짐벌락 해결방법 2가지 3DXMatrixRotationYawPitchRoll 사원수 참고사항 copy(v.begin(), v.end(), stdext::checked_array_iterator (vertices, vertexCount)); 벡터의 시작주소, 끝주소, 복사받을 배열의 시작주소, 갯수 Mesh.fx Mesh.fx 더보기 matrix World; matrix View; matrix Projection; float4 Index; Texture2D DiffuseMap; float3 Direction; struct VertexInput { float4 Position : Position; fl..
[DirectX11] 024 Vertical Raycast
[DirectX11] 024 Vertical Raycast
2023.01.20그리드의 크기가 일정하지 않는 경우. 두 지면의 크기가 다른 경우. 다음과 같은 지형들을 구현할 때 사용하는 방식에 대해 알아보자. 삼각형 충돌 방식. 실제 게임에서 이 방법이 더 많이 쓰인다. 목차 Vertical Raycast 수식 -> 반직선 삼각형 충돌 D3DXIntersection 사용 start direction 두 요소가 필요하다. 삼각형의 위치를 구한다. 용어 정의 Picking: 무언가를 선택하겠다. 여기서 무언가는 플레이어가 위치하고 있는 삼각형. Raycast: 반직선을 쏴서 선택했다 팁 TIP! Window에서 대문자 TRUE, FALSE는 int형으로 1, 0 취급한다. 0이 아닌 값이 나왔을 때 왜 TRUE가 나왔는지 각각 파악하기 위해 0이 아닌 값을 TRUE를 만들어주는 대신..
[DirectX11] 023 Get Height
[DirectX11] 023 Get Height
2023.01.20그리드의 크기가 일정한 지형을 만들어보자. 목차 Get Height ( V2 - V0 ) x ( x - V0.x) ddx = (position.x - v[0].x) / 1.0f; ddz = (position.z - v[0].z) / 1.0f; V0 + ( V2 - V0 ) * ( x - V0.x) + ( V1 - V0 ) * ( z - V0.z) v[0] + (v[2] - v[0]) * ddx + (v[1] - v[0]) * ddz; V3 + ( V1 - V3 ) * ddx + ( V2 - V0) * ddz v[3] + (v[1] - v[3]) * ddx + (v[2] - v[3]) * ddz; ddx + ddz 1 인 경우, 우측상단 삼..
[DirectX11] 020~22 Normal Vector
[DirectX11] 020~22 Normal Vector
2023.01.18목차 Normalize A = V1 - V0 B = V2 - V0 Normal 방향 = Cross(A, B) Normal = Normalize(cross(A, B)) Light Direction 내적 A ⊙ B = |A||B|cosθ Normalize해서 1 x 1 x cosθ = cosθ 빛이 90도로 들어오면 0. Normal Vector의 방향 Normal Vector 방향은 항상 World 변환하여야 한다. Normal의 방향이 바뀌었을때 Update가 되어야 하기 때문이다. w의 활용 w = 1 일 때, 위치 w = 0 일 때, 방향 w는.. Vertex Shader(VS)에서는 위치와 방향을 표기하기 위하여 사용하고 Pixel Shader(PS)에서는 화면 비율에 활용하기 위해 사용한다. ht..
[DirectX11] 019 Heightmap
[DirectX11] 019 Heightmap
2023.01.16목차 Height Map Terrain.fx Terrain.fx 더보기 matrix World; matrix View; matrix Projection; Texture2D Map; struct VertexInput { float4 Position : Position; float2 Uv : Uv; }; struct VertexOutput { float4 Position : SV_Position; float2 Uv : Uv; }; VertexOutput VS(VertexInput input) { VertexOutput output; output.Position = mul(input.Position, World); output.Position = mul(output.Position, View); output...
[DirectX11] 018 Texture Sampler
[DirectX11] 018 Texture Sampler
2023.01.16Texture Sampler 목차 Texture Sampler MapSample( ____ , input.Uv) ____ : SamplerState, Address, Filter Sample의 역할 비율에 따라 확대/축소 SamplerState Interpolation(=보간) Texture Address https://designerd.tistory.com/entry/DX11-D3D11-TEXTURE-ADDRESS [DX11] D3D11 TEXTURE ADDRESS D3D SAMPLER STATE 텍스처의 칼라를 추출해 uv 좌표에 대응하는 작업. 텍스처의 픽셀 사이를 처리하는 방식은 아래와 같다. TEXTURE ADDRESS D3D11 TEXTURE ADDRESS D3D11_TEXTURE_ADDRES..
[DirectX11] 017 Texture Load
[DirectX11] 017 Texture Load
2023.01.14목차 Texture Load 컴퓨터에 저장된 Texture 불러오기 Texture Load 코드 Texture.h 더보기 #pragma once #include "Systems/IExecute.h" class TextureLoadDemo : public IExecute { public: virtual void Initialize() override; virtual void Ready() override {} virtual void Destroy() override; virtual void Update() override; virtual void PreRender() override {} virtual void Render() override; virtual void PostRender() override..
[DirectX11] 016 Texture
[DirectX11] 016 Texture
2023.01.14목차 Texture Rotation 원리 https://learn.microsoft.com/ko-kr/windows/win32/direct2d/how-to-rotate 개체를 회전하는 방법 - Win32 apps 개체를 회전하는 방법을 보여줍니다. learn.microsoft.com http://www.directxtutorial.com/Lesson.aspx?lessonid=9-4-5 DirectXTutorial.com In the last lesson you built a simple, flat triangle lit with simple diffuse lighting. This triangle was not 3D, it was flat. If you managed to change it, you fo..
[DirectX11] 015 Cube
[DirectX11] 015 Cube
2023.01.13목차 Cube Cube.fx Cube.fx 더보기 matrix World; matrix View; matrix Projection; float4 Color; struct VertexInput { float4 Position : Position; }; struct VertexOutput { float4 Position : SV_Position; }; VertexOutput VS(VertexInput input) { VertexOutput output; output.Position = mul(input.Position, World); output.Position = mul(output.Position, View); output.Position = mul(output.Position, Projection); ..