Compare commits
2 Commits
faa36dd679
...
3af10d120b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af10d120b | ||
|
|
6c8bead6ab |
BIN
assets/blender/landscape.blend
LFS
BIN
assets/blender/landscape.blend
LFS
Binary file not shown.
2
src/debug.ps1
Normal file
2
src/debug.ps1
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.\build.ps1
|
||||||
|
& raddbg.exe --ipc run
|
||||||
@@ -402,6 +402,7 @@ namespace Game
|
|||||||
// World Tile
|
// World Tile
|
||||||
tile.EData.Visible = IsActive;
|
tile.EData.Visible = IsActive;
|
||||||
tile.EData.ModelH = staticCard.BaseModelHandle;
|
tile.EData.ModelH = staticCard.BaseModelHandle;
|
||||||
|
tile.EData.TextureHandle = staticCard.ModelTextureHandle;
|
||||||
|
|
||||||
tile.EData.DotColor = visuals.TileDotColor;
|
tile.EData.DotColor = visuals.TileDotColor;
|
||||||
tile.EData.BaseColor = visuals.TileBaseColor;
|
tile.EData.BaseColor = visuals.TileBaseColor;
|
||||||
|
|||||||
@@ -289,14 +289,15 @@ namespace Tools
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Text("Entity Groups");
|
if (ImGui::TreeNodeEx("Entity Groups"))
|
||||||
ImGui::Checkbox("Cubes", &level.Cubes.IsEnabled);
|
{
|
||||||
ImGui::Checkbox("Tests", &level.Tests.IsEnabled);
|
ImGui::Checkbox("Cubes", &level.Cubes.IsEnabled);
|
||||||
ImGui::Checkbox("PuzzleTiles", &level.PuzzleTiles.IsEnabled);
|
ImGui::Checkbox("Tests", &level.Tests.IsEnabled);
|
||||||
ImGui::Checkbox("UIQuads", &level.UIQuads.IsEnabled);
|
ImGui::Checkbox("PuzzleTiles", &level.PuzzleTiles.IsEnabled);
|
||||||
ImGui::Checkbox("Level", &level.LevelEntities.IsEnabled);
|
ImGui::Checkbox("UIQuads", &level.UIQuads.IsEnabled);
|
||||||
|
ImGui::Checkbox("Level", &level.LevelEntities.IsEnabled);
|
||||||
ImGui::Separator();
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
bool uiconfigChanged = false;
|
bool uiconfigChanged = false;
|
||||||
if (ImGui::TreeNodeEx("Game Tablet"))
|
if (ImGui::TreeNodeEx("Game Tablet"))
|
||||||
@@ -334,38 +335,42 @@ namespace Tools
|
|||||||
level.ReloadLevelEntities();
|
level.ReloadLevelEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
if (ImGui::TreeNodeEx("Dithering"))
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Dithergen"))
|
||||||
|
{
|
||||||
|
DitherGen(rendering.DitherTextures, rendering.DitherRecursion);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SliderInt("Recursion", &rendering.DitherRecursion, 1, 4);
|
||||||
|
ImGui::Text("%ux%ux%u",
|
||||||
|
rendering.DitherTextures.DitherTexWH,
|
||||||
|
rendering.DitherTextures.DitherTexWH,
|
||||||
|
rendering.DitherTextures.DitherTexDepth);
|
||||||
|
if (!isValid(rendering.DitherTextures.PreviewTex))
|
||||||
|
{
|
||||||
|
ImGui::Text("Invalid Texture");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Image(
|
||||||
|
rendering.DitherTextures.PreviewTex.idx,
|
||||||
|
{(float)rendering.DitherTextures.DitherTexWH,
|
||||||
|
(float)rendering.DitherTextures.DitherTexWH * rendering.DitherTextures.DitherTexDepth});
|
||||||
|
}
|
||||||
|
if (isValid(rendering.DitherTextures.RampTex))
|
||||||
|
{
|
||||||
|
ImGui::Image(rendering.DitherTextures.RampTex.idx,
|
||||||
|
{BX_COUNTOF(rendering.DitherTextures.BrightnessRamp), 8});
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Dithergen"))
|
if (ImGui::TreeNodeEx("Shader log"))
|
||||||
{
|
{
|
||||||
DitherGen(rendering.DitherTextures, rendering.DitherRecursion);
|
ImGui::TextWrapped("%s", Game::GetShared().Dev.ShaderLog);
|
||||||
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::SliderInt("Recursion", &rendering.DitherRecursion, 1, 4);
|
|
||||||
ImGui::Text("%ux%ux%u",
|
|
||||||
rendering.DitherTextures.DitherTexWH,
|
|
||||||
rendering.DitherTextures.DitherTexWH,
|
|
||||||
rendering.DitherTextures.DitherTexDepth);
|
|
||||||
if (!isValid(rendering.DitherTextures.PreviewTex))
|
|
||||||
{
|
|
||||||
ImGui::Text("Invalid Texture");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::Image(rendering.DitherTextures.PreviewTex.idx,
|
|
||||||
{(float)rendering.DitherTextures.DitherTexWH,
|
|
||||||
(float)rendering.DitherTextures.DitherTexWH * rendering.DitherTextures.DitherTexDepth});
|
|
||||||
}
|
|
||||||
if (isValid(rendering.DitherTextures.RampTex))
|
|
||||||
{
|
|
||||||
ImGui::Image(rendering.DitherTextures.RampTex.idx,
|
|
||||||
{BX_COUNTOF(rendering.DitherTextures.BrightnessRamp), 8});
|
|
||||||
}
|
|
||||||
Vec3 quadPos = level.UIQuads.Get({0}).EData.Transform.Position;
|
|
||||||
ImGui::Text("%f %f %f", quadPos.x, quadPos.y, quadPos.z);
|
|
||||||
|
|
||||||
ImGui::Text("Shader log:");
|
|
||||||
ImGui::TextWrapped("%s", Game::GetShared().Dev.ShaderLog);
|
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@@ -464,7 +469,8 @@ namespace Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tools::ModelDropdown(card.BaseModelHandle);
|
Tools::ModelDropdown(card.BaseModelHandle);
|
||||||
Tools::TextureDropdown(card.BoardTextureHandle);
|
Tools::TextureDropdown(card.ModelTextureHandle, "World Texture");
|
||||||
|
Tools::TextureDropdown(card.BoardTextureHandle, "UI Texture");
|
||||||
if (IsValid(card.BaseModelHandle))
|
if (IsValid(card.BaseModelHandle))
|
||||||
{
|
{
|
||||||
auto& mdl = rendering.Models[card.BaseModelHandle.ModelIdx];
|
auto& mdl = rendering.Models[card.BaseModelHandle.ModelIdx];
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,7 +32,7 @@ vec3 desaturate(vec3 color)
|
|||||||
|
|
||||||
float dither(float brightness, vec2 inputUv)
|
float dither(float brightness, vec2 inputUv)
|
||||||
{
|
{
|
||||||
float globalScale = 8;
|
float globalScale = 6;
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
float xRes = u_texInfo.z;
|
float xRes = u_texInfo.z;
|
||||||
@@ -59,10 +59,9 @@ float dither(float brightness, vec2 inputUv)
|
|||||||
// Figuring out how many dots we want
|
// Figuring out how many dots we want
|
||||||
float scaleExp = exp2(globalScale);
|
float scaleExp = exp2(globalScale);
|
||||||
float spacing = freq.y * scaleExp;
|
float spacing = freq.y * scaleExp;
|
||||||
spacing *= dotsPerSide * 0.125;
|
spacing *= dotsPerSide * (1 / globalScale); // todo: just guessed that globalScale is the right variable here
|
||||||
|
|
||||||
float brightnessSpacingMultiplier = pow(brightnessCurve * 2 + 0.001, -(1 - 0.5));
|
float brightnessSpacingMultiplier = pow(brightnessCurve * 2 + 0.001, -(1 - 0.5));
|
||||||
// float brightnessSpacingMultiplier = 1;
|
|
||||||
spacing *= brightnessSpacingMultiplier;
|
spacing *= brightnessSpacingMultiplier;
|
||||||
|
|
||||||
float spacingLog = log2(spacing);
|
float spacingLog = log2(spacing);
|
||||||
@@ -77,35 +76,58 @@ float dither(float brightness, vec2 inputUv)
|
|||||||
|
|
||||||
float pattern = texture3D(s_ditherSampler, vec3(uv, subLayer)).r;
|
float pattern = texture3D(s_ditherSampler, vec3(uv, subLayer)).r;
|
||||||
|
|
||||||
float contrast = 2 * scaleExp * brightnessSpacingMultiplier * 0.1;
|
float contrast = 0.5 * scaleExp * brightnessSpacingMultiplier * 0.1;
|
||||||
contrast *= pow(freq.y / freq.x, 1.0);
|
contrast *= pow(freq.y / freq.x, 1.0);
|
||||||
float baseVal = lerp(0.5, brightness, saturate(1.05 / (1 + contrast)));
|
float baseVal = lerp(0.5, brightness, saturate(1.05 / (1 + contrast)));
|
||||||
float threshold = 1 - brightnessCurve + 0.6;
|
float threshold = 1 - brightnessCurve;
|
||||||
|
|
||||||
return saturate((pattern - threshold) * contrast + baseVal);
|
return saturate((pattern - threshold) * contrast + baseVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec4 rgbToCmyk(vec3 rgb)
|
||||||
|
{
|
||||||
|
return vec4(1.0, 1.0, 1.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 cmykToRgb(vec4 cmyk)
|
||||||
|
{
|
||||||
|
return vec3(1.0, 1.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 rotateUV(vec2 uv, vec2 angle)
|
||||||
|
{
|
||||||
|
return uv;
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// setup
|
// setup
|
||||||
|
bool isTextured = u_dotColor.x < 0.02;
|
||||||
float testRadius = 30.0;
|
float testRadius = 30.0;
|
||||||
float testSpeed = 1.0;
|
float testSpeed = 1.0;
|
||||||
vec3 testOffset = vec3(0.0, 0.0, 50.0);
|
vec3 testOffset = vec3(0.0, 0.0, 50.0);
|
||||||
vec3 lightPos = vec3(sin(u_time.x * testSpeed) * testRadius, 5.0, cos(u_time.x * testSpeed) * testRadius);
|
vec3 lightPos = vec3(sin(u_time.x * testSpeed) * testRadius, 5.0, cos(u_time.x * testSpeed) * testRadius);
|
||||||
vec3 texColor = u_dotColor.x > 0.1 ? u_dotColor.xyz : texture2D(s_texColor, v_uv0).xyz;
|
vec3 baseColor = u_baseColor.xyz;
|
||||||
|
vec3 texColor = isTextured ? texture2D(s_texColor, v_uv0).xyz : u_dotColor.xyz;
|
||||||
|
|
||||||
// lighting
|
// lighting
|
||||||
// float brightness = calcBrightness(lightPos, v_wpos, v_normal);
|
float brightness = lerp(0.2, 0.8, calcBrightnessDirectional(vec3(0.5, 0.3, 1.0), v_normal));
|
||||||
float brightness = lerp(0.5, 0.9, calcBrightnessDirectional(vec3(0.5, 0.3, 1.0), v_normal));
|
|
||||||
// float brightness = 0.5;
|
|
||||||
// brightness = lerp(0.2, 1.0, sin(u_time.x) * 0.5 + 0.5);
|
|
||||||
|
|
||||||
float r = dither(brightness * texColor.r, v_uv0);
|
// dither
|
||||||
float g = dither(brightness * texColor.g, v_uv0);
|
float r = dither(texColor.r * brightness, v_uv0);
|
||||||
float b = dither(brightness * texColor.b, v_uv0);
|
float g = dither(texColor.g * brightness, v_uv0);
|
||||||
// vec3 finalColor = vec3(r, g, b);
|
float b = dither(texColor.b * brightness, v_uv0);
|
||||||
vec3 ditheredColor = dither(brightness, v_uv0);
|
vec3 ditheredColor = vec3(r,g,b);
|
||||||
vec3 finalColor = mix(u_baseColor, texColor, ditheredColor);
|
|
||||||
|
vec4 cmyk = rgbToCmyk(texColor * brightness);
|
||||||
|
cmyk.x = dither(cmyk.x, rotateUV(v_uv0, float2(0.966, 0.259)));
|
||||||
|
cmyk.y = dither(cmyk.y, rotateUV(v_uv0, float2(0.259, 0.966)));
|
||||||
|
cmyk.z = dither(cmyk.z, rotateUV(v_uv0, float2(1.000, 0.000)));
|
||||||
|
cmyk.w = dither(cmyk.w, rotateUV(v_uv0, float2(0.707, 0.707)));
|
||||||
|
// vec3 ditheredColor = cmykToRgb(cmyk);
|
||||||
|
|
||||||
|
// finalize
|
||||||
|
vec3 finalColor = mix(baseColor, ditheredColor, ditheredColor);
|
||||||
gl_FragColor = vec4(finalColor, 1.0);
|
gl_FragColor = vec4(finalColor, 1.0);
|
||||||
|
// gl_FragColor = vec4(texColor * brightness, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
// raddbg 0.9.19 project file
|
// raddbg 0.9.19 project file
|
||||||
|
|
||||||
|
recent_file: path: "../src/game/rendering/dither.cpp"
|
||||||
|
recent_file: path: "../src/game/rendering/rendering.cpp"
|
||||||
recent_file: path: "../src/game/entity.h"
|
recent_file: path: "../src/game/entity.h"
|
||||||
recent_file: path: "../src/game/level.cpp"
|
recent_file: path: "../src/game/level.cpp"
|
||||||
recent_file: path: "../src/game/ui.cpp"
|
recent_file: path: "../src/game/ui.cpp"
|
||||||
recent_file: path: "../src/gen/generated.cpp"
|
recent_file: path: "../src/gen/generated.cpp"
|
||||||
recent_file: path: "../src/engine/main.cpp"
|
recent_file: path: "../src/engine/main.cpp"
|
||||||
recent_file: path: "../src/game/setup.cpp"
|
recent_file: path: "../src/game/setup.cpp"
|
||||||
recent_file: path: "../src/game/rendering/rendering.cpp"
|
|
||||||
recent_file: path: "../src/dependency/imgui/imgui_widgets.cpp"
|
recent_file: path: "../src/dependency/imgui/imgui_widgets.cpp"
|
||||||
recent_file: path: "../src/game/tools.cpp"
|
recent_file: path: "../src/game/tools.cpp"
|
||||||
recent_file: path: "../src/dependency/bgfx.cmake/bx/src/debug.cpp"
|
recent_file: path: "../src/dependency/bgfx.cmake/bx/src/debug.cpp"
|
||||||
|
|||||||
Reference in New Issue
Block a user