Changing RefEntity opacity? ShaderRGBA?


(Ancalagon) #1

I’ve been trying to get the players to fade between fully opaque and fully transparent for a while now. I can’t really use fadeStartTime or fadeEndTime (or a shader) because the end time won’t be known, and the fading process is needed to be able to be reversed at any time.

I’ve been trying to do this in CG_AddRefEntityWithPowerups and had assumed that I could use ShaderRGBA[3] to change the alpha dynamically but it hasn’t had any effect at all.

Does anyone know where I’m going wrong? Or is there another way to do this?


(Rain) #2

First thought: make sure that the shader(s) on the model being used by your refent specify ‘alphaGen vertex’.


(Ancalagon) #3

Hmm… yeah I’d suspected it was probally something with the shader (but I’m still using the Quake 3 Shader Reference since I haven’t found any one specific to the changes since RTCW or WET).
But alphaGen vertex didn’t seem to work (unless there is something else missing in the shader).

However rgbGen entity DID allow the red, green and blue components of ShaderRGBA to work.


(Rain) #4

Er, whoops. Yeah, alphaGen entity should work, too, even though it’s not documented in the shader manual.


(Ancalagon) #5

alphaGen entity doesn’t seem to change anything.
The shader only consists of one stage and other than ‘map’ the only other commands used are ‘alphaGen entity’ and ‘rgbGen entity’.

Aha! Adding ‘blendFunc blend’ just after those fixed it.