Flush/Reload Shaders?


(Overtaker) #1

Hello,
I am in the process of learning how to add a surfaceparm to a texture. Ultimately, at this point, I just need to add surfaceparm landmine. I attempted to use a implicit shader as such:


textures/fueldump/cave_floor
{
	surfaceparm landmine
	srufaceparm gravelsteps
	implicitMap -
}

Ok. I made this and named it “cshader.shader”. I then placed it in the etmain/scripts directory, then I added “cshader” to my shaderlist.txt file (etmain/scripts dir). After doing this, I opened Radient. I found “cshader” in the texture menu and clicked on it. I didnt notice anything happen, and in the console it read (cant remember exact text but something along the line of…) 0 Shaders loaded. Not knowing what to do next, I ignorantly opened the texture menu and clicked on flush/reload shaders. When I clicked this (I had “cave_floor” texture selected), all of my “cave_floor” textures were replaced with “shader not found”; also, all of my common textures were randomly switched (i.e. “Shader not found” replaced with “origin”, “weapon clip” replaced with “trigger”, “origin” replaced with “caulk”, and so on).

After playing around with the texture, I was able to restore my cave_floor, but was freaking out about having to go and individually change the common textures back to their original state.

I restarted my PC, and now my common textures are back in their original state.

So, this brings me to some questions.

1 What exactly does “Flush/Reload Shaders” do? It sounds self explanitory, but I cant imagion why it changed all my common textures.

2 Where exactly do I store my .shader file while in the developement process (/etmain/scripts or etmain/maps/scripts)? Should I name it the same name as the map?

3 How is a .shader file called (triggered to execute script)? At what level is it called (i.e. is it executed in Radient; or is it executed ingame when the map is loaded?) ?

Ive searched LDR and this site, but havent found any clear answers to 2 and 3.

4 Where is “/textures/fueldump/cave_floor” stored? I have searched my entire Enemy Territory directory and have yet to find “/textures/fueldump/cave_floor”. I have even converted pak0.pk3 to a .zip file and explored it with no avail. The closest thing I found in my pak0 was “/textures/fueldump_sd/”, and all that directory had was door texture. I cant find this file anywhere, yet the texture still shows in Radient and in-game.

Sorry such a long post, but thanks in advance for any help!

-Over


(The Wanderer) #2

ok…you don’t seem to have a good understanding of how shaders work. I’ll answer your questions but i recommend you read the shader manual(it’s a bit outdated but it still has the basics). Also there are a bunch of good tutorials out there about shaders(drakir’s site has a good one) and don’t forget shaderlab. Anyway…to answer your questions.

textures/fueldump/cave_floor

is the name of your shader.
the command

implicitmap -

means use the texture with the same name as the shader for the mapping stage. However there’s no texture with the name textures/fueldump/cave_floor . If you look at the textures/fueldump/cave_floor shader in fueldump.shader you’ll see that they use a texture with the name textures/stone/mxrock1aa.tga for the mapping stage.
So to answer question 4:
there is no textures/fueldump/cave_floor texture. That’s just the shader name. The texture that’s used
for that shader is textures/stone/mxrock1aa.tga. Shader names don’t have anything to do with the names of the textures used in their stages. They can be the same(in which case you can use implicitmap -) but they don’t have to. Just think about how you would name a shader when
you’re using more than one texture in your shader.
BY the way: DON’T make new shaders that have the same name as shaders made by SD
because they cause conflicts. If you wan’t to make your own shaders using SD textures name them something else.

Question1: flush/reload have given me some unexpected results also. Best not to use them, but that’s just me.

Question2: Your shader file should be stored in your etmain/scripts directory. You don’t have to name it the same as your map, but it would be good to avoid conflicts with other shader files from other maps.

Question3: For this you have to understand how shaders work, but basically:
Any “global” attributes which usually have the word q3map_ in front of them and are not in any particular stage are handled by the compiler(executed in radiant). The individual stages and their commands are executed ingame. A better way to understand this is: If you make changes to any global attributes you have to recompile to see the changes in game. If you make changes to any stage specific commands than all you gotta to do is reload the map to view the changes.

Hope this helps


(Overtaker) #3

You are right, I didnt have a firm grasp on the concept of shaders. I am beginning to understand, due mostly to your reply. I will begin trying to change the .shader to point to the real texture now. Thank you for your help!

-Over


(Overtaker) #4

I finally got it to work. At first, I looked in the textures/stone/ directory. I found mxrock1aa, but it was not a .tga file, it was .jpg. No msrock1aa.tga exists. Only .jpg. Anyhoo, what I did in order to get this working was: I opened the scripts/fueldump.shader and copied the “textures/fueldump/cave_floor” script. The script pointed to “textures/stone/mxrock1aa.tga”, yet still, that file doesnt exist. The closest file was mxrock1aa.jpg. The .tga file(with the same name and path) was still yet to be found. But…I changed the extention from .tga to .jpg and it worked nicely! Here it is:


textures/chuck/landmine_rocks
{	
	surfaceparm landmine
	surfaceparm gravelsteps
	q3map_nonplanar
	q3map_shadeangle 60
	qer_editorimage textures/stone/mxrock1aa.jpg
	{
		map $lightmap
		rgbGen identity
	}
	{
		map textures/stone/mxrock1aa.jpg
		blendFunc filter
	}
}

This is essentially the textures/fueldump/cave_floor (default) shader, but I changed the texture path (changed extention from .tga to . jpg) and added the landmine surface parm.