Custom shader - failed to create texture
- TrippleDDD
- Topic Author
Less
More
3 months 1 week ago #1
by TrippleDDD
Custom shader - failed to create texture was created by TrippleDDD
Hi all,
I've been using ReShade and lurking anonymously for many years but never actually made an account so... Hello!
Mostly as a learning exercise, I'm trying to create my own HLSL shader that emulates how enb palette used to work (maybe still does - haven't used it for a veeeery long time!), references a 256x256 png LUT texture and makes colour adjustments accordingly. But I can't get it to compile. Here is the error I keep getting no matter what I try:
I have double and triple-checked that files are in the right locations, tried bmp and png formats, texture path is correct in reshade.ini, no read-only flags are applied, cleared shader cache and reloaded effects etc. I even used ChatGPT 4.1 to help troubleshoot and I still can't work out what the issue is.
Here's my shader, that ChatGPT is adamant should work, but it doesn't. Could someone much smarter than I am please be kind enough to tell me where I'm going wrong?
Many thanks
I've been using ReShade and lurking anonymously for many years but never actually made an account so... Hello!
Mostly as a learning exercise, I'm trying to create my own HLSL shader that emulates how enb palette used to work (maybe still does - haven't used it for a veeeery long time!), references a 256x256 png LUT texture and makes colour adjustments accordingly. But I can't get it to compile. Here is the error I keep getting no matter what I try:
13:47:00:431 [15008] | ERROR | Failed to create texture 'V__DDDPaletteTex' (width = 1, height = 1, levels = 1, format = 0, usage = 0xcc0)! Make sure the texture dimensions are reasonable.
I have double and triple-checked that files are in the right locations, tried bmp and png formats, texture path is correct in reshade.ini, no read-only flags are applied, cleared shader cache and reloaded effects etc. I even used ChatGPT 4.1 to help troubleshoot and I still can't work out what the issue is.
Here's my shader, that ChatGPT is adamant should work, but it doesn't. Could someone much smarter than I am please be kind enough to tell me where I'm going wrong?
Warning: Spoiler!
#include "ReShade.fxh"
// --- Texture and Sampler Block (unique names) ---
texture DDDPaletteTex < source = "DDDpalette.png"; >;
sampler DDDPaletteSampler
{
Texture = DDDPaletteTex;
MinFilter = POINT;
MagFilter = POINT;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
};
// --- User Controls ---
uniform float fUIBlend <
ui_type = "drag";
ui_label = "Blend";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.01;
> = 1.0;
// Set this to your palette width/height (default 256)
uniform float fUIDDDPaletteSize <
ui_type = "slider";
ui_label = "Palette Size (pixels)";
ui_min = 16; ui_max = 1024;
ui_step = 1;
> = 256.0;
// --- Palette Mapping Function ---
float3 MapColorThroughDDDPalette(float3 color)
{
// Use R and G channels for X/Y lookup into palette
float2 uv = float2(color.r, color.g);
// Sample center of each texel (avoids seams)
uv = (uv * (fUIDDDPaletteSize - 1.0) + 0.5) / fUIDDDPaletteSize;
return tex2D(DDDPaletteSampler, uv).rgb;
}
// --- Main Shader ---
float3 DDDpalette_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 original = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 mapped = MapColorThroughDDDPalette(original);
return lerp(original, mapped, fUIBlend);
}
// --- Technique ---
technique DDDpalette
{
pass
{
VertexShader = PostProcessVS;
PixelShader = DDDpalette_PS;
}
}
Many thanks

Please Log in or Create an account to join the conversation.
- crosire
Less
More
3 months 1 week ago #2
by crosire
Replied by crosire on topic Custom shader - failed to create texture
You need to define the width, height and format of "DDDPaletteTex", e.g.
texture DDDPaletteTex < source = "DDDpalette.png"; >
{
Width = 100; // Set these to width and height of your image file
Height = 100;
Format = RGBA8;
};
Please Log in or Create an account to join the conversation.