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.

problem downloading

Postby halplus » Sun Jan 03, 2010 10:14 pm

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
halplus
 
Posts: 2
Joined: Sun Jan 03, 2010 9:51 pm

Postby gingerheadman » Sat Jan 09, 2010 12:11 pm

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
User avatar
gingerheadman
 
Posts: 18
Joined: Sat Oct 03, 2009 7:14 am
Location: Brisbane, Australia

Postby Aptos » Sat May 15, 2010 6:42 pm

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.
Aptos
 
Posts: 7
Joined: Sat May 15, 2010 6:39 pm

Postby arnir » Sun May 16, 2010 6:15 pm

is anyway how to change blur value in runtime?
programmer is bad designer
designer is bad programmer
arnir
Competition winner
 
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

Postby ent1ty » Sun May 16, 2010 6:29 pm

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!
User avatar
ent1ty
Competition winner
 
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Postby Midnight » Sun May 16, 2010 7:26 pm

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!
User avatar
Midnight
 
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Postby Aptos » Wed May 19, 2010 10:44 pm

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?
Aptos
 
Posts: 7
Joined: Sat May 15, 2010 6:39 pm

Postby grumpymonkey » Wed Oct 06, 2010 8:50 pm

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
User avatar
grumpymonkey
 
Posts: 222
Joined: Mon Jan 19, 2009 10:03 pm
Location: Miami, Florida

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

Postby arnir » Fri Aug 12, 2011 12:05 pm

Is any way how can I get blur effect with only one setRenderTarget() call?
programmer is bad designer
designer is bad programmer
arnir
Competition winner
 
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

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

Postby maagi » Mon Apr 09, 2012 1:07 pm

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

Image
User avatar
maagi
 
Posts: 1
Joined: Sun Apr 08, 2012 10:36 pm

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

Postby Sidar » Wed May 16, 2012 2:14 am

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?
Sidar
 
Posts: 13
Joined: Sat May 12, 2012 11:12 pm

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

Postby REDDemon » Fri May 18, 2012 8:56 am

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
User avatar
REDDemon
Developer
 
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

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

Postby Sidar » Fri May 18, 2012 4:24 pm

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.
Sidar
 
Posts: 13
Joined: Sat May 12, 2012 11:12 pm

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

Postby robmar » Sun May 27, 2012 9:03 am

Nice work! I have a glass shader which also allows the glass to be textured if anyone is interested. Also converting GLSL to HLSL.
robmar
 
Posts: 994
Joined: Sun Aug 14, 2011 11:30 pm

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

Postby REDDemon » Sun May 27, 2012 6:44 pm

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
User avatar
REDDemon
Developer
 
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Previous

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest

cron