diff --git a/Assets/Textures/Ramps/toonRamp1.png b/Assets/Textures/Ramps/toonRamp1.png new file mode 100644 index 0000000..421440a Binary files /dev/null and b/Assets/Textures/Ramps/toonRamp1.png differ diff --git a/Assets/Textures/Ramps/toonRamp2.png b/Assets/Textures/Ramps/toonRamp2.png new file mode 100644 index 0000000..3dc94e5 Binary files /dev/null and b/Assets/Textures/Ramps/toonRamp2.png differ diff --git a/Assets/Textures/Ramps/toonRamp3.png b/Assets/Textures/Ramps/toonRamp3.png new file mode 100644 index 0000000..c0b29b4 Binary files /dev/null and b/Assets/Textures/Ramps/toonRamp3.png differ diff --git a/Assets/Textures/Ramps/toonRampSpecular.png b/Assets/Textures/Ramps/toonRampSpecular.png new file mode 100644 index 0000000..cd59ccc Binary files /dev/null and b/Assets/Textures/Ramps/toonRampSpecular.png differ diff --git a/DX11Starter.vcxproj b/DX11Starter.vcxproj index 84b4ea4..dd6e039 100644 --- a/DX11Starter.vcxproj +++ b/DX11Starter.vcxproj @@ -1102,6 +1102,64 @@ <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/Assets/Textures/PBR</DestinationFolders> </CopyFileToFolders> </ItemGroup> + <ItemGroup> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp1.png"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp2.png"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp3.png"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRampSpecular.png"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> + <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/Assets/Textures/Ramps</DestinationFolders> + </CopyFileToFolders> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> <Import Project="packages\Microsoft.XAudio2.Redist.1.2.8\build\native\Microsoft.XAudio2.Redist.targets" Condition="Exists('packages\Microsoft.XAudio2.Redist.1.2.8\build\native\Microsoft.XAudio2.Redist.targets')" /> diff --git a/DX11Starter.vcxproj.filters b/DX11Starter.vcxproj.filters index 089b7ba..65951b6 100644 --- a/DX11Starter.vcxproj.filters +++ b/DX11Starter.vcxproj.filters @@ -40,6 +40,9 @@ <Filter Include="Assets\Textures\PBR"> <UniqueIdentifier>{5a00f65f-2015-451b-9c46-5131e9fd2555}</UniqueIdentifier> </Filter> + <Filter Include="Assets\Textures\Ramps"> + <UniqueIdentifier>{e1723348-5c0a-4f5f-8586-ccf0126a4509}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="DXCore.cpp"> @@ -324,6 +327,18 @@ <CopyFileToFolders Include="Assets\Textures\PBR\wood_roughness.png"> <Filter>Assets\Textures\PBR</Filter> </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp1.png"> + <Filter>Assets\Textures\Ramps</Filter> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp2.png"> + <Filter>Assets\Textures\Ramps</Filter> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRamp3.png"> + <Filter>Assets\Textures\Ramps</Filter> + </CopyFileToFolders> + <CopyFileToFolders Include="Assets\Textures\Ramps\toonRampSpecular.png"> + <Filter>Assets\Textures\Ramps</Filter> + </CopyFileToFolders> </ItemGroup> <ItemGroup> <None Include="Helpers.hlsli"> diff --git a/Game.cpp b/Game.cpp index 76ea700..0927627 100644 --- a/Game.cpp +++ b/Game.cpp @@ -80,6 +80,7 @@ void Game::LoadShadersAndMaterials() pixelShaderToon = std::make_shared<SimplePixelShader>(device, context, GetFullPathTo_Wide(L"ToonShader.cso").c_str()); XMFLOAT3 white = XMFLOAT3(1.0f, 1.0f, 1.0f); + XMFLOAT3 deepPurple = XMFLOAT3(0.1f, 0.02f, 0.1f); materials = { std::make_shared<Material>(false, white, 0, vertexShader, pixelShader), @@ -92,6 +93,7 @@ void Game::LoadShadersAndMaterials() std::make_shared<Material>(true, white, 0, vertexShaderPBR, pixelShaderPBR), std::make_shared<Material>(false, white, 0, vertexShader, pixelShader), std::make_shared<Material>(false, white, 0, vertexShader, pixelShaderToon), + std::make_shared<Material>(false, deepPurple, 0, vertexShader, pixelShaderToon), }; } @@ -188,12 +190,21 @@ void Game::LoadTextures() materials[8]->PushSampler("BasicSampler", sampler); materials[8]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-floor_albedo.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); materials[8]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-floor_specular.png", TEXTYPE_SPECULAR, device.Get(), context.Get()); + // this texture has some weird noise artifacts in the holes of the floor that I probably just never noticed + // when I used it in the game I made it for because it was also had Cutoff in Unity. add high cutoff, but not too high for distant mipmaps + materials[8]->SetCutoff(0.9f); + // this is just to test alpha + materials[8]->SetAlpha(0.8f); materials[9]->PushSampler("BasicSampler", sampler); materials[9]->SetRoughness(1); materials[9]->LoadTexture(L"Assets/Textures/WithNormals/cushion.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); materials[9]->LoadTexture(L"Assets/Textures/WithNormals/cushion_normals.png", TEXTYPE_NORMAL, device.Get(), context.Get()); materials[9]->LoadTexture(L"Assets/Textures/WithNormals/cushion_specular.png", TEXTYPE_SPECULAR, device.Get(), context.Get()); + + materials[10]->PushSampler("BasicSampler", sampler); + materials[10]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png", TEXTYPE_EMISSIVE, device.Get(), context.Get()); + materials[10]->SetEmitAmount(XMFLOAT3(0.05f, 0.1f, 0.01f)); } // -------------------------------------------------------- @@ -257,10 +268,10 @@ void Game::CreateBasicGeometry() std::make_shared<Entity>(materials[9], shapes[3]), std::make_shared<Entity>(materials[9], shapes[3]), std::make_shared<Entity>(materials[9], shapes[3]), - std::make_shared<Entity>(materials[9], shapes[3]), - std::make_shared<Entity>(materials[9], shapes[3]), - std::make_shared<Entity>(materials[9], shapes[3]), - std::make_shared<Entity>(materials[9], shapes[3]), + std::make_shared<Entity>(materials[10], shapes[3]), + std::make_shared<Entity>(materials[10], shapes[3]), + std::make_shared<Entity>(materials[10], shapes[3]), + std::make_shared<Entity>(materials[10], shapes[3]), }; transpEntities = { diff --git a/Material.cpp b/Material.cpp index 1186d06..bf30dc5 100644 --- a/Material.cpp +++ b/Material.cpp @@ -10,11 +10,14 @@ Material::Material( pbr = _pbr; tint = _tint; roughness = _roughness; + alpha = 1; + cutoff = 0; vertexShader = _vertexShader; pixelShader = _pixelShader; uvOffset = DirectX::XMFLOAT2(0, 0); uvScale = DirectX::XMFLOAT2(1, 1); - emitAmount = 0; + emitAmount = DirectX::XMFLOAT3(0, 0, 0); + hasAlbedoMap = false; hasEmissiveMap = false; hasSpecularMap = false; hasNormalMap = false; @@ -51,7 +54,17 @@ float Material::GetRoughness() return roughness; } -float Material::GetEmitAmount() +float Material::GetAlpha() +{ + return alpha; +} + +float Material::GetCutoff() +{ + return cutoff; +} + +DirectX::XMFLOAT3 Material::GetEmitAmount() { return emitAmount; } @@ -97,7 +110,17 @@ void Material::SetRoughness(float _roughness) } } -void Material::SetEmitAmount(float _emit) +void Material::SetAlpha(float _alpha) +{ + alpha = _alpha; +} + +void Material::SetCutoff(float _cutoff) +{ + cutoff = _cutoff; +} + +void Material::SetEmitAmount(DirectX::XMFLOAT3 _emit) { emitAmount = _emit; } @@ -118,7 +141,8 @@ void Material::LoadTexture(const wchar_t* _path, const char* _type, ID3D11Device DirectX::CreateWICTextureFromFile(_device, _context, DXCore::GetFullPathTo_Wide(_path).c_str(), 0, shaderResourceView.GetAddressOf()); PushTexture(_type, shaderResourceView); - if (_type == TEXTYPE_EMISSIVE) hasEmissiveMap = true; + if (_type == TEXTYPE_ALBEDO) hasAlbedoMap = true; + else if (_type == TEXTYPE_EMISSIVE) hasEmissiveMap = true; else if (_type == TEXTYPE_SPECULAR) hasSpecularMap = true; else if (_type == TEXTYPE_NORMAL) hasNormalMap = true; else if (_type == TEXTYPE_REFLECTION) hasReflectionMap = true; @@ -145,12 +169,15 @@ void Material::ActivateStandard(Transform* _transform, std::shared_ptr<Camera> _ pixelShader->SetFloat3("cameraPosition", _camera->GetTransform()->GetPosition()); pixelShader->SetFloat("roughness", GetRoughness()); + pixelShader->SetFloat("alpha", GetAlpha()); + pixelShader->SetFloat("cutoff", GetCutoff()); pixelShader->SetFloat2("scale", GetUVScale()); pixelShader->SetFloat2("offset", GetUVOffset()); pixelShader->SetFloat3("ambient", _ambient); - pixelShader->SetFloat("emitAmount", GetEmitAmount()); + pixelShader->SetFloat3("emitAmount", GetEmitAmount()); pixelShader->SetFloat3("tint", GetTint()); pixelShader->SetFloat("lightCount", (int)_lights.size()); + pixelShader->SetInt("hasAlbedoMap", (int)hasAlbedoMap); pixelShader->SetInt("hasEmissiveMap", (int)hasEmissiveMap); pixelShader->SetInt("hasSpecularMap", (int)hasSpecularMap); pixelShader->SetInt("hasNormalMap", (int)hasNormalMap); diff --git a/Material.h b/Material.h index 9f1d5bd..4111c98 100644 --- a/Material.h +++ b/Material.h @@ -39,7 +39,9 @@ public: DirectX::XMFLOAT2 GetUVScale(); DirectX::XMFLOAT2 GetUVOffset(); float GetRoughness(); - float GetEmitAmount(); + float GetAlpha(); + float GetCutoff(); + DirectX::XMFLOAT3 GetEmitAmount(); std::shared_ptr<SimpleVertexShader> GetVertexShader(); std::shared_ptr<SimplePixelShader> GetPixelShader(); @@ -47,7 +49,9 @@ public: void SetUVScale(DirectX::XMFLOAT2 _scale); void SetUVOffset(DirectX::XMFLOAT2 _offset); void SetRoughness(float _roughness); - void SetEmitAmount(float _emit); + void SetAlpha(float _alpha); + void SetCutoff(float _cutoff); + void SetEmitAmount(DirectX::XMFLOAT3 _emit); void SetVertexShader(std::shared_ptr<SimpleVertexShader> _vertexShader); void SetPixelShader(std::shared_ptr<SimplePixelShader> _pixelShader); @@ -55,6 +59,7 @@ public: void PushSampler(std::string _name, Microsoft::WRL::ComPtr<ID3D11SamplerState> _sampler); void PushTexture(std::string _name, Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> _texture); + bool hasAlbedoMap; bool hasEmissiveMap; bool hasSpecularMap; bool hasNormalMap; @@ -74,7 +79,9 @@ private: bool pbr; DirectX::XMFLOAT3 tint; float roughness; - float emitAmount; + float alpha; + float cutoff; + DirectX::XMFLOAT3 emitAmount; DirectX::XMFLOAT2 uvScale; DirectX::XMFLOAT2 uvOffset; std::shared_ptr<SimpleVertexShader> vertexShader; diff --git a/SimplePixelShader.hlsl b/SimplePixelShader.hlsl index 642b8e2..c46944b 100644 --- a/SimplePixelShader.hlsl +++ b/SimplePixelShader.hlsl @@ -7,20 +7,24 @@ cbuffer ExternalData : register(b0) { float3 cameraPosition; - float roughness; + int hasNormalMap; float2 offset; float2 scale; float3 ambient; - float emitAmount; - - float3 tint; float lightCount; + float3 tint; + int hasAlbedoMap; + + float3 emitAmount; int hasEmissiveMap; + + float alpha; + float cutoff; + float roughness; int hasSpecularMap; - int hasNormalMap; int hasReflectionMap; Light lights[MAX_LIGHTS]; @@ -39,6 +43,18 @@ float4 main(VertexToPixel input) : SV_TARGET // ensure input normals are normalized input.normal = normalize(input.normal); input.tangent = normalize(input.tangent); + + float3 surface = tint; + float alphaValue = alpha; + if (hasAlbedoMap) + { + float4 sampledAlbedo = Albedo.Sample(BasicSampler, input.uv); + if (sampledAlbedo.a < cutoff) discard; + float3 albedo = pow(sampledAlbedo.rgb, 2.2f); + surface *= albedo.rgb; + alphaValue *= sampledAlbedo.a; + } + if (hasNormalMap > 0) { float3 unpackedNormal = Normal.Sample(BasicSampler, input.uv).rgb * 2 - 1; @@ -52,12 +68,10 @@ float4 main(VertexToPixel input) : SV_TARGET // view only needs calculated once, so pre-calculate here and pass it to lights float3 view = getView(cameraPosition, input.worldPosition); - float4 albedo = pow(Albedo.Sample(BasicSampler, input.uv).rgba, 2.2f); float specular = 1; if (hasSpecularMap > 0) specular = Specular.Sample(BasicSampler, input.uv).r; float3 emit = float3(1, 1, 1); if (hasEmissiveMap > 0) emit = Emissive.Sample(BasicSampler, input.uv).rgb; - float3 surface = albedo.rgb * tint; float3 light = ambient * surface; // loop through lights @@ -83,5 +97,5 @@ float4 main(VertexToPixel input) : SV_TARGET final = lerp(final, reflCol, getFresnel(input.normal, view, F0_NON_METAL)); } - return float4(pow(final, 1.0f/2.2f), albedo.a); + return float4(pow(final, 1.0f/2.2f), alphaValue); } diff --git a/ToonShader.hlsl b/ToonShader.hlsl index 9202ab8..b66444f 100644 --- a/ToonShader.hlsl +++ b/ToonShader.hlsl @@ -16,7 +16,13 @@ cbuffer ExternalData : register(b0) float lightCount; float3 tint; + int hasAlbedoMap; + float3 emitAmount; + int hasEmissiveMap; + + float alpha; + float cutoff; float roughness; int hasSpecularMap; @@ -26,9 +32,12 @@ cbuffer ExternalData : register(b0) Texture2D Albedo : register(t0); Texture2D Specular : register(t1); Texture2D Normal : register(t2); +Texture2D Emissive : register(t3); +Texture2D RampDiffuse : register(t4); +Texture2D RampSpecular : register(t5); SamplerState BasicSampler : register(s0); -float RampDiffuse(float original) +float GetRampDiffuse(float original) { if (original < 0.25f) return 0.0f; //if (original < 0.5f) return 0.5f; @@ -37,7 +46,7 @@ float RampDiffuse(float original) return 1; } -float RampSpecular(float original) +float GetRampSpecular(float original) { if (original < 0.6f) return 0.0f; @@ -52,6 +61,17 @@ float4 main(VertexToPixel input) : SV_TARGET float3 view = getView(cameraPosition, input.worldPosition); float3 normal = input.normal; + float3 surface = tint; + float alphaValue = alpha; + if (hasAlbedoMap) + { + float4 sampledAlbedo = Albedo.Sample(BasicSampler, input.uv); + if (sampledAlbedo.a < cutoff) discard; + float3 albedo = pow(sampledAlbedo.rgb, 2.2f); + surface *= albedo.rgb; + alphaValue *= sampledAlbedo.a; + } + if (hasNormalMap > 0) { float3 unpackedNormal = Normal.Sample(BasicSampler, input.uv).rgb * 2 - 1; @@ -66,9 +86,6 @@ float4 main(VertexToPixel input) : SV_TARGET { specularValue = Specular.Sample(BasicSampler, input.uv).r; } - - float4 albedo = pow(Albedo.Sample(BasicSampler, input.uv).rgba, 2.2f); - float3 surface = albedo.rgb * tint; float3 light = ambient * surface; for (int i = 0; i < lightCount; i++) { @@ -85,14 +102,16 @@ float4 main(VertexToPixel input) : SV_TARGET break; } - float diffuse = RampDiffuse(getDiffuse(normal, toLight)); - float specular = RampSpecular(calculateSpecular(normal, toLight, view, specularValue, diffuse) * roughness); + float diffuse = GetRampDiffuse(getDiffuse(normal, toLight)); + float specular = GetRampSpecular(calculateSpecular(normal, toLight, view, specularValue, diffuse) * roughness); light += (diffuse * surface.rgb + specular) * attenuate * lights[i].Intensity * lights[i].Color; } - float4 rim = RampSpecular((1 - dot(view, input.normal)) * pow(light, 0.075f)); - float3 final = float3(light + rim/* + (emit * emitAmount)*/); + float3 emit = float3(1, 1, 1); + if (hasEmissiveMap > 0) emit = Emissive.Sample(BasicSampler, input.uv).rgb; + float4 rim = GetRampSpecular((1 - dot(view, input.normal)) * pow(light, 0.075f)); + float3 final = float3(light + rim + (emit * emitAmount)); - return float4(pow(final, 1.0f / 2.2f), albedo.a); + return float4(pow(final, 1.0f / 2.2f), alphaValue); } \ No newline at end of file