I’ve been working with EasyGen and metashaders lately, and I can’t seem to get the hang of it. Then I read somewhere that JK2 might not correctly support multiple textures in one metashader for one terrain entity… is this true? And if so, does JK2 support q3map2 phong shading?
Does JK2 support terrain metashaders?
It supports all of those things.
The only real game-specific stuff in Q3Map2 are the lightstyles for JK2/SOF2, and the Enemy Territory foliage.
y
Yes, someone at http://commandchamber.net]The Admiral’s Command Chamber posted a shot of his JO level which used metashaders. It was a little borked and needed work, but it was there.
Yes, someone at http://commandchamber.net posted a shot of his JO level which used metashaders. It was a little borked and needed work, but it was there.
Ok, I can get phong-shaded terrain working in JK2… but I’m still having a bit of trouble with the whole metashader thing. I export from easygen, creating base/maps/test.map, base/test.pcx, and base/scripts/test.shader. Then, upon opening compile in q3map2 and testing in jk2mp.exe, I am getting the “oops” grid error texture. So I moved test.shader from base/scripts/ to base/shaders/ and compiled again. Still not working. Then, I renamed textures/test/terrain.vertex in test.shader to be just textures/test/terrain and recompiled. This time, I get a real texture, but it’s not doing the alpha blending it should be from test.pcx. The terrain entity has all the correct keys (“alphamap” is “test.pcx”; “shader” is “test/terrain”; “layers” is “3”; “terrain” is “1”; and “classname” is “func_group”), so I don’t really know what’s wrong. I hate to be that guy, but can somebody walk me through this?
Download this sample map, move the shader into the shaders directory (and don’t forget to update shaderlist.txt!).
It should work OK in JK2.
y
<image snipped since error was fixed>
That’s what I get when I un-paked slterra.pk3 to base/ and did a -game jk2 recompile of slterra.map in q3map2. I moved slterra.shader to base/shaders/ and added “slterra” to shaderlist.txt, but I still get ass-compiles. ARGH. Sorry for all the trouble, but this is annoying me.
That’s because the shader “textures/common/terrain” doesn’t exist. You either have to A) create it, or B) use the JK2 equivalent.
Make sure it has “q3map_terrain” in it.
textures/common/terrain
{
q3map_terrain
surfaceparm nodraw
surfaceparm nolightmap
surfaceparm nomarks
}
y
When I kept getting error compiles, I had created a shader in test.shader identical to what you just posted, y, except I called it textures/test/terrain (instead of textures/common/terrain). Since I set the “shader” key on the terrain entity to “test/terrain” I thought it would work. But you’re right. I changed “textures/test/terrain” to “textures/common/terrain” and now I get this:

I did not change the entity key/value, though… it still reads “shader test/terrain” – is that weird, or is that normal? Either way, who cares, it works. Thanks so much, master ydnar!
Ok, so I’ve got my terrain working properly and am now moving on to the “let’s get this crap lightmapped” stage. This has gone pretty smoothly, in all truth, but I have a question: I followed the nibsworld LMT tutorial often linked-to from here, and there is a line in the baseshader code about “q3map_lightmapsampleoffset” – what does this do? Why is the value in the tutorial set at 8.0? Is this an “offset” as in “take value ‘x’ and add to it the offset value” or “take value ‘x’ and multiply it by the offset value?” Is there any reason not to change this?