Forum

Tutorial Request: Adding GLSL support

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Tutorial Request: Adding GLSL support

Postby Electro » Sat Dec 13, 2008 11:30 pm

I think it'd help push Quake graphics in the direction they need to go. Rather than coding newer effects in the engine, shaders is the way of the future (or current, really).

I know Darkplaces has it, and that's great (although I haven't looked into what extent it supports them, I'm guessing quite extensively). I'm interested in writing some shaders, and would like for more engines to be able to use them.

The cliche shader for me to start on first would be liquids (water and lava won't be the same shader because well.... they're different! Same for slime).

Anyway... I'd love it if someone could write a tutorial on how to implement this in engines so any work I do on glsl shaders can be more widely spread.
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Postby MeTcHsteekle » Sat Dec 13, 2008 11:37 pm

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaand adding CSQC toengine ":D?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby scar3crow » Sat Dec 13, 2008 11:43 pm

The cliche shader for me to start on first would be liquids (water and lava won't be the same shader because well.... they're different! Same for slime).

Don't forget the muddy water, its not on par with the whiteish blue or the deep blue water in terms of the physical material.

I'd like to see one for various stained glass textures...
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
User avatar
scar3crow
InsideQC Staff
 
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Postby MeTcHsteekle » Tue Mar 24, 2009 9:48 pm

/ bumps on the GLSL
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Irritant » Mon Mar 30, 2009 4:40 pm

MeTcHsteekle wrote:/ bumps on the GLSL


There are a number of engines now using GLSL. It's not really that hard to do once you get the hang of it. The problem I ran into wasn't so much GLSL, but trying to figure out how it was used in engines like DP and some others due to the renderer being rewritten in a way that was unfamiliar to me, and very different looking than the original source. Your best bet is buying the Orange Book, and also downloading tutorials.

You could also look at CRX(Alien Arena engine) source http://svn.icculus.org/alienarena

We make use of GLSL on bsp surfaces(including water) as well as mesh for normal, parallax, and specular, and the code is still structured similarly enough to Q2 that it's not hard to figure out or transpose into another quake engine.

An simple light test map, just a box here of the recently added mesh shaders:

static light
Image

dynamic light
Image

Still working on it some, but so far so good.
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland

Postby revelator » Sun Apr 05, 2009 4:25 am

pretty cool :D

unfortunatly i ran headfirst into a wall when i tried to get the glsl shaders working on realm cause it uses some nasty trickery to do dual layer water to simulate a fragment shader. i got a feeling i will have to rewrite a ton of stuff to get this working erf :/.

mh's code uses a ton of matrix operations to do the nifty stuff and it looks good but damn its anoying when you try to add something like this hehe ;)
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby mh » Sun Apr 05, 2009 1:20 pm

I think the problem with GLSL is that it's not something that's easily tutorialized. You can't just put a GLSL tutorial into an engine and then expect to be able to do cool bumpy specular reflective stuff straight away on everything; a lot of it is dependent on the data that your engine hands over to the shaders, how your rendering passes are structured and so on. That's a lot of work before you even start writing shaders! All that GLSL does is (over-simplified explanation ahoy!) intercept the standard glVertex/glNormal/glColor/glTexCoord/etc calls and let you replace the canned behaviour of them with your own.

Rather than a GLSL Quake tutorial, if you're interested in learning it, you're much better off grabbing a "spinning cube" program and working on that.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby revelator » Fri Apr 10, 2009 11:17 am

so much i got ;)

to my understanding its a script interface to what you explained letting us override vertex data etc.

quite nice but yes hard to implement if your not savy in it.

just looking at the mess of code tenebrae uses for as little as it actually shows in terms of visuals makes my head spin and want me to jump of the nearest bridge (preferably a large one) :lol:
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Entar » Fri Apr 10, 2009 11:28 pm

mh wrote:I think the problem with GLSL is that it's not something that's easily tutorialized. You can't just put a GLSL tutorial into an engine and then expect to be able to do cool bumpy specular reflective stuff straight away on everything

That's true. However, I think it would not be terribly difficult to write a tutorial for GLSL support in GLQuake - you mostly just have to load in the function pointers and have a good function for loading fragment/vertex shaders. Making it work for you beyond that is definitely going to be more complicated though. Maybe to get things started, it could be something for a post-processing shader on the screen, and make it turn everything black and white or something.
User avatar
Entar
 
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest