TTimo / GtkRadiant

The open source, cross platform level editor for idtech games
http://icculus.org/gtkradiant/
Other
586 stars 155 forks source link

Radiant 1.6.5 and included q3map2 don't seem to be able to load shaders applied to map objects #561

Open SzicoVII opened 7 years ago

SzicoVII commented 7 years ago

Dear development team, I hope you might be able to shed some light onto this. I am a long term user of radiant 1.4.0 and currently have both 1.4.0 and 1.6.5 installed.

I note that 1.4.0 (and the bundled q3map2 version 2.5.16) both load my maps including various custom ase and md3 files (located in the maps/ase and models/map_objects folders) and the applied shaders loaded perfectly (the textures and shaders are in base/textures and base/shaders respectively.)

For some reason, 1.6.5 will not load any shaders/textures applied to these ase models and additionally the q3map2 64 included does not recognise them during compile, and then ingame they are not displayed.

I feel there is something obvious I am missing here - using a frontend, using old q3map2 binaries, everything works perfectly including the shaders ingame. Soon as I compile with the newer q3map2, any shaders on ase models (that get baked into bsp) fail to work properly ingame. I noticed radiant 1.6.5 also cant seem to load these files into its system wheras 1.4.0 has no problems.

Any ideas? Many thanks

0bsidian commented 7 years ago

Are your model's shaders listed in shaderlist.txt for GtkRadiant 1.6.5?

SzicoVII commented 7 years ago

They are listed in the shaderlist.txt file located in base/shaders (This is Jedi Academy) It is strange as the old q3map binaries compile and find the shaders no problem yet the newer ones + in the radiant 1.6.5 programme do not. They still find shaders applied to brushes but not those applied to ase models.

I would also point out it seems to do this for the base game models and their shaders as well

0bsidian commented 7 years ago

Can you provide a test case? An ASE model along with associated textures and shaders?

ensiform commented 7 years ago

FYI there isn't an active maintainer for jka. @mrwonko is not interested anymore afaik.

mrwonko commented 7 years ago

Huh... I actually noticed this myself a couple of days ago (this was on the first or second of the 3 Windows builds released recently) with some button model I was experimenting with. I thought I had just gotten unlucky and picked a broken model and did not give it much thought at the time as I was only interested in animations (which worked), but apparently there's more to it.

SzicoVII commented 7 years ago

I can provide a sample but it seems any model that has a shader applied to it (including ones included with base game) has this issue

Pan7 commented 7 years ago

The texture browser only shows textures where the name starts with "textures/". An example would be nice.

illwieckz commented 7 years ago

I don't know if it's related or not, but .map format and .bsp format can't store a surface's texture path that does not starts with textures/ for the simple reason the .map and .bsp format assumes everything starts with textures/ and cut out this part. In a .map or .bsp file, the textures/somewhat/something shader path is stored as somewhat/something (the engine just re-adds the textures/ prefix on shader load).

The engine can load stuff outside of textures/, for example a skybox shader using that path: textures/skyboxes/cloudy can load files from env/skyboxes/cloudy_*.jpg.

The textures/skyboxes/cloudy path can be applied to a surface (stored as skyboxes/cloudy), but the env/skyboxes/cloudy_up.jpg can't be applied to a surface (there is no way to store this path in .map or .bsp) despite being loadable by the engine.

The same way, a model/anna/torso shader path can be loadable by the engine, the model/anna/torso.jpg picture file can be loadable by the engine, but the model/anna/torso can't be applied to a map surface because there is no available technical way to store it in .map or .bsp format. If model/anna/torso has to be applied to a surface (for example on a statue), this shader has to be cloned and renamed under the textures/ path, for example textures/model/anna/torso. The model/anna/torso.jpg diffuse map does not have to be renamed since the engine can load it from the shader definition.

With some tweaks on the code it's possible to make GtkRadiant listing shader paths that are outside of textures/ directory, but it will leads to some unknown behaviour while saving your map: the .map format can't store these paths.

@SzicoVII is your problem related to that (unfixable) limitation, or is something else?

SzicoVII commented 7 years ago

@illwieckz -No that is not the problem here see original post

_"I note that 1.4.0 (and the bundled q3map2 version 2.5.16) both load my maps including various custom ase and md3 files (located in the maps/ase and models/mapobjects folders) and the applied shaders loaded perfectly (the textures and shaders are in base/textures and base/shaders respectively.)"

You can download here - an example being the candle.map/candle.ase within this pk3 - Doesn't load the candle shader in radiant 1.6.5 or q3map2 and consequently ingame the shader is not displayed. Load the exact same map in gtk 1.4.0 or q3map 2.5.16 and it works fine. Again though, seems to do this with any model (including the base ja game models which have shaders applied to them)

NB: The shader and textures for the models are still located in the /textures folder. But radiant (or at least, up until this release) DOES load textures from models/map_objects and other folders as you can see when you use a misc_model or _remap e.t.c. It may not store them in the .map or .bsp but will still load them to see in radiant and process them at compile time when baked into the bsp.

https://jkhub.org/files/file/3307-bioshock-the-church-of-our-lord/

Pan7 commented 7 years ago

Are the shader files for JK2 and JA just in the "shaders" folder and/or also in the "scripts" folder?

SzicoVII commented 7 years ago

Just in the shaders folder

TTimo commented 6 years ago

Just making a note - this looks like a feature regression and not a user error.

Pan7 commented 6 years ago

Renaming/moving the gamepack folder JAPack\install\base\scripts to shaders might help.

TTimo commented 6 years ago

The stuff in install/ is copied to the game folder when the game is configured by GtkR afaik, not sure what you mean @Pan7

Aciz commented 6 years ago

I don't know if its related to this issue, but making .ase models with GtkRadiant's q3map2 -convert -format ase will write the model materials wrong. It writes BITMAP field on the models wrong, grabbing whatever first valid texture is written in the shader itself (editor image, light image, texture map, whatever comes first). If you change this field to whatever is written as MATERIAL_NAME or MAP_NAME, shader works correctly. There's a switch in NetRadiant's q3map2 that fixes this, -shaderasbitmap.

https://i.imgur.com/4uI0nGi.png