Chernobyl Shaders - converting all shaders to Cg in work...

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

I wish I could use shaders, they look really nice.
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Great stuff Nadro! Keep up the awesome work....Ill try to implement these into my projects :P (Giving you all the credit ofcourse!)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

:) OK you can use this stuff in your project :) I can't currently work on next shader (and repair multi-light), because I'm finishing my Game (commercial project on Irrlicht, I add screenshot in August). If I done game I add next shader:)
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

Hey guys, can anyone accord me a plastic shader in HLSL? Perhaps convert Nadro's one to HLSL? Don't know how much work it is to convert such a shader, sry.

@Nadro: great work!

@BlindSide: When do you think to release your shader-pack? Does it contain a plastic shader? Which shader will it include in general?
Hope your pack is released soon :P
Image
HidekiAI
Posts: 1
Joined: Fri Jul 06, 2007 9:34 pm
Location: USA
Contact:

Post by HidekiAI »

BlindSide wrote:Hey since you are good at GLSL can you convert my shadow mapping shaders from HLSL to GLSL please? I will release my own shader pack very soon in HLSL so we can work together to provide solutions for both drivers.

PS: Irrlicht already has Shadow Volumes thats what stencil shadows are...But maybe it is faster in a shader?
You can probably use ATI's http://sourceforge.net/projects/hlsl2glsl to convert most of your HLSL to GLSL.
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

is there a tool to do it the other way around?
Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

HidekiAI wrote:
BlindSide wrote:Hey since you are good at GLSL can you convert my shadow mapping shaders from HLSL to GLSL please? I will release my own shader pack very soon in HLSL so we can work together to provide solutions for both drivers.

PS: Irrlicht already has Shadow Volumes thats what stencil shadows are...But maybe it is faster in a shader?
You can probably use ATI's http://sourceforge.net/projects/hlsl2glsl to convert most of your HLSL to GLSL.
Yes I used this but for some reason it didnt work, I think it will need someone to do it manually. Also Irrlicht requires a special method for passing textures to GLSL that is different from HLSL (And im not sure what that method is haha). But I really want to switch shadow maps to open gl because:

A - In opengl (In irrlicht) you can have any resolution RTT you want, so high res shadow maps without having to change screenres.

B - In opengl (In irrlicht) you can use 24-bit depth maps.

@Masterhawk. About releasing my pack, it will hopefully be pretty soon. I had the flu for a while and I just went on a trip too so time was limited. Hopefully tomorrow or the day after I can finish it up. It has some shaders similar to plastic like phong etc. In fact there is a plastic material so I will try and add that one (Not sure what shader model it was tho..).
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

[EDIT]
Last edited by Nadro on Mon Jul 09, 2007 4:35 pm, edited 2 times in total.
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

BlindSide wrote: B - In opengl (In irrlicht) you can use 24-bit depth maps.
How?
If you don't have anything nice to say, don't say anything at all.
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

Hm, this shader don't work for me. First it says ' Unexpected token: "[" '. When I comment it out the shader loads correctly, but when using I cannot see my sphere and an error message occurs again and again...

error msg:
HLSL Variable to set not found: 'mLightColor'. Available variables are:
'view_position' Registers:[begin:4, count:1]
'view_proj_matrix' Registers:[begin:0, count:4]
Do I have to have a dynamic light in my scene?
Image
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

You must add variable in CallBack mLightColor eg:

Code: Select all

video::SColorf Color(1.0,0.9031,0.1536,1.0);
services->setVertexShaderConstant("mLightColor",reinterpret_cast<f32*>(&Color), 4);
For OpenGL my shader CallBack look that:

Code: Select all

class CGE_Shaders:public video::IShaderConstantSetCallBack
{
public:

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

		core::vector3df Camera_Pos = device->getSceneManager()->getActiveCamera()->getAbsolutePosition();
        services->setVertexShaderConstant("Camera_Position", reinterpret_cast<f32*>(&Camera_Pos), 3);

		video::SColorf Color(1.0,0.9031,0.1536,1.0);
        services->setVertexShaderConstant("Color", reinterpret_cast<f32*>(&Color), 4);
	}
};
You needn't any Lights on the scene :)
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

But these variables are already set in my shader callback. that's the strange thing...

my shadercallback is the one from the shader-tutorial
http://irrlicht.sourceforge.net/tut010.html
Image
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I write this shader in HLSL tomorrow :) and I upload it :)
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

@MasterHawk. Thats not a serious error. It just means that the you have passed the shader the mLightColor variable, but the shader is not using it in its variables to output the final result. All you have to do is comment out the variable from your shader callback.
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

BlindSide wrote:@MasterHawk. Thats not a serious error. [...]
Hehe, not serious, huh.... :lol:
When I use this shader I cannot see my sphere anymore... :wink:

I think I'll wait for Nadros rewritten HLSL shaders....
Image
Post Reply