misc_model ASE lightmapped models still being vertex-lit?


(G0-Gerbil) #1

I’ve got some stalagmite and stalagtites I’ve created from patches and converted to ASEs for use as prefab misc_models in my map (done it like this as opposed to brushes cos I want the box mapping).

Anyway, just tried it out and 2 problems:

  1. The auto clipping is crap, I can climb up near vertical surfaces (solved by not using autoclipping and and creating my own clips, so not really a big pain)
  2. They appear to increase (rather dramatically I might add) the vertex lighting stage of light compile.
    The set up is as follows:
    I have my patches using a standard phong shaded rock texture.
    Then I duplicate the patches and apply my glittering texture to this copy - which uses polygon offset to be drawn over the top. I’m pretty sure it’s this stage causing the vertex lighting code to kick in because of course I specify no lightmap.

The shader is here:

textures/mml_helmsdeep/glittering
{
	// Editor properties
	qer_editorimage textures/mml_helmsdeep/glitter.tga

	// q3map2 properties
//	q3map_surfacelight 200
//	q3map_lightimage textures/mml_helmsdeep/glitterlight.tga		

	// General properties
	nopicmip
	nomipmaps

	surfaceparm nonsolid
	surfaceparm nolightmap
	surfaceparm trans
	polygonoffset

	// Alpha write
	{
		depthwrite
		alphafunc ge128
		blendfunc add
		map textures/mml_helmsdeep/glitteralpha.tga		
		rgbgen identity
	}

	// Sparkle effect
	{
		tcmod scroll 0.003 0.01
		depthfunc equal
		blendfunc add
		map textures/mml_helmsdeep/glitter.tga
		rgbgen identity
	}
}

I’ve commented out the surface light because although it looked quite sweet, it really hurts the compile times and I just plain can’t be arsed with that :slight_smile:

So erm, is there a way of both disabling lightmaps AND vertex lighting? I use blendfunc add to get the effect I want - I don’t want anything affecting this glitter effect except the TGA image contents. I had a quick look at the updated q3map2 manual (http://shaderlab.com/q3map2/shader_manual/contents.htm) but anything vaguely related to vertex lit stuff appears to be obselete or not what I’m after.

So, how can I disable this bit of the processing because it’s taking disproportionately long? (slower than the lightmap stage!).


(G0-Gerbil) #2

As an aside to get around the crap clipping, could I create the ASEs using a rock/glitter texture that is trans / non-clipping, and having the clip brushes as part of the ASE? Would they work (either with or without the solid clip / lightmap spawnflags for models?).


(ydnar) #3

Can you post shots of your creation?


(G0-Gerbil) #4

I thought you’d never ask :wink:

The cave walls and beam are normal brushes - the rocks and stalagmites / tites are ASE models as misc_models, with spawnflags erm… 4 I think (lightmapped only, not solid - I use clip brushes for that).

Note this shot does NOT have the glittering in, I’ve disabled that for now,but basically…

For each model, I was creating a duplicate. One used the normal rock texture (seen here), the other used my glitter shader (as posted above). I don’t want (or need) the glitter shader affected by lighting, lightmap or otherwise, since it’s a direct overlay that uses blendfunc add for it’s effect. Now while it LOOKED fine in-game, the problem is that during the light compile stage, these models not having a lightmap, vertex lighting information was being calculated. While visually this has no effect, it bothered me because it added tons of time to the light compile stage (specifically the vertex lighting calculation which was a bit of a clue as to the culprit!).


(G0-Gerbil) #5

As an aside to get around the crap clipping, could I create the ASEs using a rock/glitter texture that is trans / non-clipping, and having the clip brushes as part of the ASE?

BTW I tried this and it doesn’t work - seems like models can’t include clip textures (or rather they are in the ASE file, but not used - possibly any trans texture in an ASE isn’t compiled into the BSP :confused:


(ydnar) #6

Why not just add a second pass of your glittering texture to the stalactite shader?

y


(G0-Gerbil) #7

erm… good point :slight_smile:
I’d planned on keeping them seperately because for the normal rocks I was only going to put the glitter in a few places, so it had to be seperate to the underlying texture. For this, of course, I can’t do that, so more passes would be fine - although can I use those layer type effects combined? (depthwrite and ge128 in underlying stages?).

I’ll go back to bed and stay there until my brain decides to wake up :smiley:

Cheers!


(G0-Gerbil) #8

oops, just realised - the glitter is 2 passes in itself, hence why I asked above about the layer effects working on an already-placed layer (bearing in mind the glitter uses polygon offset so it won’t lie on the same Z buffer depth as the underlying texture).


(ydnar) #9

Can you post a shot with the glitter effect?


(G0-Gerbil) #10

Well, it’s pretty subtle - I can simply mirror this shot from elsewhere with it:

It doesn’t look like much, although it’s animated and the nomipmaps gives an extra glitter effect when you move. Told you it was subtle :slight_smile:

The first layer is simply a black image with a faint noise effect in the alpha channel to just set up some dots into the Z buffer. The actual glitter layer is another but more pronounced noise effect (blurred) so the glitters fade in and out as they scroll.


(ydnar) #11

So it looks like sparklies? Intentionally?

What are you trying to simulate, exactly?

y


(G0-Gerbil) #12

well glittering, I’d have thought that was obvious! :slight_smile:


(ratty redemption) #13

@Gerbil, I`m guessing this effect could also be used to make snow glisten, yes?


(Fracman) #14

The glitter should look pretty nice on snow, i was looking for something like that already…


(ratty redemption) #15

cool :slight_smile:


(G0-Gerbil) #16

I’d post the textures but there’s no point, they aren’t final.
Currently both the transparency layer and the glitter texture itself are just noise in photoshop, but I want to change this to a proper worked texture so there are thin veins etc to it.
In other words, the shader above should be fine with 2 textures where:

  1. The transparency texture is pure black, with alpha info
  2. The glitter texture is whatever you want, without an alpha layer
    Then to use it create a detail brush that’s entirely nodrawnonsolid apart from the face with the glitter.

The only caveat I can think of with snow is that the base texture would almost certainly be quite close to white (especially with a high gamma) which might mean the glitter itself is lost, since it’s colour range is basically from base texture colour to white.


(ratty redemption) #17

thanx Gerbil and if anyone tries this with snow and gets good results, can they then post back in here.

I`m also thinking it might be a better way to have the environmental reflecting effect I use on water surfaces.