Content

Post new topic Reply to topic

[Q3ASL] rgbGen Const and $whiteimage

Author Message
Eagle The Purpose View user's profile Send private message

Reply with quote Monday, February 01, 2016

As a passionate of improvements and optimizations, I am always searching for techniques or tricks to make something better. The satisfaction and the feeling of actually moving forward just worth all the work!

Today we are focusing on the Quake 3 Arena Shader Language -- Q3ASL for short.

"rgbGen Const ( < are > < G > < B > )" -- 3 floats
"<mapParm> $whiteimage" -- image mapping additional parameter

Sorry, I don't speak Japanese.. -_-


Me neither. This is still English though. For short:

"rgbGen" like in "Red/Green/Blue Generation", is an additional color parameter. Basically a color setting you add over your actual stage's image.

"Const", standing for "Constant", is an argument telling that you want to add a single specific color over your image.

"< are > < G > < B >", respectively the Red, Green and Blue values of your color divided by 255. It should result in values between 0 and 1.

I doubt this keyword was ever used on ZEQ2-Lite. Difficult was it's discovery also. Before going into the example, I will quickly introduce the second mentioned keyword -- "$whiteimage".

Preceded by a mapping parameter such as "map", "clampMap", "animMap" and few others, the "$whiteimage" parameter replaces the path argument. Basically it is applying a white color instead of a defined image.

From what I recall of the scripts I have read so far, this keyword was only used on maps in ZEQ2-Lite.

Example time (without any screens, sorry)!

Finally! I don't even know how I survived this wall of text !! D:


Ahem... From here I assume you know how to make a model appearing in ZEQ2-Lite and how to link it a shader function. In our example, we want to create a two stepped sphere using a white color as the inner and a pink one as the outer. It will require two functions.

2ez4me Wink


I doubt this technique you are thinking about is very appropriate -- even if still working. Usually, peoples will create uniform textures, subjectively varying in size. And that's where they are wrong -- you don't need any texture!

If I don't put a texture, it will make an error and nothing will show up, smartbutt.


Everything needed has been told a bit before. Now, to illustrate, here are the functions:

Function 1:

White
{
   {
      map $whiteimage
   }
}


Function 2:

PinkBlend3
{
   {
      map $whiteimage
      rgbGen Const ( 1 0 0.8 ) //255/255, 0/255, 210/255
      blendfunc add //Don't forget the transparency for the outer group
   }
}


Here we are, building the same effect with a more appropriate approach and obviously with some optimizations -- varying with the effect's configuration:

CPU: Less data to process.
HDD: Less files, less read processes.
RAM: Less memory read/write.

These two keywords alone can actually make drastic changes in ZEQ2-Lite builds and mods, as they force using different hierarchies, resources management and might bring noticeable performance changes.

Notes: As kind of subtly implied at the beginning, rgbGen is an add over the image, thus making the following attempts of optimization improbable:

Function 3:

White
{
   {
      rgbGen Const ( 1 1 1 )
   }
}


Function 4:

PinkBlend3
{
   {
      rgbGen Const ( 1 0 0.8 )
      blendfunc add
   }
}


The difference in performance between functions 1/2 and 3/4 wouldn't be seen though, as this kind of approaches are processed in no time, whereas using the old technique implies to load actual files -- which would be kind of demanding on bigger effects configurations.

Parenthesis are NEEDED. Don't forget them!

Explosions need "rgbGen entity" to properly work -- which means "Const" can't be used. I haven't found a hack for this case yet. Maybe creating a "map Color < are > < G > < B >" would work, as colors seem to be taken from this keyword.
____________


I hope it helped, and that I can post more tutorials. The language does need some adjustments and/or adds to be much more efficient, but we should already use everything we have in hand before yelling "CONSTRAINTS!!!". That said, have a nice modding day and have faith in the ZEQ family!

D_guard_d View user's profile Send private message

Reply with quote Friday, February 26, 2016

Should it be moved to the learning forum?

Eagle The Purpose View user's profile Send private message

Reply with quote Friday, February 26, 2016

I hope it helped, and that I can post more tutorials.



Theoretically. Razz

Post new topic Reply to topic

Actions

Online [ 0 / 6125]