Created MaskedRainbow material in unreal

This commit is contained in:
2026-02-20 18:50:13 -05:00
parent 68b88a19f4
commit cf77eb8544
6 changed files with 69 additions and 3 deletions

View File

@@ -8,7 +8,10 @@
"Bash(clangd:*)", "Bash(clangd:*)",
"Bash(clangd-16:*)", "Bash(clangd-16:*)",
"Bash(ssh jyelon-office \"clangd --version 2>/dev/null || clangd-16 --version 2>/dev/null || clangd-18 --version 2>/dev/null || ls /usr/bin/clangd*\")", "Bash(ssh jyelon-office \"clangd --version 2>/dev/null || clangd-16 --version 2>/dev/null || clangd-18 --version 2>/dev/null || ls /usr/bin/clangd*\")",
"Bash(git check-ignore:*)" "Bash(git check-ignore:*)",
"Bash(ls:*)",
"WebFetch(domain:ikrima.dev)",
"WebFetch(domain:indxzero.github.io)"
], ],
"deny": [ "deny": [
"Bash(git commit *)", "Bash(git commit *)",

Binary file not shown.

Binary file not shown.

50
Shaders/RainbowColors.ush Normal file
View File

@@ -0,0 +1,50 @@
#pragma once
static const int RainbowColorsSize = 16;
static const float3 RainbowColors[RainbowColorsSize] = {
float3(1.00, 0.05, 0.05), // 0 red
float3(0.45, 0.00, 0.00), // 1 dark red
float3(1.00, 0.20, 0.00), // 2 orange
float3(0.20, 0.05, 0.01), // 3 dark orange (brown)
float3(1.00, 1.00, 0.00), // 4 yellow
float3(0.35, 0.45, 0.00), // 5 olive
float3(0.00, 1.00, 0.00), // 6 green
float3(0.00, 0.30, 0.00), // 7 dark green
float3(0.00, 1.00, 1.00), // 10 cyan
float3(0.00, 0.40, 0.40), // 11 dark cyan
float3(0.00, 0.00, 1.00), // 8 blue
float3(0.00, 0.00, 0.25), // 9 dark blue
float3(0.25, 0.00, 1.00), // 12 purple
float3(0.10, 0.00, 0.25), // 13 dark purple
float3(1.00, 0.05, 1.00), // 14 pink
float3(0.45, 0.00, 0.25) // 15 dark pink
};
// Given a color index, find the associated color.
// If NColors is 8 or less, skips the "dark" colors.
// If NColors is 4 or less, skips 3 out of 4 colors.
//
float3 RainbowColorLookup(int coloridx, int ncolors)
{
if (ncolors <= 8) coloridx *= 2;
if (ncolors <= 4) coloridx *= 2;
float3 color = float3(1,1,1);
if (coloridx < RainbowColorsSize) color = RainbowColors[coloridx];
return color;
}
// Create a striped rainbow pattern. The pattern has ncolors
// color bands, separated by thin white lines. Using the mask,
// which is a bitmask, you can turn any band to black.
//
float3 MaskedRainbowPattern(float texcoord, int ncolors, int mask)
{
float bandPos = texcoord * ncolors;
int coloridx = (int)floor(fmod(bandPos, ncolors));
float3 color = RainbowColorLookup(coloridx, ncolors);
if (mask & (1 << coloridx)) color = float3(0, 0, 0);
float edge = frac(bandPos);
if ((edge <= 0.1) || (edge >= 0.9)) color = float3(1, 1, 1);
return color;
}

View File

@@ -8,7 +8,7 @@ public class Integration : ModuleRules
{ {
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { PublicDependencyModuleNames.AddRange(new string[] {
"Core", "Core",
"CoreUObject", "CoreUObject",
"Engine", "Engine",
@@ -18,7 +18,8 @@ public class Integration : ModuleRules
"Networking", "Networking",
"EnhancedInput", "EnhancedInput",
"UMG", "UMG",
"CommonUI" "CommonUI",
"RenderCore"
}); });
PrivateDependencyModuleNames.AddRange(new string[] { PrivateDependencyModuleNames.AddRange(new string[] {

View File

@@ -3,6 +3,9 @@
#include "Integration.h" #include "Integration.h"
#include "Common.h" #include "Common.h"
#include "Modules/ModuleManager.h" #include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/Paths.h"
#include "ShaderCore.h"
#if WITH_EDITOR #if WITH_EDITOR
#include "Engine/Blueprint.h" #include "Engine/Blueprint.h"
@@ -17,6 +20,9 @@ IMPLEMENT_PRIMARY_GAME_MODULE(FlxIntegrationModuleImpl, Integration, "Integratio
void FlxIntegrationModuleImpl::StartupModule() void FlxIntegrationModuleImpl::StartupModule()
{ {
FString ShaderDir = FPaths::Combine(FPaths::ProjectDir(), TEXT("Shaders"));
AddShaderSourceDirectoryMapping(TEXT("/Project/Integration"), ShaderDir);
#if WITH_EDITOR #if WITH_EDITOR
OnAssetSavedHandle = UPackage::PackageSavedWithContextEvent.AddRaw( OnAssetSavedHandle = UPackage::PackageSavedWithContextEvent.AddRaw(
this, &FlxIntegrationModuleImpl::OnAssetSaved); this, &FlxIntegrationModuleImpl::OnAssetSaved);