Author Topic: Shader programming!  (Read 15122 times)

0 Members and 2 Guests are viewing this topic.

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Shader programming!
I've always loved shader programming and i picked up (in the thread discussing the new features) that you guys were working on normalmapping and shaders. i can't say i'm an expert in the field (and my experience is limited to HLSL, not GLSL), but i would certainly be interested in assisting the development of shaders, or anything else thats needed in general (such as optimization). It would also be an oppurtunity for me to extend my knowledge of shaders and perhaps a bit of assembly.

I would have picked up a copy of the CVS except the site seems to be down -  i'll pick one up later, unless someone can shoot me the CVS information (i use tortoiseCVS).

Not sure if you need it, but i use Vista, so if you need any testing for compatability on vista i can also do that.

EDIT: Again based on that thread, i'm very interested in DX10 and have done extensive experimentation with it - i might be able to put in DX10 support. Too bad its completely useless :p
« Last Edit: June 10, 2007, 02:47:25 am by blackhole »

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Shader programming!
Examples of work:


Extremely simple (and fast), one-pass fake HDR shader, that pretty much just exagerates bright areas. I've been working on a real HDR shader but haven't gotten very far yet.

TAGE: TileAble Graphics Engine
Unfortunatly the only useful thing i've made so far. Not that impressive, until you see it rendering 1000 128x128 images at 300 FPS. Contains my best optimizations.

I have developed a system for the easy and efficient access of DLLs. Its a bit outdated but i think it'd be excellent for a plugin engine after i tweak it.

I also have extensive experience wrapping unmanaged C++ in managed C++ for use in managed languages, and some experience in both LUA and Python.

I suppose its also worth mentioning that i love learning new stuff and could probably do research on an area of coding i'm not familiar with in order to provide needed help. Other than that i have sadly not developed many other key skill areas, and my math skills, while good for my grade, are not sufficient for complex 3D manipulations (Intermediate Algebra just doesn't cut it). Despite this i hope i can be of some help. Somewhere. Somehow. Maybe. :nervous:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Shader programming!
il probibly write my own shaders, it doesnt look to be too much of a big deal. but anyway untill the support is actually in the engine im probibly not gonna bother. i posted a thread awhile back about shader dev utils and whatnot. might be intresting if you can find it. i forget what it was called.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Shader programming!
I use RenderMonkey from ATI, despite the fact that i have an nVidia card. I just don't like nVidia's shader dev. Let me try and get this distortion shader working just to prove i'm not useless :P

EDIT: Karajorma: I successfully grabbed the code under revision 3.6.9  :nod:

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Shader programming!
Finally, a quick 'n dirty distortion shader that does what i want:



This uses a texture (greyscale) to distort the render. The render is distorted around the bright areas. In this case, i applied a simply radial gradiant texture. The amount of distortion can be tweaked. Just imagine this on a beam cannon! ;7

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Shader programming!
i dont think the nvidia plugin even works for glsl. so rendermonkey is pretty much the way to go.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Mav

  • 28
  • location: Shivan fleet - closing in on GTVA space
Re: Shader programming!
Finally, a quick 'n dirty distortion shader that does what i want:



This uses a texture (greyscale) to distort the render. The render is distorted around the bright areas. In this case, i applied a simply radial gradiant texture. The amount of distortion can be tweaked. Just imagine this on a beam cannon! ;7
Yikes! :jaw:

Should you get something like this in-game, we could have singularity weapons and such...   :wakka:
And yes, I'd even have an idea what to use it for...  :drevil:
-__ o_O___O_o
I______O_O_______dragons
________o

-----------------------------------
capship shields DO WORK !!!
my models, now with pics
test mission for commanding capships
-----------------------------------
suffering from a late stage of BoE-infection - DON'T call a doctor, it's too late for that anyway ;o)

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Re: Shader programming!
I'd love to get it in game, but the dev's are still working on the shader engine and in the mean time i need to learn GLSL so i can implement it in openGL, because the peeps here appear to like that more.

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
Re: Shader programming!
i''d use that distortion for subspace jumps.  seriously, you're ripping space open, there's gotta be some funky distortion.  i dont think blue ripply light really covers it.
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 

Offline achtung

  • Friendly Neighborhood Mirror Guy
  • 210
  • ****in' Ace
    • Freespacemods.net
Beam weapons could be spiffed up big time with this too.  As well as large bombs.
FreeSpaceMods.net | FatHax | ??????
In the wise words of Charles de Gaulle, "China is a big country, inhabited by many Chinese."

Formerly known as Swantz

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Stunning what you can do with a simple distortion shader :D By using a wavey distort texture, you could have the texture scroll and give engines a bit of distortion as well. There are so many applications!

I've ported the effect over to openGL, after making some improvements. I found that saturate() resulted in a distortion thats far more faithful to the distortion picture, but the distortion effect achieved without using saturation looks good too, so i decided to keep saturation out of it. Besides, i can't do this with saturation:



Apparently with openGL the rendertarget needs to stay as a 512x512... but that doesn't really pertain to my shader, so i'm not going to worry about it.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
i hope when the coders are writing the shader engine that they interface it wit the scripting system. as i understand it shader based rtt is very fast. so id like to be able to set a render target to feed data into any shader i write. for the usual panel gages and whatnot.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

  

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
I think just being able to apply a shader to any texture (or the entire screen) would suffice.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
i hope when the coders are writing the shader engine that they interface it wit the scripting system. as i understand it shader based rtt is very fast. so id like to be able to set a render target to feed data into any shader i write. for the usual panel gages and whatnot.

:eek2:

I just realized that with OpenGL display lists, I could basically make it possible for you to draw things with scripting with comparable (or better) speed than just the raw commands in C/C++. So hypothetically you could have the power of lowlevel OpenGL code, but still be able to draw objects without massive slowdown.

The only drawback: besides most of the FS2Open code not making use of lowlevel OGL (Although implementing some kind of fs2_open display lists for such a purpose sounds useful), you'd only be able to set things up to draw the same way every frame. IIRC you could translate and rotate them.

Anyway, I had not even thought about that. You're a genius.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
and i was drunk when i posted that :rolleyes: :D
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
yay he's realised what I've meant by 'materials system' for the last four years!
:)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
yay he's realised what I've meant by 'materials system' for the last four years!
:)

No, it's not. :)

The only reason I know about display lists is because I had to look them up in order to implement the functions you were asking for, but the API functions you had me implement were not geared towards this. We also didn't have any scripting support four years ago. Nor did you ever talk about being able to setting up custom model rendering via the materials system (without any POF geometry), or providing raw access to OpenGL functions such as glVertex3f() through scripting.

Though since it looks like we're going back to adding support for D3D, it loses a lot. (This idea, not the materials system)
-C

 

Offline Topgun

  • 210
Whats so bad about D3D?

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
D3D doesn't have the support for display lists that OpenGL has. If I could assume that OpenGL would be the only API present, all I would need to do would be to have one scripting function that's the equivalent of glNewList(), and the rest of the functions would automatically go into that list. With D3D, I'd then have to implement a check for which API is running. Then I'd have to do a custom implementation of display lists for D3D, which would handle caching arguments and functions in the order with which they were called. It also wouldn't benefit from the same optimizations than an OpenGL display list could benefit from; and it'd be slower than calling the commands from the code internally.

Direct3D's equivalent is render states. But IIRC, that mostly deals with setting things up to render an object, rather than actually rendering the object. Bobb was going to use render states for the materials system and some of the OpenGL display list functionality in its OpenGL implementation.

OpenGL display lists
A list of D3D render states

EDIT: And as for why that makes it a problem to implement things (besides the extra work) it means that the same scripting would run at different speeds depending on which API was used, and I'd already be abstracting things to provide the same functionality of both APIs...which is exactly what the Freespace 2 graphics API already does.
« Last Edit: June 15, 2007, 02:57:53 pm by WMCoolmon »
-C