TGMs Shader Package[C++/GLSL]

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
halplus
Posts: 2
Joined: Sun Jan 03, 2010 9:51 pm

problem downloading

Post by halplus »

I don't know if this forum is moderated but i do not see previous message. We are getting trouble downloading from RapidShare with slots full. You can try freehostia or www.000webhost.com. Thanks
gingerheadman
Posts: 18
Joined: Sat Oct 03, 2009 7:14 am
Location: Brisbane, Australia
Contact:

Post by gingerheadman »

I just tried this out with Irrlicht 1.6 and ran into some problems compiling.

Anyone else who can't compile the examples with Irrlicht 1.6, just change

Code: Select all

      rt0 = driver->createRenderTargetTexture(core::dimension2d<s32>(sizeW,sizeH));
      Material.Wireframe = false;
      Material.Lighting = false;
      Material.Textures[0]=rt0;
to

Code: Select all

      rt0 = driver->addRenderTargetTexture(core::dimension2d<u32>(sizeW,sizeH));
      Material.Wireframe = false;
      Material.Lighting = false;
      Material.setTexture(0,rt0);
and

Code: Select all

createDevice(video::EDT_OPENGL, core::dimension2d<s32>(1024, 768),	16, false, false);
to

Code: Select all

createDevice(video::EDT_OPENGL, core::dimension2d<u32>(1024, 768),16, false, false);
My website - Miscreant Software
Aptos
Posts: 7
Joined: Sat May 15, 2010 6:39 pm

Post by Aptos »

I'm having an issue where my game GUI is being drawn upside-down after rendering the Radial Blur.

Code: Select all

driver->setRenderTarget(blur->rt0, true, true, SColor(0,0,0,0));
smgr->drawAll();
driver->setRenderTarget(0);
blur->render();
env->drawAll(); //env is the GUI environment
I thought it might be the setTransformation() call within the render() function, but setting the driver's transformation back to the identity didn't help.

Thoughts/Solutions?

Thanks in advance.

EDIT: I should note that I don't want the radial blur applied to the GUI.
arnir
Competition winner
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

Post by arnir »

is anyway how to change blur value in runtime?
programmer is bad designer
designer is bad programmer
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Use shader callback, and store blur value in it

this what I use for skydome, but it should get you going

Code: Select all

class ISkyShaderConstantSetCallBack : public IShaderConstantSetCallBack
{
public:
  virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData)
  {
    services->setPixelShaderConstant("colorMulty", (float*)(&colorMulty), 1);
  }
  float colorMulty;
};
and on runtime just change ISkyShaderConstantSetCallBack::colorMulty
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

it's all well and good that you said it's free, but that really doesn't define a license and it appeared you were even speaking to a specific person.

anyone in their right mind wouldn't use this code without you actually claiming a legally recognized license... "go ahead" simply isn't good enough, especially after quoting someone specific.

I'm sure many would be happy to assist you if you require it. But you seem like a smart enough person, which leaves me rather confused.

Oh and they are beautiful btw, nice work!
Aptos
Posts: 7
Joined: Sat May 15, 2010 6:39 pm

Post by Aptos »

Aptos wrote:I'm having an issue where my game GUI is being drawn upside-down after rendering the Radial Blur.

Code: Select all

driver->setRenderTarget(blur->rt0, true, true, SColor(0,0,0,0));
smgr->drawAll();
driver->setRenderTarget(0);
blur->render();
env->drawAll(); //env is the GUI environment
I thought it might be the setTransformation() call within the render() function, but setting the driver's transformation back to the identity didn't help.

Thoughts/Solutions?

Thanks in advance.

EDIT: I should note that I don't want the radial blur applied to the GUI.
Anyone have any ideas?
grumpymonkey
Posts: 222
Joined: Mon Jan 19, 2009 10:03 pm
Location: Miami, Florida
Contact:

Post by grumpymonkey »

Aptos wrote:
Aptos wrote:I'm having an issue where my game GUI is being drawn upside-down after rendering the Radial Blur.

Code: Select all

driver->setRenderTarget(blur->rt0, true, true, SColor(0,0,0,0));
smgr->drawAll();
driver->setRenderTarget(0);
blur->render();
env->drawAll(); //env is the GUI environment
I thought it might be the setTransformation() call within the render() function, but setting the driver's transformation back to the identity didn't help.

Thoughts/Solutions?

Thanks in advance.

EDIT: I should note that I don't want the radial blur applied to the GUI.
Anyone have any ideas?
I'm having this same issue using the bloom shader. Do you think it might be a problem with the Irrlicht version? I tried rendering the gui to a different texture and then drawing the texture with driver->draw2DImage but the same thing keeps happening >.<
Image
arnir
Competition winner
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

Re: TGMs Shader Package[C++/GLSL]

Post by arnir »

Is any way how can I get blur effect with only one setRenderTarget() call?
programmer is bad designer
designer is bad programmer
maagi
Posts: 1
Joined: Sun Apr 08, 2012 10:36 pm
Contact:

Re: TGMs Shader Package[C++/GLSL]

Post by maagi »

Radial blur is awesome thx! :D
Change the line 95: " avg /= 11.0;" -> " avg /= 1.0;" to get more intensity like this

Image
Sidar
Posts: 13
Joined: Sat May 12, 2012 11:12 pm

Re: TGMs Shader Package[C++/GLSL]

Post by Sidar »

Sorry for necro-raiding this topic. But the examples that are given are all working within the main.
How will, for example, the bloom shader work if don't want to call the setRenderTarget in the "main loop"?
How will I go about adding the IPostProcessBloom to individual objects?
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: TGMs Shader Package[C++/GLSL]

Post by REDDemon »

you should create a postprocessing manager wich can do the "setRenderTarget" for you in the main loop and then pass references/pointers to your code. Keep it simple and it will work.

Nice the Lava shader, didn't noticed it before. Very good looking.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Sidar
Posts: 13
Joined: Sat May 12, 2012 11:12 pm

Re: TGMs Shader Package[C++/GLSL]

Post by Sidar »

I actually took the different route and just create the callbacks seperately And load them from a file.

in my sphere object:
//ApplyShader
//_______________________________________________________________________
irr::io::path frag = "assets/shaders/Inferno.frag";
irr::io::path vert = "assets/shaders/Inferno.vert";

IGPUProgrammingServices* gpu = SceneManager->getVideoDriver()->getGPUProgrammingServices();
LavaShaderCallBack* infs = new LavaShaderCallBack();

s32 shader = 0;
shader = gpu->addHighLevelShaderMaterialFromFiles
(
vert, "main", EVST_VS_2_0,
frag, "main", EPST_PS_2_0,infs
);

_meshSceneNode->setMaterialType((E_MATERIAL_TYPE)shader);
//_______________________________________________________________________
I guess I need to manage that pointer differently.

While these shaders do the same, i couldn't connect the dots in how it worked. But I got it now =)
Thanks for your reply.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: TGMs Shader Package[C++/GLSL]

Post by robmar »

Nice work! I have a glass shader which also allows the glass to be textured if anyone is interested. Also converting GLSL to HLSL.
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: TGMs Shader Package[C++/GLSL]

Post by REDDemon »

yes I'm really interested in a glass shader O_O
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply