Shader in Fixed Function Pipeline

BlitzMax Forums/MiniB3D Module/Shader in Fixed Function Pipeline

BLaBZ(Posted 2012) [#1]
I'm relatively new to shader's and I'm just trying to get my thinking correct about this.

I have a game that I've made using miniB3D and I'd like to add some post processing effects using shaders.

I'm using a lot of miniB3D functions such as EntityTexture and EntityFX,

In order to use some shader post processing effects would I also have to re-write EntityTexture and EntityFX using shaders?


Kryzon(Posted 2012) [#2]
Yes. Not rewrite them completely, but change a lot of them, definitely. The code for RenderWorld() would need modification as well.

If you have no clue how to do this, better port your game to an engine that supports shaders from the get go - even if it's a mod of MiniBlitz3D.


BLaBZ(Posted 2012) [#3]
After a week of studying I did it, SSAO, Per Pixel Lighting and FXAA - A lot easier than porting 30,000+ lines of code


Krischan(Posted 2012) [#4]
Can you provide a demo or at least the changes to miniB3D you made for the community, please? I'm interested :-)


BLaBZ(Posted 2012) [#5]
Will do! I need to combine the necessary shaders so everything unified and enable it for fall back, my desktop has GLSL 3.3 and my laptop has GLSL 1.3, and because of this I couldn't get SSAO to work properly.

Here's how the SSAO came out -

http://rtscreator.blogspot.com/

Last edited 2012


Kryzon(Posted 2012) [#6]
Good job man! glad you found a solution.


KronosUK(Posted 2013) [#7]
Blabz. Are you still planning to release this to the community? just wondering. I am also interested in a non beta version of Minib3d that can run shaders.

Last edited 2013

Last edited 2013


Krischan(Posted 2013) [#8]
I'm still interested, too. I don't need a big or perfect demo, only the basic concept I can play with to understand.


AdamRedwoods(Posted 2013) [#9]
For those that may be interested, minib3d for monkey supports shaders and is actively being extended. It also supports pc,mac, iOS, android, webgl with OpenGL 2.0. There are HLSL branches for xna and directx11.

http://monkeycoder.co.nz/Community/posts.php?topic=3897


BLaBZ(Posted 2013) [#10]
Hey Sorry Guys -

I'll release it when I get home tonight, right now I've embedded SSAO and FXAA into the rendering pipeline which has fallback if it's not supported by the users machine.

It also demonstrates Per-Pixel Lighting


RemiD(Posted 2013) [#11]
I am curious to see shaders in minib3d too.



Question : is a shader always written in the same way (i mean the code in the shader file) or can it differ depending on the 3D engine ?

Thanks,


BLaBZ(Posted 2013) [#12]
It can differ drastically.

Shader code is just like programming except it only deals with graphics and has a very specific purpose.


Kryzon(Posted 2013) [#13]
Regarding what you write the shader with, there are 4 total supported languages: assembly, GLSL, cgFX and HLSL.
All of these have variations per shader model, regardless of the API you're using.

OpenGL: uses assembly, GLSL and cgFX.
Direct3D: uses assembly and HLSL.

CgFX and HLSL for OpenGL and Direct3D, respectively, are the most robust languages you can use. They allow you to define Techniques and Passes all with shader code.
These two languages are not that different from each other, so if you learn one you're pretty much learning the other with minor differences.

Now, what you write in your vertex or fragment shader is entirely up to you. You only have to provide a final vertex position and a final fragment color (even if you choose to discard it and leave the fragment blank).


Krischan(Posted 2013) [#14]
BLaBZ, we're still waiting for a simple demo :-D Bump.


BLaBZ(Posted 2013) [#15]
Hey Krischan,

Sorry for the delay, here's a zip file containing a sample and minib3d+SSAO and FXAA


These are shaders but it doesn't include the ability to add shaders. I was planning on making this possible but never got around to it, the current shaders are basically hard coded.

http://www.infotread.com/downloads/minib3dshader.zip


Krischan(Posted 2013) [#16]
Oh thanks, I have to take a look on this :-)