I haz a pixelshader (and this is a blogpost)

I haz a pixelshader (and this is a blogpost)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

I haz a pixelshader (and this is a blogpost)

Post by knorke »

Actually I have no idea how this happend, seeing how I just woke up, brushed my teeth, and made this between 2 bowls of cereal.
Image
different, bigger image png blabla

It looks excactly like the placeholder loadscreens I was using which is just great and seems to be easy on cpu.
Image

Basically just wanted to collect some links for later never reading and looked at the blur shader of zeroK and outline widgt and did not understand what was going on.
Then I searched forum for "screencopy" which in hindsight does not even make sense since it is just a arbitrarily chosen name.
First result:
Even cruder--screencopy to texture -> TexRect with shader.
So that that is how this works.

So got that obama shader from Evil4Zerggin, from whose thread the result was.

changed glTexRect(0,vsy,vsx,0) to glTexRect(500,vsy,vsx,0)
and it was only rendering the shader on half the screen. :arrow: aha.
Looked at the code of the shader and appearently you just change frag_Color to something and it gets used for that pixel?
Image
Then blue and red and black screeens.

After that, making the actual shader was easy:

Code: Select all

local fragmentShaderSource = [[
uniform sampler2D screencopy;
void main() {
	int pixzelSize = 10; //why cant this be rand() % 10
	float pixelx = pixzelSize/1600.0f;	// ***get real up in this bitch
	float pixely = pixzelSize/1200.0f;	
	vec2 texCoord = vec2(pixelx*int(gl_TexCoord[0].x/pixelx), pixely*int(gl_TexCoord[0].y/pixely));
	gl_FragColor = texture2D(screencopy, texCoord);
}
]]
It also pixelizes some stuff it shoudnt, like selection rectangles but I guess that is just a matter of finding the correct widget:DrawPrexxxx variante.
Gotta get down to the bus stop.

tl;dr
Spring now looks like it is from 1997.
Image
Thanks to Evil4Zerggin for posting his shader example!
Seems like a good base to experiment with.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: I haz a pixelshader (and this is a blogpost)

Post by PicassoCT »

Knorke... you still ahead of me. Now need to write my own shaders :( And i dont even have whole game yet.



I still think all this retro is just a ubertroll trying to get to the engineers at intel and amd.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: I haz a pixelshader (and this is a blogpost)

Post by Beherith »

Nice stuff, epic C&C look :D
Read the glsl orange book. Its kinda short - can be read on a weeks worth of commutes to work and back. And will open your eyes to some crazy possiblities.

Also, this whitepaper http://www710.univ-lyon1.fr/~jciehl/Pub ... ES2005.pdf
Is a very newbie friendly way of going over some stuff in current shading techniques - like how you can render different aspects like normals, color and depth to buffers and do some insane post processing. It will make you go AHA and OMGWTFTHISISAWESOME so many times it will make your head spin.

From the paper:

Image
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: I haz a pixelshader (and this is a blogpost)

Post by knorke »

shaders add 60% to game completness (and can make it go over 100%)

Book and pdf look good. I think first I should learn some more basic open gl things but will remember them for after that.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: I haz a pixelshader (and this is a blogpost)

Post by PicassoCT »

Insolence, you shall repent this outrage!
omg: Knorke haz shaderz! Then i must have shaderz as well! We the UnitedPicassoRepublics (U.P.R.s) shall arm up, and win this armsrace!

By the way looking back when i started, i learned some incredible stuff here. Maybee we should do that to the nubs, instead of bashing, show them the travell_List. People who started low, and how far they went and how much they accomplished. Take a sarcastic, baiting Smoth, and use him as Figurehead!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: I haz a pixelshader (and this is a blogpost)

Post by smoth »

Beherith wrote:Read the glsl orange book.
OpenGL Shading Language (3rd Edition)
^ that one? that thing is huge man!
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: I haz a pixelshader (and this is a blogpost)

Post by PicassoCT »

this sort of read recommendation is given to the same sort of people who get always into public work programs - or free playstations games.

Best thing to get that sort of the street for some time, better for them and especially for public mental safety.

Now that i think about it, i always get books recomended if i talk to people on a prolonged basis :D
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: I haz a pixelshader (and this is a blogpost)

Post by KaiserJ »

man i haven't a clue how shaders work but i really love the pixelly look
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: I haz a pixelshader (and this is a blogpost)

Post by PicassoCT »

you get this itch to write
c:\config.sys

and start to free memory. Looking at this, out there, somewhere, a GhraphicsCard Engineer gets suicidal :D
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: I haz a pixelshader (and this is a blogpost)

Post by Cheesecan »

Looks cool, now you could make minecraft spring.
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

Re: I haz a pixelshader (and this is a blogpost)

Post by Zealot »

What needs to be done to implement shaders like these in game?

Also has anyone come up with a cel or toon shader?

What would be involved in making one?


Thanks
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: I haz a pixelshader (and this is a blogpost)

Post by knorke »

User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: I haz a pixelshader (and this is a blogpost)

Post by SanadaUjiosan »

Yay CT link.

It should be noted this widget can be a bit tough on your PC. I don't have a powerful computer by any means, but it is not a piece of junk either. I don't play with this widget due to some choppiness when there are a lot of units on screen.

Knorke I really like your example image.
Post Reply

Return to “Lua Scripts”