Pixel shader for all screen
-
Fernado Alonso
Pixel shader for all screen
Hi, i know how put a new material for a one SceneNode with shaders and a funtion SetMeaterial. But i have a other question
I want apply a filter for all screen ( paint all green , or motion blur, etc)
My question is How can i apply one pixel shader (filter) to all screen when it is painted yet , without change the material of the scene node?
Example :
1) I render a scene , each SceneNode with your own Material (shader)
2) To the result (the screen, image result) i want apply other pixel shader (filter)
3) I put the total result in the screen
How can i do this in irrlicht??
I want apply a filter for all screen ( paint all green , or motion blur, etc)
My question is How can i apply one pixel shader (filter) to all screen when it is painted yet , without change the material of the scene node?
Example :
1) I render a scene , each SceneNode with your own Material (shader)
2) To the result (the screen, image result) i want apply other pixel shader (filter)
3) I put the total result in the screen
How can i do this in irrlicht??
i used that to make a night vision shader
here is how
-code the shader
-apply it to a billborad
-make the billboard a child of the camera
-apply the shader to the bill node wich has a render to texture texture(with render target of the same camera)
howver there is a bug where the billboard vibrate when the camera moves
here is how
-code the shader
-apply it to a billborad
-make the billboard a child of the camera
-apply the shader to the bill node wich has a render to texture texture(with render target of the same camera)
howver there is a bug where the billboard vibrate when the camera moves
i used that to make a night vision shader
here is how
-code the shader
-apply it to a billborad
-make the billboard a child of the camera
-apply the shader to the bill node wich has a render to texture texture(with render target of the same camera)
howver there is a bug where the billboard vibrate when the camera moves
here is how
-code the shader
-apply it to a billborad
-make the billboard a child of the camera
-apply the shader to the bill node wich has a render to texture texture(with render target of the same camera)
howver there is a bug where the billboard vibrate when the camera moves
hum . . . i thought about that as well . . . but there must be a better solution than that! this really sounds like "do it your self" effects . . .
by the way - if i understand you right you're using the same camera for the render to texture as you use to render the billboard . . .
you could just take two cameras - one for the render to texture and a secound (which won't ever move) for rendering the billboard for the final output . . .
by the way - if i understand you right you're using the same camera for the render to texture as you use to render the billboard . . .
you could just take two cameras - one for the render to texture and a secound (which won't ever move) for rendering the billboard for the final output . . .
-
Fernando Alonso
Very thanks for your replies, i was sure Omaremad read this thread 
It sound very difficult, plz can you put a example (mini-tutorial) about your two tecnhiques??
have Anyone written a shader "hemispherical lighting" or any light for outdoor scenes?
shaders, shaders.... too powerfull , but we need examples with irrlicht
It sound very difficult, plz can you put a example (mini-tutorial) about your two tecnhiques??
have Anyone written a shader "hemispherical lighting" or any light for outdoor scenes?
shaders, shaders.... too powerfull , but we need examples with irrlicht
what do you mean with hemispherical lighting? If you mean ambient occlusion, this is atm not possible without raytracing . . .
I recommend that you use rendermonkey to write your HLSL shaders because it's verry easy to use and straightforward - and as soon as you get the desired result, you port it to irrlicht . . .
I recommend that you use rendermonkey to write your HLSL shaders because it's verry easy to use and straightforward - and as soon as you get the desired result, you port it to irrlicht . . .
btw i founf the screen space stuff the same as my method
so here is the explanation
i found the artifacts are less when the billboard is far away[/code]
so here is the explanation
i found the artifacts are less when the billboard is far away
Code: Select all
//render 2 texture setup
video::ITexture* rt = 0;
rt = driver->createRenderTargetTexture(core::dimension2d<s32>(1000,1000));
scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
cam->setPosition(core::vector3df(-100,50,100));
cam->setTarget(core::vector3df(0,0,0));
ISceneNode*node;
node = smgr->addBillboardSceneNode(cam, core::dimension2d<f32>(50, 50));
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
node->setMaterialTexture(0, rt); // set material of cube to render target
node->setPosition(core::vector3df(0,-20,50));
//render loop
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, video::SColor(255,0,0,0));
// draw scene into render target
/*we do all this invisble and visble stuff so the camera doesnt see the billboard its rendering 2
// set render target texture
driver->setRenderTarget(rt, true, true, video::SColor(0,0,0,255));
// make billboard invisible and set fixed camera as active camera
node->setVisible(false);
smgr->setActiveCamera(cam);
// draw whole scene into render buffer
smgr->drawAll();
// set back old render target
driver->setRenderTarget(0);
// make the cube visible and set the user controlled camera as active one
node->setVisible(true);
smgr->setActiveCamera(cam);
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - Vertex and pixel shader example [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}-
Thulsa Doom
- Posts: 63
- Joined: Thu Aug 05, 2004 9:40 am
- Location: Germany
Hello people,
excuse me for the maybe offtopic question in this thread.
If not, I will post a bug report.
I expire vibration on a *.3ds scenenode attached to the camera.
THX 4 input.
excuse me for the maybe offtopic question in this thread.
Is this a known bug?omaremad wrote: -make the billboard a child of the camera
...
howver there is a bug where the billboard vibrate when the camera moves
If not, I will post a bug report.
I expire vibration on a *.3ds scenenode attached to the camera.
THX 4 input.
-
Fernando Alonso
No you are wrong. Hemisp. Lighitng is a tecnique for shader in real time for outdoor sceneswhat do you mean with hemispherical lighting? If you mean ambient occlusion, this is atm not possible without raytracing . . .
Example :
developer.nvidia.com/object/FX_Composer_Shaders.html
There is a book very good for shaders for videogames "Shaders for Game Programmers and Artists", but it use DirectX or OpenGL . I want learn to use shaders with irrlicht. In irrlicht is very easy use a shader for a one sceneNode (setMaterial) , but there are very shaders (type filters or Lighting outdoor) where it is necesary apply for all scene nodes or apply to the result of the render of one scene. I thinl there is a bit of examples of tecniques of shaders with irrlicht We need more tutorial of the guru people