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 » 08 Dec 2011, 07:36

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.
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10223
Joined: 24 Jan 2006, 21:12

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

Post by PicassoCT » 08 Dec 2011, 08:11

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.
0 x

User avatar
Beherith
Moderator
Posts: 4933
Joined: 26 Oct 2007, 16:21

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

Post by Beherith » 08 Dec 2011, 08:18

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
0 x

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

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

Post by knorke » 08 Dec 2011, 19:38

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.
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10223
Joined: 24 Jan 2006, 21:12

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

Post by PicassoCT » 08 Dec 2011, 20:19

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!
0 x

User avatar
smoth
Posts: 22297
Joined: 13 Jan 2005, 00:46

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

Post by smoth » 08 Dec 2011, 20:30

Beherith wrote:Read the glsl orange book.
OpenGL Shading Language (3rd Edition)
^ that one? that thing is huge man!
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10223
Joined: 24 Jan 2006, 21:12

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

Post by PicassoCT » 08 Dec 2011, 21:38

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
0 x

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 » 08 Dec 2011, 21:48

man i haven't a clue how shaders work but i really love the pixelly look
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10223
Joined: 24 Jan 2006, 21:12

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

Post by PicassoCT » 08 Dec 2011, 21:58

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
0 x

User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

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

Post by Cheesecan » 19 Dec 2011, 11:53

Looks cool, now you could make minecraft spring.
0 x

User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

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

Post by Zealot » 18 Mar 2013, 18:11

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
0 x

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

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

Post by knorke » 18 Mar 2013, 20:26

0 x

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 » 18 Mar 2013, 21:58

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.
0 x

Post Reply

Return to “Lua Scripts”

cron