Jump to content

(JK2) MAX_MAP_DRAW_SURFS with celshader


Recommended Posts

Posted

I've found a celshader. It works perfectly with JKA. When compiling for JK2, it gives the error MAX_MAP_DRAW_SURFS (131072) exceeded. I've tried commenting out some lines in the shader, but can't find what's wrong.

 

The annoying part about it is that Grand Flaw uses this exact method and celshader, and copying the exact way it's done there (including things like blocksize and gridsize) still gives the error. A friend of mine has the same problem.

 

Key: _celshader

Value: celshadertest/ink

 

Shader:


// ink shader for maps
// to use, add "cel" to shaderlist.txt
// add a "_celshader" key to worldspawn entity with a value of "cel/ink"

textures/celshadertest/ink
{
	qer_editorimage textures/celshadertest/black.tga
	
	q3map_notjunc
	q3map_nonplanar
	q3map_bounce 0.0
	q3map_shadeangle 120
	q3map_texturesize 1 1
	q3map_invert
	q3map_offset -2.0
	
	surfaceparm nolightmap
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm nomarks
	
	sort 16
	
	{
		map textures/celshadertest/black.tga
		rgbGen identity
	}
}

textures/celshadertest/no_ink
{
//	qer_editorimage gfx/colors/black.tga
	
//	q3map_notjunc
	q3map_nonplanar
//	q3map_bounce 0.0
//	q3map_shadeangle 120
//	q3map_texturesize 1 1
//	q3map_invert
//	q3map_offset -2.0
	
	surfaceparm nodraw
	surfaceparm nolightmap
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm nomarks
	
//	sort 16
	
//	{
//		map gfx/colors/black.tga
//		rgbGen identity
//	}
}

Any ideas?

Posted

Since cel shading is implementing by duplicating each surface (it's moved outwards a bit and flipped) it doubles their number. You'll thus hit engine limits earlier. The limit in question, that for drawn surfaces, seems to have been increased in Jedi Academy, which would explain why you only run into it in JK2.

 

You'll have to drop some geometry to "fix" this.

Posted

Since cel shading is implementing by duplicating each surface (it's moved outwards a bit and flipped) it doubles their number. You'll thus hit engine limits earlier. The limit in question, that for drawn surfaces, seems to have been increased in Jedi Academy, which would explain why you only run into it in JK2.

 

You'll have to drop some geometry to "fix" this.

 

This was tested by cel shading a single square block in an empty room. While grand flaw, which is a JK2 map, is massive.

Posted

This was tested by cel shading a single square block in an empty room. While grand flaw, which is a JK2 map, is massive.

Oh I see. You're obviously not actually hitting a limit then, so it's probably some problem with Q3Map2. But if it works in Grand Flaw in JK2 there's got to be some way, presumably just not the one you used? Are you sure it's done using _celshader there?
Posted

Oh I see. You're obviously not actually hitting a limit then, so it's probably some problem with Q3Map2. But if it works in Grand Flaw in JK2 there's got to be some way, presumably just not the one you used? Are you sure it's done using _celshader there?

 

Yeah, I have decompiled it to see how it was done, and that's where I initially got the _celshader from. I feel I maybe shouldn't hand out .map files like that, but the celshaded entity in question has:

 

_celshader

cel/ink

 

The worldspawn entity has:

 

gridsize

272 272 320

 

_blocksize

8192

 

 

I've tried using those as well, as if it would somehow impact, but obviously they shouldn't really make a difference. The only thing I can imagine is that he used a different compiler (or certain -keywords to omit the issue) As far as I know, all versions of GtkRadiant (and JK2Radiant) uses the same q3map2 though?

 

 

EDIT:

Note: Compiling for JKA and running it in JK2 works with the celshader. However, there should be a more proper way to fix it, since entities are not the same, and I suppose I've got to use the JK2 compiling process for other entities.

Posted

Is there not a worldspawn _celshader key?

 

Yeah, you can set it on the worldspawn as well (which is what I intend to do). Not sure what effect it has on large maps, but for now, it doesn't compile in JK2 mode in any case.

Posted

I mean have you tried compiling with it set on a per-map basis not a per-shader basis

 

I'm afraid you'd have to explain that again :D What do you mean?

Posted

As in dont add your celshader to individual entities or individual map shaders, just try adding it globally to the worldspawn?

 

Yeah, that doesn't work either.

 

It works as long as the engine path points to JA. The "Game" can be set to JO and it will work. But again, not good for some entities I suppose.

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...