3 rt and 1 fire shader(HLSL)

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

3 rt and 1 fire shader(HLSL)

Post by belfegor »

screen effects

source

ScreenAlignedQuad.h

Code: Select all

#ifndef __SCREEN_ALIGNED_QUAD_HEADER_INCLUDED__
#define __SCREEN_ALIGNED_QUAD_HEADER_INCLUDED__

#include <irrlicht.h>

class CScreenAlignedQuad : public irr::scene::ISceneNode
{
private:
	irr::core::aabbox3d<irr::f32>      m_BBox;
	irr::video::S3DVertex              m_Vertices[4];
	irr::video::SMaterial              m_Material;
public:
	CScreenAlignedQuad(irr::scene::ISceneNode* parent, irr::scene::ISceneManager* smgr, irr::s32 id)
		: irr::scene::ISceneNode(parent, smgr, id)
	{
		m_Material.Lighting        = false;
		m_Material.ZWriteEnable    = false;

		irr::video::SColor vertexColor(255, 0, 0, 255);
		irr::core::vector3df nullNormalVector(0.0f, 0.0f, 0.0f);//no lightning, 0 normal

	
		m_Vertices[0] = irr::video::S3DVertex(
			irr::core::vector3df(-1.0f, 1.0f, 0.0f), 
			nullNormalVector,
			vertexColor,
			irr::core::vector2df(0.0f, 0.0f));
		m_Vertices[1] = irr::video::S3DVertex(
			irr::core::vector3df(1.0f, 1.0f, 0.0f), 
			nullNormalVector,
			vertexColor,
			irr::core::vector2df(1.0f, 0.0f));
		m_Vertices[2] = irr::video::S3DVertex(
			irr::core::vector3df(1.0f, -1.0f, 0.0f), 
			nullNormalVector,
			vertexColor,
			irr::core::vector2df(1.0f, 1.0f));
		m_Vertices[3] = irr::video::S3DVertex(
			irr::core::vector3df(-1.0f, -1.0f, 0.0f), 
			nullNormalVector,
			vertexColor,
			irr::core::vector2df(0.0f, 1.0f));

		m_BBox.reset(m_Vertices[0].Pos);
		for(irr::s32 i = 0; i < 4; i++)
			m_BBox.addInternalPoint(m_Vertices[i].Pos);
	}

	void OnRegisterSceneNode()
	{
		if(IsVisible)
			SceneManager->registerNodeForRendering(this);
		irr::scene::ISceneNode::OnRegisterSceneNode();
	}

	void render()
	{
		irr::u16 indices[6] = {0, 2, 3,   0, 1, 2};
		irr::video::IVideoDriver* driver = SceneManager->getVideoDriver();
		driver->setMaterial(m_Material);
		driver->setTransform(irr::video::ETS_WORLD, AbsoluteTransformation);
		driver->drawIndexedTriangleList(&m_Vertices[0], 4, &indices[0], 2);
	}

	const irr::core::aabbox3d<irr::f32>& getBoundingBox() const
	{
		return m_BBox;
	}

	video::SMaterial& getMaterial(irr::u32 num)
	{
		return m_Material;
	}
};

#endif
main.cpp

Code: Select all

//#include <vld.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")

#include "ScreenAlignedQuad.h"

const s32 winWidth          = 800;
const s32 winHeight         = 600;

IrrlichtDevice* device = 0;

CScreenAlignedQuad* screenQuad = 0;
s32 shaderBlur01Material = 0;
s32 shaderBlur02Material = 0;
s32 shaderNoiseDistortionMaterial = 0;

class MyEventReceiver : public IEventReceiver
{
public:
	bool OnEvent(SEvent event)
	{
		if(event.EventType == EET_KEY_INPUT_EVENT &&
			event.KeyInput.Key == KEY_ESCAPE &&
			!event.KeyInput.PressedDown)
		{
			device->closeDevice();
			return true;
		}
		if(event.EventType == EET_KEY_INPUT_EVENT &&
			event.KeyInput.Key == KEY_F1 &&
			!event.KeyInput.PressedDown)
		{
			screenQuad->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)shaderBlur02Material;
			return true;
		}
		if(event.EventType == EET_KEY_INPUT_EVENT &&
			event.KeyInput.Key == KEY_F2 &&
			!event.KeyInput.PressedDown)
		{
			screenQuad->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)shaderBlur01Material;
			return true;
		}
		if(event.EventType == EET_KEY_INPUT_EVENT &&
			event.KeyInput.Key == KEY_F3 &&
			!event.KeyInput.PressedDown)
		{
			screenQuad->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)shaderNoiseDistortionMaterial;
			return true;
		}
		return false;
	}
};


class CBlur01 : public video::IShaderConstantSetCallBack
{
public:
	virtual void OnSetConstants(video::IMaterialRendererServices* services, irr::s32 userData)
   {
   }
};

class CBlur02 : public video::IShaderConstantSetCallBack
{
public:
	virtual void OnSetConstants(video::IMaterialRendererServices* services, irr::s32 userData)
   {
   }
};

class CNoiseDistortion : public video::IShaderConstantSetCallBack
{
public:
	virtual void OnSetConstants(video::IMaterialRendererServices* services, irr::s32 userData)
   {
   }
};

int main()
{
	MyEventReceiver receiver;
	SIrrlichtCreationParameters param;
	param.AntiAlias                 = false;
	param.Bits                      = 32;
	param.DriverType                = video::EDT_DIRECT3D9;
	param.EventReceiver             = &receiver;
	param.Fullscreen                = false;
	param.HighPrecisionFPU          = true;
	param.Stencilbuffer             = true;
	param.Vsync                     = false;
	param.WindowSize.Width          = winWidth;
	param.WindowSize.Height         = winHeight;
	device = createDeviceEx(param);

	video::IVideoDriver* driver     = device->getVideoDriver();
	scene::ISceneManager* smgr      = device->getSceneManager();

	scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
	cam->setPosition(core::vector3df(0.0f, 200.0f, 0.0f));

	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
	smgr->addSkyBoxSceneNode(
		driver->getTexture("up.jpg"),
		driver->getTexture("down.jpg"),
		driver->getTexture("left.jpg"),
		driver->getTexture("right.jpg"),
		driver->getTexture("front.jpg"),
		driver->getTexture("back.jpg"));
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
	
	scene::IAnimatedMesh* room        = smgr->getMesh("room.3ds");
	smgr->getMeshManipulator()->makePlanarTextureMapping(room->getMesh(0), 0.002f);
	scene::IAnimatedMeshSceneNode* aroom = smgr->addAnimatedMeshSceneNode(room);
	aroom->setMaterialFlag(video::EMF_LIGHTING, false);
	aroom->setMaterialTexture(0, driver->getTexture("rockwall.bmp"));

	video::IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();

	CBlur01* blur01 = new CBlur01();
	c8* shaderBlur01Filename = "radialBlur.hlsl";
	shaderBlur01Material = gpu->addHighLevelShaderMaterialFromFiles(
		shaderBlur01Filename, "vertexMain", video::EVST_VS_1_1,
		shaderBlur01Filename, "pixelMain", video::EPST_PS_2_0,
		blur01, video::EMT_SOLID);
	blur01->drop();

	CBlur02* blur02 = new CBlur02();
	c8* shaderBlur02Filename = "gaussianblur.hlsl";
	shaderBlur02Material = gpu->addHighLevelShaderMaterialFromFiles(
		shaderBlur02Filename, "vertexMain", video::EVST_VS_1_1,
		shaderBlur02Filename, "pixelMain", video::EPST_PS_2_0,
		blur01, video::EMT_SOLID);
	blur02->drop();

	CNoiseDistortion* noiseDistortion = new CNoiseDistortion();
	c8* shaderNoiseDistortionFilename = "distortion.hlsl";
	shaderNoiseDistortionMaterial = gpu->addHighLevelShaderMaterialFromFiles(
		shaderNoiseDistortionFilename, "vertexMain", video::EVST_VS_1_1,
		shaderNoiseDistortionFilename, "pixelMain", video::EPST_PS_1_4,
		noiseDistortion, video::EMT_SOLID);
	noiseDistortion->drop();

	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
	video::ITexture* rt = driver->createRenderTargetTexture(core::dimension2di(winWidth, winHeight));
	screenQuad = new CScreenAlignedQuad(cam, smgr, 666);
	screenQuad->getMaterial(0).Textures[0]  = rt;
	screenQuad->getMaterial(0).Textures[1]  = driver->getTexture("noise.tga");
	screenQuad->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)shaderBlur01Material;
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

	smgr->setAmbientLight(video::SColorf(1.0f, 1.0f, 1.0f));
	device->getCursorControl()->setVisible(false);

	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(0,100,100,100));

        driver->setRenderTarget(rt, true, true, video::SColor(0,0,0,255));
        smgr->drawAll();//render all
        driver->setRenderTarget(0);
        screenQuad->render();//render just quad

        driver->endScene();

		core::stringw str;
		str = L"FPS[ ";
		str += driver->getFPS();
		str += " ]";
		device->setWindowCaption(str.c_str());
	}
	if(rt)
		rt->drop();
	if(screenQuad)
		screenQuad->drop();
	device->drop();
	return 0;
}
shaders

radialBlur.hlsl

Code: Select all

struct VS_OUTPUT
{
    float4 Pos      : POSITION;
    float2 TexCoord : TEXCOORD0;
};

VS_OUTPUT vertexMain(in float4 pos      : POSITION,
                     in float2 texCoord : TEXCOORD)
{
    VS_OUTPUT Out;
   
    Out.Pos      = pos;
    Out.TexCoord = texCoord;
   
    return Out;
}

sampler2D screenSampler : register(s0);
   
float4 pixelMain(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float2 Center   = {0.5, 0.5};
    float BlurStart = 1.0;
    float BlurWidth = -0.14;
    float samples   = 16;

    float4 Color = 0;
   
    for(int i = 0; i < samples; i++)
    {
    	float scale = BlurStart + BlurWidth * (i / (samples - 1));
    	Color      += tex2D(screenSampler, (TexCoord - 0.5) * scale + Center );
    }
    Color /= samples;

    return Color;
}
gaussianBlur.hlsl

Code: Select all

struct VS_OUTPUT
{
    float4 Pos      : POSITION;
    float2 TexCoord : TEXCOORD0;
};

VS_OUTPUT vertexMain(in float4 pos      : POSITION,
                     in float2 texCoord : TEXCOORD)
{
    VS_OUTPUT Out;
    
    Out.Pos      = pos;
    Out.TexCoord = texCoord;

    return Out;
}

sampler2D screenSampler : register(s0);

float4 pixelMain(float2 TexCoord : TEXCOORD0 ) : COLOR0
{
    float blurOffset = 0.16;
    
    float2 TexelKernel[8] =
    {
       { -4, 0 },
       { -3, 0 },
       { -2, 0 },
       { -1, 0 },
       {  1, 0 },
       {  2, 0 },
       {  3, 0 },
       {  4, 0 },
    };

    float BlurWeights[8] =
    {
        0.002216,
        0.008764,
        0.026995,
        0.064759,
        0.064759,
        0.026995,
        0.008764,
        0.002216,
    };

    float4 Color = 0;

    for (int i = 0; i < 8; i++)
    {    
        Color += tex2D(screenSampler, TexCoord + (TexelKernel[i].yx * blurOffset) * BlurWeights[i]);
        Color += tex2D(screenSampler, TexCoord + (TexelKernel[i].xy * blurOffset) * BlurWeights[i]);
    }
    
    Color /= 16;
    
    //Color.r *= 4;//i am bleeding :)
    //Color *= 1.5;//bloom?
    
    return Color;
}
distortion.hlsl (i realy like this one, but it shows some strange
artifacts when you go outside of the room(vertical lines apeir
, if someone knows how to fix this please show me))

Code: Select all

struct VS_OUTPUT
{
    float4 Pos        : POSITION;
    float2 TexCoord0  : TEXCOORD0;
};

VS_OUTPUT vertexMain(float4 pos        : POSITION,
                     float2 texCoord0  : TEXCOORD0)
{
    VS_OUTPUT Out;

    Out.Pos      = pos;
    Out.TexCoord0 = texCoord0;

    return Out;
}

sampler screenSampler     : register(s0);
sampler distorsionSampler : register(s1);

float4 pixelMain(float2 texCoord: TEXCOORD0) : COLOR
{
    float distort   = -0.12;
    float undistort = -0.01;
       
    float2 s = tex2D(distorsionSampler, texCoord).xy;
	s = lerp(distort, undistort,s);
	float2 d = s * (texCoord - 0.5);
	float2 n = texCoord + d;
	float4 Color = tex2D(screenSampler, n);
    return Color;
}
resources

noise.jpg (in code .tga)

Image

comments

press F1, F2 and F3 to change material aplied.

fire effect

source

main.cpp

Code: Select all

#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")

const s32 winWidth          = 800;
const s32 winHeight         = 600;

IrrlichtDevice* device = 0;

class MyEventReceiver : public IEventReceiver
{
public:
	bool OnEvent(SEvent event)
	{
		if(event.EventType == EET_KEY_INPUT_EVENT &&
			event.KeyInput.Key == KEY_ESCAPE &&
			!event.KeyInput.PressedDown)
		{
			device->closeDevice();
			return true;
		}
		return false;
	}
};

class CFireMaterial : public video::IShaderConstantSetCallBack
{
public:
	virtual void OnSetConstants(video::IMaterialRendererServices* services, irr::s32 userData)
   {
      video::IVideoDriver* driver = services->getVideoDriver();

	  core::matrix4 worldViewProj;
      worldViewProj = driver->getTransform(video::ETS_PROJECTION);			
      worldViewProj *= driver->getTransform(video::ETS_VIEW);
      worldViewProj *= driver->getTransform(video::ETS_WORLD);
      services->setVertexShaderConstant("wvp", &worldViewProj[0], 16);

	  float time  = (float)device->getTimer()->getTime();
      services->setVertexShaderConstant("time", &time, 1);
   }
};

int main()
{
	MyEventReceiver receiver;
	SIrrlichtCreationParameters param;
	param.AntiAlias                 = false;
	param.Bits                      = 32;
	param.DriverType                = video::EDT_DIRECT3D9;
	param.EventReceiver             = &receiver;
	param.Fullscreen                = false;
	param.HighPrecisionFPU          = true;
	param.Stencilbuffer             = true;
	param.Vsync                     = false;
	param.WindowSize.Width          = winWidth;
	param.WindowSize.Height         = winHeight;
	device = createDeviceEx(param);

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

    CFireMaterial* fire = new CFireMaterial();
	video::IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();
	c8* shaderFireFilename = "fire.hlsl";
	s32 shaderFireMaterial = gpu->addHighLevelShaderMaterialFromFiles(
		shaderFireFilename, "vertexMain", video::EVST_VS_1_1,
		shaderFireFilename, "pixelMain", video::EPST_PS_2_0,
		fire, video::EMT_TRANSPARENT_ADD_COLOR);
	fire->drop();

	scene::ISceneNode* bill = smgr->addBillboardSceneNode(
		0, core::dimension2d<f32>(100.0f, 100.0f));
	bill->setMaterialTexture(0, driver->getTexture("diffuse.tga"));
	bill->setMaterialTexture(1, driver->getTexture("distortion.tga"));
	bill->setMaterialTexture(2, driver->getTexture("transparency.tga"));
	bill->setMaterialType((video::E_MATERIAL_TYPE)shaderFireMaterial);

	scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100.0f, 150.0f);
	cam->setPosition(core::vector3df(0.0f, 0.0f, -100.0f));
	cam->setTarget(bill->getPosition());

	scene::IAnimatedMesh* m = smgr->getMesh("room.3ds");
	smgr->getMeshManipulator()->makePlanarTextureMapping(m->getMesh(0), 0.004f);
	scene::IAnimatedMeshSceneNode* am = smgr->addAnimatedMeshSceneNode(m);
	am->getMaterial(0).Textures[0] = driver->getTexture("rockwall.bmp");
	am->getMaterial(0).Lighting    = false;
	am->setPosition(core::vector3df(0.0f, -150.0f, 0.0f));

	device->getCursorControl()->setVisible(false);

	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(255, 128, 128, 128));
		smgr->drawAll();
		driver->endScene();

		core::stringw str;
		str = L"FPS ";
		str += driver->getFPS();
		str += L" ";
		device->setWindowCaption(str.c_str());
	}
	device->drop();
	return 0;
}
shader

fire.hlsl

Code: Select all

float4x4 wvp;
float time;

struct VS_OUTPUT
{
   float4 Pos       : POSITION;
   float2 TexCoord0 : TEXCOORD0;
   float2 TexCoord1 : TEXCOORD1;
   float2 TexCoord2 : TEXCOORD2;
   float2 TexCoord3 : TEXCOORD3;
};

VS_OUTPUT vertexMain (float4 pos: POSITION, 
                      float2 texCoord : TEXCOORD0)
{
   VS_OUTPUT Out;
   Out.Pos = mul(pos, wvp);

   float4 layer_speed = float4(0.2, 0.52, 0.1, 1.0);
   
   Out.TexCoord0 = texCoord;
   Out.TexCoord0.y += 0.2;

   Out.TexCoord1.x = texCoord.x;
   Out.TexCoord1.y = texCoord.y + layer_speed.x * time / 1000.0;

   Out.TexCoord2.x = texCoord.x;
   Out.TexCoord2.y = texCoord.y + layer_speed.y * time / 1000.0;

   Out.TexCoord3.x = texCoord.x;
   Out.TexCoord3.y = texCoord.y + layer_speed.z * time / 1000.0;

   return Out;
}

sampler fire_base       : register(s0);
sampler fire_distortion : register(s1);
sampler fire_opacity    : register(s2);

float4 bx2(float x)
{
   return 2.0f * x - 1.0f;
}

float4 pixelMain (float4 tc0 : TEXCOORD0, 
                  float4 tc1 : TEXCOORD1,
                  float4 tc2 : TEXCOORD2, 
                  float4 tc3 : TEXCOORD3) : COLOR
{
   float distortion_amount0  = 0.092;
   float distortion_amount1  = 0.092;
   float distortion_amount2  = 0.092;
   
   float4 height_attenuation = float4(0.3, 0.39, 0.0, 1.0);
   
   float4 noise0 = tex2D(fire_distortion, tc1);
   float4 noise1 = tex2D(fire_distortion, tc2);
   float4 noise2 = tex2D(fire_distortion, tc3);

   float4 noiseSum = bx2(noise0) * distortion_amount0 + 
          bx2(noise1) * distortion_amount1 + bx2(noise2) * distortion_amount2;
          
   float4 perturbedBaseCoords = tc0 + noiseSum * (tc0.y * 
         height_attenuation.x + height_attenuation.y);

   float4 base    = tex2D(fire_base, perturbedBaseCoords) * 2;
   float4 opacity = tex2D(fire_opacity, perturbedBaseCoords);

   return base * opacity;
}
resources

diffuse.jpg

Image

distortion.jpg

Image

transparency.jpg

Image

comments

this is shader from ATIRenderMonkey, changed some stuff to be
able to work with irrlicht(some code and grafics, now looks better then in
RM, at least for me).

I have also my parallax shader witch i didnt post because i cant get
lighting to look right :cry:
I could post it here also if someone could fix lightning, maybie?
I was struggling with it for long time and cant get it to work propertly. :oops:
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
Virion
Competition winner
Posts: 2149
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Got any screenshot for this?
My company: https://kloena.com
My profile: https://zhieng.com
My co-working space: https://deskspace.info
My game engine: https://kemena3d.com
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Sorry, i got here slow internet speeds(upload/download is taking forever).
Maybie someone could taste this and post screenshots.
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Ok, but realy small screens:

fire

Image

radialblur

Image

gaussianblur

Image

distort

Image
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

I was going to post such onscreen shaders, too..
but in GLSL....
(maybe you want to convert my motionblur-shader to HLSL, should be very very simple!! just replacing the texture2D with tex2D, vec3 with float3 and stuff)
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Trying it now.
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
Virion
Competition winner
Posts: 2149
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Are those post processing?
My company: https://kloena.com
My profile: https://zhieng.com
My co-working space: https://deskspace.info
My game engine: https://kemena3d.com
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Nice effects.

I have already made a framework, sortof, for post processing. If you'd let me, i'd convert/implement those effects, with the goal being to gather all post processing effects people post/publish. Sortof. I think it's a shame that we all reinvent post processing all the time :P
If you don't have anything nice to say, don't say anything at all.
Virion
Competition winner
Posts: 2149
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Combine all the advantages from each of the post processing and integrate the whole thing into the irrlicht engine. Then the next step is to discuss about shader stuffs and keep on improving the post processing system.

Just a suggestion though... :wink:
My company: https://kloena.com
My profile: https://zhieng.com
My co-working space: https://deskspace.info
My game engine: https://kemena3d.com
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Luben wrote:Nice effects.

I have already made a framework, sortof, for post processing. If you'd let me, i'd convert/implement those effects, with the goal being to gather all post processing effects people post/publish. Sortof. I think it's a shame that we all reinvent post processing all the time
Yes offcourse.It is meant for all ppl and free.

Just to ask you, as i understand you, you are developing multipass pp able
scene node?

If so then we can separate (for example gaussian) Vertical blur in one
and Horizontal in other pass, also for other shaders that needs to be multipass.

Sorry for my english, cant find suitable words to express my self. :oops:
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Virion wrote:Are those post processing?
Everything except fire.Try it and you'll know. :wink:
TheGameMaker wrote:I was going to post such onscreen shaders, too..
but in GLSL....
(maybe you want to convert my motionblur-shader to HLSL, should be very very simple!! just replacing the texture2D with tex2D, vec3 with float3 and stuff)
I will continue where i back home.My neighboar(i know its wrong but i forget the right word, but you'll understand what i meant) cant wait all day for his PC.And if i succed i will post it here.
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

you can easyly fake multipass like did in my motionblur, by just build a chain of single effects(each on renders it the RT of the next effect...)
belfegor
Posts: 383
Joined: Mon Sep 18, 2006 7:22 pm
Location: Serbia

Post by belfegor »

Ok, ill try your suggestions.

Does anybody know for GLSL mix() function eqvivalent for HLSL?
Or at least tell what operations it does?
Small FPS demo made using Irrlicht&NewtonDEMO
InfoHERE
Its at very early stage but i think im crazy enough to finish it all alone.
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

float result=mix(float a,floatb,float strength)

result=a*strength+(1-strength)*b;
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

if mix() is what TGM wrote, then i think lerp() is the same, but i may remember wrong.

Yes, it has multipass support, but i refer to a pass as an effect and multiple passes as an effect chain. I've posted a thread in the projects announcment forum (here http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=20901). But for the moment i'm unable to work furhter on it.
If you don't have anything nice to say, don't say anything at all.
Post Reply