Jump to content

Saber blade shows as gray squares


Go to solution Solved by Jokile8467,

Recommended Posts

Posted

Hello! I'm making a small personal mod that adds a new White saber color with a matching glow & trail to MP. It's also intended to be standalone from all the existing mods with RGB sabers built-in. I've run into a problem where the saber blade shows up in-game as gray squares. The glow, trail and even the saber menu are working correctly.

What I've done so far:

  • Checked the texture files are in .jpg or .png format, and have the same resolution as the default blades (64x256 and 128x128).
    • The largest file size is about 12KB, does JKA have a maximum file size limit for saber textures?
  • Checked the .shader file and folder name structures, only using '/' slashes for directory paths.
  • Checked the mod's cgamex86.dll code. No errors when building (using OpenJK).
  • Loaded the mod without the .shader file (seems to do nothing, no additional errors but didn't fix either).
  • Loaded the mod with no other mods in the Base folder. Also tried loading the mod at the top and bottom of the load order.
  • Checked the in-game console for errors. I couldn't find any relating to the saber.

Screenshots:

Spoiler

shot2021-06-25-14-57-37.jpg

shot2021-06-25-14-59-15.jpg

 

Posted

That's the "missing texture" image. I would have recommended checking your image resolution and file format, and checking the console for errors, but you've already done that… 🤔

Maybe try entering `developer 1` into the console (with cheats enabled) before loading into the map, if you're lucky that might provide additional clues?

Posted

Have you tried testing an image-file that works by copying and renaming it to the one that doesn't work? Then you can be 100% sure that it's not the fault of the texture itself.

Posted

I had a look through the console with 'developer 1' and dumped it to a .txt but there's no references to the missing texture prior to loading into a map. I changed the saber to blue then to my new white to see if anything peculiar popped up, here's a snippit from the log:

Spoiler

clientCommand: Padawan : 4 : forcechanged "free"
serverCommand: 19 : nfr 7 0 3
serverCommand: 20 : cp "Padawan @@@JOINEDTHEBATTLE
"
serverCommand: 21 : cs 1131 "n\Padawan\t\0\model\luke/default\c1\6\c2\3\hc\100\w\0\l\0\tt\0\tl\0\st\single_1\st2\none\dt\0"

serverCommand: 22 : nfr 7 0 0
serverCommand: 23 : print "Padawan @@@PLENTER
"
Padawan entered the game
Cvar_Sort: sort cvars
Cvar_Sort: sort cvars
clientCommand: Padawan : 5 : userinfo "\teamoverlay\0\snaps\40\sex\male\saber2\none\saber1\single_1\rate\25000\name\Padawan\model\luke/default\ja_gu
id\EE6B98152BE8AD95DC1C
C8F6A46BE3B9\handicap\100\forcepowers\7-1-032330000000001333\color2\3\color1\4\char_color_red\255\char_color_green\255\char_color_blue\255\cg_predictItems\1"
serverCommand: 24 : cs 1131 "n\Padawan\t\0\model\luke/default\c1\4\c2\3\hc\100\w\0\l\0\tt\0\tl\0\st\single_1\st2\none\dt\0"

clientCommand: Padawan : 6 : userinfo "\teamoverlay\0\snaps\40\sex\male\saber2\none\saber1\single_1\rate\25000\name\Padawan\model\luke/default\ja_gu
id\EE6B98152BE8AD95DC1C
C8F6A46BE3B9\handicap\100\forcepowers\7-1-032330000000001333\color2\3\color1\6\char_color_red\255\char_color_green\255\char_color_blue\255\cg_predictItems\1"
serverCommand: 25 : cs 1131 "n\Padawan\t\0\model\luke/default\c1\6\c2\3\hc\100\w\0\l\0\tt\0\tl\0\st\single_1\st2\none\dt\0"

]condump log.txt
Dumped console text to log.txt.

I also went into the .pk3 and renamed white_line and white_glow2 to blue_line and blue_glow2. Sure enough the textures themselves work fine when replacing an existing color.

Spoiler

shot2021-06-26-20-25-08.jpg

All I can think of is that I've missed something in the code, a line somewhere that links the in-game saber to the textures? It's odd that the saber menu loads the textures but not outside of that.. 🤔

Posted

I seem to remember that the saber menu does not render some shader stages, but that is a very foggy memory. Could there be typo in your .shader file?

  • Solution
Posted

Fixed it!

As I'd suspected, I'd missed a vital piece of code in the MP Client Game Library. Starting from line 629 in cg_main.c, there's a list of all the various cgs.media CoreShader and GlowShader for each of the saber colors and so on. I'd missed it until now and needed to add new lines of code for my saber color.

Previously, I'd added CoreShader and GlowShader lines to the static qhandle and void UI_CacheSaberGlowGraphics sections within the ui_saber.c file. That explains why the saber colors worked in the menus. I assumed the game would pull that same information from there to render the in-game saber blades, when actually it's only used by the UI menus as the name would imply. D'oh!

Thank you for your assistance, everyone! Hopefully this helps anyone else with similar issues when splicing in new colors to the roster.

mrwonko and ooeJack like this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...