Archived

This topic is now archived and is closed to further replies.

Pixel Shaders?

This topic is 5655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know if OpenGL supports pixel shading? If so, can someone point me to a good tutorial on them. I searched Google but what I found was very advanced and over my head. Maybe there is a simple beginners tutorial on the subject? Thanks!

Share this post


Link to post
Share on other sites
OpenGL Register Combiners = DirectX Pixel Shaders. I have yet to see a good introductory tutorial on Combiners, but there are a lot of examples on nVidia''s web site.

BTW, when I mean a good introductory tutorial, I mean something as simple as slapping a texture on a quad or coloring a triangle red. Most tutorials, unfortunately, focus on doing something neat and fancy right off the bat.

Share this post


Link to post
Share on other sites
quote:

OpenGL Register Combiners = DirectX Pixel Shaders.


Not exactly. register combiners + texture shaders = DX pixel shaders.

And of course OpenGL supports pixel shaders. Look up said extensions (or fragment_shader if you have an ATi card).

Share this post


Link to post
Share on other sites
Jeeky said it best:

quote:

BTW, when I mean a good introductory tutorial, I mean something as simple as slapping a texture on a quad or coloring a triangle red. Most tutorials, unfortunately, focus on doing something neat and fancy right off the bat.



Yeah. That sucks. Because to start off simple and see how they work I would want to do just that: make a triangle and a light and then use pixel shaders to light the triangle properly. Damn! I''ll check out Nvidia''s website anyways, though. Thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by jeeky
OpenGL Register Combiners = DirectX Pixel Shaders. I have yet to see a good introductory tutorial on Combiners, but there are a lot of examples on nVidia''s web site.

BTW, when I mean a good introductory tutorial, I mean something as simple as slapping a texture on a quad or coloring a triangle red. Most tutorials, unfortunately, focus on doing something neat and fancy right off the bat.


Hmm I might have to do one up, using nvParse as the interface for the shaders however, so to skip on using the actual combiner functions themselves. nvParse makes it shitloads easier

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
Yann L--Thanks for the clarification.

Maximus--That would be great. I know I would be interested in seeing a very simple example.

Share this post


Link to post
Share on other sites
So some basic pixel shader examples I could give would be like:

1) just outputting the colour from the texture lookup to the fragment
2) blending the primary colour with the colour from the texture lookup for the fragment
3) blending the pixels from two texture unit lookups together
4) inverting the colour of returned from a texture lookup, and using that for the fragment colour

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
Unfortunately jeeky is right, beginner tutorials on OpenGL pixel/vertex shaders are very hard to find. And although nVidia''s (and ATi''s) developer sites are excellent resources, they are also quite advanced.

The only sites I know from the top of my head, that have some basic examples about shaders are Nutty''s Site and Delphi3D. Most people already know those sites, but mentioning them again can''t really hurt. And in case you are really stuck with a pixel/vertex shader problem, you can try out the opengl.org forums. A few guys from nVidia and ATi are posting there, so you have a direct contact to the source

Hope that helps.

/ Yann

Share this post


Link to post
Share on other sites
RegularKid, I asked this very question about two weeks ago. I have been scouring nVidia''s site for some time now, but have still been unable to find a good tutorial that teaches me how to use the register combiners to do bumpmapping. By good, I mean a tutorial which assumes that I know nothing about register combiners, which I don''t.

I found what I thought was a decent document by Mark Kilgard, but it contains so much calculus and advanced mathematics that I was told I could only understand it if I was a third year Maths Degree student (over here in the UK). And I''d need to understand it to understand the rest of his document. It doesn''t explain the principles behind bumpmapping nor the use of the register combiners very well. I was going to post a thread here on GameDev.net asking if anyone had a tutorial which could teach me how to use the nVidia register combiners. I mean, the guys who write nVidia''s demos must get their information from somewhere, as the majority of them don''t work for nVidia...

It seems that there are a lot of people out there besides me who are also looking for a good tutorial. Does anyone know of one me, RegularKid and everyone else could use?


Movie Quote of the Week:

"I''ve seen things you people wouldn''t believe. Attack ships
on fire off the shoulder of Orion. I watched C-beams glitter
in the dark near the Tannhauser gate. All those moments will
be lost in time, like...tears in rain. Time to die."

- Roy Batty, Blade Runner.

Try http://uk.geocities.com/mentalmantle - DarkVertex Coming Soon!

Share this post


Link to post
Share on other sites
By the way, if you want to take a look at that document Mark Kilgard wrote, which I refer to above, it''s here:

http://www.nvidia.com/view.asp?IO=Practical_Bumpmapping_Tech

I challenge you to make any sense of it (Unless you''re a third year Maths Degree student)...


Movie Quote of the Week:

"I''ve seen things you people wouldn''t believe. Attack ships
on fire off the shoulder of Orion. I watched C-beams glitter
in the dark near the Tannhauser gate. All those moments will
be lost in time, like...tears in rain. Time to die."

- Roy Batty, Blade Runner.

Try http://uk.geocities.com/mentalmantle - DarkVertex Coming Soon!

Share this post


Link to post
Share on other sites
I just read the pdf''s on the nVidia site. Theres a VERY good one which details the use of nvParse for register combiner setup.

As for doing some tutorials on it, Ive got a base up and running utilizing multitexturing and register combiners (via nvparse). Im undecided on how I should approach doing tutorials from it. Im thinking of totally ignoring the C side of things (loading the nvparse dll, function pointers, etc) and focusing on the actual nvParse pixel shader scripts themselves. Comments?

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
That would be absolutely awsome if one of you guys could make a basic pixel shader tutorial for OpenGL. Yeah, I would be estatic if the tutorial showed how to just light a triangle realistically using pixel shaders. The main reason why I want to learn pixel shaders is because I am having lighting problems in my game engine. Basically, because OpenGL lights base the amount of light a vertex recieves by distance, I''m having problems with large polygons. When I put the light directly over any vertex on the polygon it works great, but as soon as I get in the middle of the polygon or between two vertices, the polygon gets no light because it''s too far away from any of the vertices. Thats where I beleive pixel shaders would come in to help me get perfect lighting no matter where the light source is. Am I correct in all this?

Share this post


Link to post
Share on other sites
quote:
Original post by RegularKid
That would be absolutely awsome if one of you guys could make a basic pixel shader tutorial for OpenGL. Yeah, I would be estatic if the tutorial showed how to just light a triangle realistically using pixel shaders. The main reason why I want to learn pixel shaders is because I am having lighting problems in my game engine. Basically, because OpenGL lights base the amount of light a vertex recieves by distance, I''m having problems with large polygons. When I put the light directly over any vertex on the polygon it works great, but as soon as I get in the middle of the polygon or between two vertices, the polygon gets no light because it''s too far away from any of the vertices. Thats where I beleive pixel shaders would come in to help me get perfect lighting no matter where the light source is. Am I correct in all this?


with a directional light distance is NOT taken into consideration only for positional lights, with gl lighting u need to tesselate the triangles finer.
if u dont wanna do that use a dot3 texture on the polygon (there r a lot of tutorials about bumpmapping on the net, in fact for 3d graphics it would be one of the top10 things covered so u should be able to find something)


http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites