diff --git a/Assets/Textures/Skies/planets/AllSkyFree_Readme.txt b/Assets/Textures/Skies/planets/AllSkyFree_Readme.txt new file mode 100644 index 0000000..31a5299 --- /dev/null +++ b/Assets/Textures/Skies/planets/AllSkyFree_Readme.txt @@ -0,0 +1,60 @@ +Welcome to AllSky Free! + +This is a small sample edition of the full version of Allsky. +It contains a set of 10 skyboxes for use in your environments. +I hope you find them useful! + +You can Buy the full version of AllSky here : + +https://assetstore.unity.com/packages/2d/textures-materials/sky/allsky-200-sky-skybox-set-10109 + +The full version has 200 skies for Unity! Provided as 6 sided cubemaps sized from x1024 to x2048 per-side along with an equirectangular cubemap texture ranging from 4k to 16k in size. Each has an example lighting setup scene! + +Various styles: Day, Night, Cartoon, Fantasy, Hazy, Epic, Space, Sunless and Moonless! + +For lighting artists, environment artists and indie developers looking for a wide suite of skies to light their environments. + +Lighting from day to night: Twilight, sunset, multiple times of day, multiple times of night, skyglow. + +Many weather and cloud types: Clear, overcast, summery, stormy, autumnal, hazy, epic, foggy, cumulus. + + +TECHNICAL + + Texture format: Each sky is a 6 sided cubemap. Source PNG texture resolution per-side ranges from x1024 to x2048. Equirectangular images vary in size up to 16k textures. + + Skies are sorted by time of day or style in folders. + Each individual sky has a folder which contains the textures and a material with those textures assigned. + There is also a demo scene with example lighting and fog pass for reference. + + Each sky has its own 6 sided skybox material which you can set to your scene's current skybox. + Please consult the Unity documentation if you are unsure how to do this. + http://docs.unity3d.com/Manual/HOWTO-UseSkybox.html + + There is also an equirectangular material. Some users report that this is preferable in their use-case or build platform. + + The materials are mostly set as /mobile/skyboxes shaders - which should be fastest - but you can change them to the other skybox shaders that ship with Unity and set the required textures. Some add tint, exposure and rotation controls. + + The import resolution and type of compression used on the sky textures is entirely up to you. It should be set at a level which you feel utilises appropriate amounts of memory for your game amd platform, taking into account the amount of compression artifacts that you feel are acceptable. + +DEMO SCENE + + Each sky folder also has a demo scene. This shows a simple low-poly environment to demonstrate lighting and fog settings for that sky. + + It was lit in the Forward Lighting Rendering Path with Linear lighting Color Space. + For intended demo scene lighting values and fog to be visible you will need a project with those settings. + (Under Edit->Project Settings->Player) + If you have to change these settings it may be necessary to re-import the sky textures. + + The demo scene can benefit from increasing the Pixel light count in quality settings, and the Shadow Distance. + +WHO + + This asset pack is by Richard Whitelock. + A game developer, digital artist & photographer. + 15+ years in the games industry working in a variety of senior art roles on 20+ titles. + Particularly experienced in environment art, lighting & special FX. + Currently working on various indie game & personal projects. + + http://www.richardwhitelock.com + diff --git a/Assets/Textures/Skies/planets/back.png b/Assets/Textures/Skies/planets/back.png new file mode 100644 index 0000000..5230d4b Binary files /dev/null and b/Assets/Textures/Skies/planets/back.png differ diff --git a/Assets/Textures/Skies/planets/down.png b/Assets/Textures/Skies/planets/down.png new file mode 100644 index 0000000..3f16de5 Binary files /dev/null and b/Assets/Textures/Skies/planets/down.png differ diff --git a/Assets/Textures/Skies/planets/front.png b/Assets/Textures/Skies/planets/front.png new file mode 100644 index 0000000..16c9d85 Binary files /dev/null and b/Assets/Textures/Skies/planets/front.png differ diff --git a/Assets/Textures/Skies/planets/left.png b/Assets/Textures/Skies/planets/left.png new file mode 100644 index 0000000..39cd6e2 Binary files /dev/null and b/Assets/Textures/Skies/planets/left.png differ diff --git a/Assets/Textures/Skies/planets/right.png b/Assets/Textures/Skies/planets/right.png new file mode 100644 index 0000000..2e3e966 Binary files /dev/null and b/Assets/Textures/Skies/planets/right.png differ diff --git a/Assets/Textures/Skies/planets/up.png b/Assets/Textures/Skies/planets/up.png new file mode 100644 index 0000000..e9cd2c1 Binary files /dev/null and b/Assets/Textures/Skies/planets/up.png differ diff --git a/DX11Starter.vcxproj b/DX11Starter.vcxproj index b5c9303..c06c975 100644 --- a/DX11Starter.vcxproj +++ b/DX11Starter.vcxproj @@ -144,6 +144,7 @@ + @@ -156,6 +157,7 @@ + @@ -826,6 +828,92 @@ $(OutDir)/Assets/Textures/WithNormals + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + + false + true + false + true + false + true + false + true + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + $(OutDir)/Assets/Textures/Skies/planets + + diff --git a/DX11Starter.vcxproj.filters b/DX11Starter.vcxproj.filters index 25bf041..9ad1d9c 100644 --- a/DX11Starter.vcxproj.filters +++ b/DX11Starter.vcxproj.filters @@ -31,6 +31,12 @@ {7476640e-6b46-49e4-a478-c3ce10b2ddca} + + {343d3538-c075-4c73-8ca8-f919b5ba231b} + + + {f0ccea00-427b-47f7-8fce-7110b649b668} + @@ -63,6 +69,9 @@ Source Files + + Source Files + @@ -98,6 +107,9 @@ Header Files + + Header Files + @@ -246,6 +258,24 @@ Assets\Textures\WithNormals + + Assets\Textures\Skies\planets + + + Assets\Textures\Skies\planets + + + Assets\Textures\Skies\planets + + + Assets\Textures\Skies\planets + + + Assets\Textures\Skies\planets + + + Assets\Textures\Skies\planets + diff --git a/Game.cpp b/Game.cpp index 5a225b6..85226a3 100644 --- a/Game.cpp +++ b/Game.cpp @@ -90,8 +90,6 @@ void Game::LoadShadersAndMaterials() // -------------------------------------------------------- void Game::LoadTextures() { - Microsoft::WRL::ComPtr sampler; - D3D11_SAMPLER_DESC sampDesc = {}; sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; @@ -186,6 +184,24 @@ void Game::CreateBasicGeometry() entities[i]->GetTransform()->SetPosition((-(int)(entities.size() / 2) + i) * 5, 0, 0); entities[i]->GetMaterial()->SetRoughness(0.60f); } + + skybox = std::make_shared( + shapes[0], + std::make_shared(device, context, GetFullPathTo_Wide(L"SkyboxVertexShader.cso").c_str()), + std::make_shared(device, context, GetFullPathTo_Wide(L"SkyboxPixelShader.cso").c_str()), + CreateCubemap( + device, + context, + L"Assets/Textures/Skies/planets/right.png", + L"Assets/Textures/Skies/planets/left.png", + L"Assets/Textures/Skies/planets/up.png", + L"Assets/Textures/Skies/planets/down.png", + L"Assets/Textures/Skies/planets/front.png", + L"Assets/Textures/Skies/planets/back.png" + ), + sampler, + device + ); } @@ -241,6 +257,8 @@ void Game::Draw(float deltaTime, float totalTime) entity->Draw(camera, ambient, lights); } + skybox->Draw(context, camera); + // Present the back buffer to the user // - Puts the final frame we're drawing into the window so the user can see it // - Do this exactly ONCE PER FRAME (always at the very end of the frame) diff --git a/Game.h b/Game.h index 712d23c..583e3fa 100644 --- a/Game.h +++ b/Game.h @@ -7,6 +7,7 @@ #include "SimpleShader.h" #include "Material.h" #include "Lights.h" +#include "Sky.h" #include #include // Used for ComPtr - a smart pointer for COM objects #include @@ -58,6 +59,9 @@ private: // A7 Lights std::vector lights; DirectX::XMFLOAT3 ambient; + // A9 Normalmaps & Cubemaps + std::shared_ptr skybox; + Microsoft::WRL::ComPtr sampler; Microsoft::WRL::ComPtr constantBufferVS; }; diff --git a/Sky.cpp b/Sky.cpp index b61a481..8a54ed2 100644 --- a/Sky.cpp +++ b/Sky.cpp @@ -1,10 +1,18 @@ #include "Sky.h" -Sky::Sky(std::shared_ptr _mesh, Microsoft::WRL::ComPtr _cubemap, Microsoft::WRL::ComPtr _sampler, Microsoft::WRL::ComPtr _device) +Sky::Sky( + std::shared_ptr _mesh, + std::shared_ptr _vertexShader, + std::shared_ptr _pixelShader, + Microsoft::WRL::ComPtr _cubemap, + Microsoft::WRL::ComPtr _sampler, + Microsoft::WRL::ComPtr _device) { mesh = _mesh; cubemap = _cubemap; sampler = _sampler; + vertexShader = _vertexShader; + pixelShader = _pixelShader; D3D11_RASTERIZER_DESC rDesc = {}; rDesc.FillMode = D3D11_FILL_SOLID; @@ -21,7 +29,7 @@ Sky::~Sky() { } -void Sky::Draw(Microsoft::WRL::ComPtr _context, Camera* _camera) +void Sky::Draw(Microsoft::WRL::ComPtr _context, std::shared_ptr _camera) { _context->RSSetState(rasterizerState.Get()); _context->OMSetDepthStencilState(depthState.Get(), 0); diff --git a/Sky.h b/Sky.h index 915c210..b0bb454 100644 --- a/Sky.h +++ b/Sky.h @@ -12,6 +12,8 @@ class Sky public: Sky( std::shared_ptr _mesh, + std::shared_ptr _vertexShader, + std::shared_ptr _pixelShader, Microsoft::WRL::ComPtr _cubemap, Microsoft::WRL::ComPtr _sampler, Microsoft::WRL::ComPtr _device); @@ -19,7 +21,7 @@ public: void Draw( Microsoft::WRL::ComPtr _context, - Camera* _camera); + std::shared_ptr _camera); private: Microsoft::WRL::ComPtr sampler;